Beispiel #1
0
void vm_init_globals() {
  check_ThreadShadow();
  basic_types_init();
  eventlog_init();
  mutex_init();
  chunkpool_init();
  perfMemory_init();
}
Beispiel #2
0
void vm_init_globals() {
  check_ThreadShadow();
  basic_types_init();
  eventlog_init();
  mutex_init();
  chunkpool_init();
  perfMemory_init();
  if (GCTimers) {
    tty->print_cr("vm start: "INT64_FORMAT_W(13), os::javaTimeMillis());
  }
}
/*-----------------------------------------------
 | create_symbol_tables
 +---------------------------------------------*/
void create_symbol_tables(struct ast *parse_tree)
{
    struct decl *tdecl;
    struct declarator_list *decolist;
    struct function_def *funcdef;
    int i=1;
    int tldloop=0;
    struct declarator *d;
    struct declarator *dporig;
    char symtab_name[100];


    /* Initialize basic_types data structure
    +-----------------------------------------*/
    basic_types_init();



    /* Initialize global symbol table
    +----------------------------------*/
    global_symtab_init();



    /* create_symbol_table() accepts the root of parse tree as its param.
    |  The root of the parse tree is a *tld_list so we'll cast the param
    |  into a *tld_list.
    +--------------------------------------------------------------------*/
    struct tld_list *tldlist= (struct tld_list *)parse_tree;



    /* A tld_list has a series of tld nodes; each node pointing to either
    |  a decl or a funcdef.  We'll create and populate symtabs as We cycle
    |  through all of the TLD's in a do-while loop.
    +---------------------------------------------------------------------*/
    do
    {   curr_symtab= global_top_level; /* always start with the global symtab */


        /*--------------------------------------------+
        |            if TLD is a DECL
        +---------------------------------------------*/
        if(tldlist->tld->datatype == DECL)
        {   tdecl= (struct decl *)tldlist->tld->d;

            /* Add decl to symbol table */
            ast_to_symtab((struct ast *)tdecl,curr_symtab);
	}



        /*--------------------------------------------+
        |      if TLD is a FUNCTION_DEFINITION
        +---------------------------------------------*/
        if(tldlist->tld->datatype == FUNCTION_DEFINITION)
        {
	    /* retrieve function definition */
	    struct function_def *funcdef= (struct function_def *)tldlist->tld->f;


	    /* add funcdef to symtab */
	    funcdef_to_symtab(funcdef);
	}

    }while( (tldlist= tldlist->next) != NULL );




    /* Cycle through all symbols in the global_top_level symtab and
    |  verify that there are no more function declarators left.
    +------------------------------------------------------------------*/
    for(i=0; i<NHASH; i++)
    {   /*printf("global_top_level->symtab[%d]: %ld\n",    i,global_top_level->symtab[i]); */

        if(global_top_level->symtab[i])
	{   d= global_top_level->symtab[i];
	    dporig= d;


            /* ffwd pointer declarators */
            if(d->nodetype == POINTER_DECLARATOR)
            {   /* fast_forward */
	        while(d->next)
	        {   d= d->next;
	        }
            }


            /* if this is a function declarator...
            +---------------------------------------*/
            if(d->nodetype == FUNCTION_DECLARATOR)
            {

                /* if this declarator doesn't belong to a function def,
                |  then it's a declarator that has not been defined.
	        |  Exit with an error.
	        +--------------------------------------------------------*/
	        if(!dporig->funcdef_true)
	        {   printf("\nError: function prototype for '%s' was never defined.\n", d->adeclarator->id);
		    exit(-1);
	        }

            }
        }
    }
}