static int gobble(struct filepointer *filep, struct inclist *file, struct inclist *file_red) { char *line; int type; while ((line = getnextline(filep))) { switch(type = deftype(line, filep, file_red, file, FALSE)) { case IF: case IFFALSE: case IFGUESSFALSE: case IFDEF: case IFNDEF: type = gobble(filep, file, file_red); while ((type == ELIF) || (type == ELIFFALSE) || (type == ELIFGUESSFALSE)) type = gobble(filep, file, file_red); if (type == ELSE) (void)gobble(filep, file, file_red); break; case ELSE: case ENDIF: debug(0,("%s, line %d: #%s\n", file->i_file, filep->f_line, directives[type])); return(type); case DEFINE: case UNDEF: case INCLUDE: case INCLUDEDOT: case PRAGMA: case ERROR: case IDENT: case SCCS: case EJECT: case WARNING: case INCLUDENEXT: case INCLUDENEXTDOT: break; case ELIF: case ELIFFALSE: case ELIFGUESSFALSE: return(type); case -1: warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); warning1(", line %d: unknown directive == \"%s\"\n", filep->f_line, line); break; } } return(-1); }
void included_by(struct inclist *ip, struct inclist *newfile) { register int i; if (ip == NULL) return; /* * Put this include file (newfile) on the list of files included * by 'file'. If 'file' is NULL, then it is not an include * file itself (i.e. was probably mentioned on the command line). * If it is already on the list, don't stick it on again. */ if (ip->i_list == NULL) { ip->i_list = (struct inclist **) malloc(sizeof (struct inclist *) * ++ip->i_listlen); ip->i_merged = (boolean *) malloc(sizeof (boolean) * ip->i_listlen); } else { for (i = 0; i < ip->i_listlen; i++) if (ip->i_list[i] == newfile) { i = strlen(newfile->i_file); if (!(ip->i_flags & INCLUDED_SYM) && !(i > 2 && newfile->i_file[i - 1] == 'c' && newfile->i_file[i - 2] == '.')) { /* only bitch if ip has */ /* no #include SYMBOL lines */ /* and is not a .c file */ if (warn_multiple) { warning("%s includes %s more than once!\n", ip->i_file, newfile->i_file); warning1("Already have\n"); for (i = 0; i < ip->i_listlen; i++) warning1("\t%s\n", ip->i_list[i]->i_file); } } return; } ip->i_list = (struct inclist **) realloc(ip->i_list, sizeof (struct inclist *) * ++ip->i_listlen); ip->i_merged = (boolean *) realloc(ip->i_merged, sizeof (boolean) * ip->i_listlen); } ip->i_list[ip->i_listlen - 1] = newfile; ip->i_merged[ip->i_listlen - 1] = FALSE; }
// an optimized version inline oop blockOopClass::really_clone_block(smiOop fp) { assert_block(this, "not a block"); assert_smi(fp, "not a smallInt or pointer"); NumberOfBlockClones++; const int32 size = sizeof(blockOopClass)/oopSize; // would be cleaner (but slightly slower in the fast case) to do // b= Memory->alloc_objs(size); // if (Memory->new_gen->eden_space->contains(b)) ... blockOopClass* b= (blockOopClass*) Memory->new_gen->eden_space->alloc_objs_local(size); if (b) { # if GENERATE_DEBUGGING_AIDS if (CheckAssertions && b == (blockOopClass*)catchThisOne) { warning1("blockOopClass::really_clone_block caught 0x%lx", b); } # endif // allocated in eden; don't do check stores or scavenging b->_map = addr()->_map; b->setHomeFr(fp); blockOop b1 = as_blockOop(b); b1->init_mark(); return b1; } else { // overflowed eden; do check stores when done b = (blockOopClass*) Memory->alloc_objs(size); Memory->store((oop*) &b->_map, addr()->_map); b->setHomeFr(fp); blockOop b1 = as_blockOop(b); b1->init_mark(); return b1; } }
void MonitorCPUBar::calculate_VM_stats() { in_core_percentage_1 = (usedS + usedU) ? usedU * 100 / (usedS + usedU) : 100; if (in_core_percentage_1 < 0 || in_core_percentage_1 > 100) { warning1("cpuBar: in_core_percentage_1 is %ld", in_core_percentage_1); if (in_core_percentage_1 < 0) in_core_percentage_1 = 0; if (in_core_percentage_1 > 100) in_core_percentage_1 = 100; } }
void ProcessInfo::update() { SignalBlocker sb; // attempt to head off weird mach errors unsigned int thread_info_count = THREAD_BASIC_INFO_COUNT; unsigned int task_info_count = TASK_EVENTS_INFO_COUNT; kern_return_t thread_err, task_err; thread_err = thread_info( mach_thread_self(), THREAD_BASIC_INFO, (thread_info_t)&my_thread_info, &thread_info_count); task_err = task_info( mach_task_self(), TASK_EVENTS_INFO, (task_info_t)& my_task_info, & task_info_count); static bool aw = true, hw = true; if ( task_err == MIG_ARRAY_TOO_LARGE || task_err == MACH_RCV_TOO_LARGE) { if (aw) {aw = false; warning(" task_info has grown"); } task_err = KERN_SUCCESS; } if ( thread_err == MIG_ARRAY_TOO_LARGE || thread_err == MACH_RCV_TOO_LARGE) { if (hw) {hw = false; warning("thread_info has grown"); } thread_err = KERN_SUCCESS; } // I don't know why this sometimes fails, but it's not fatal. -- dmu 2/04 if ( task_err != KERN_SUCCESS && !aw) {aw = true; warning1("Error calling task_info() %s\n", mach_error_string( task_err)); } if (thread_err != KERN_SUCCESS && !hw) {hw = true; warning1("Error calling thread_info() %s\n", mach_error_string(thread_err)); } }
newSpace::newSpace(const char *nm, int32 &size, FILE *snap) : space(nm, snap) { int32 snap_size = old_size_bytes(); if (size < snap_size) { warning1("Default size for %s too small for snapshot; ignoring", nm); size= snap_size; } assert((size & (oopSize-1)) == 0, "space size must be a multiple of oop size"); }
void* selfs_malloc(size_t size) { if (!MallocInProgress) ; else if (profilerCollectStackSemaphore) warning("profiler is reentering malloc; hope it will work"); else { MallocInProgress = false; // because fatal uses printf uses malloc... fatal("malloc/free aren't reentrant"); } MallocInProgress = true; // for hprofiler size = max(1, size); // malloc does not seem to like zero, at least on PPC char* result = (char*)malloc(size); if ((int)result & 0x80000000) fatal("xxxxxxx"); MallocInProgress = false; if (result == NULL) { warning1("malloc failed to allocate %d bytes", size); if (mallocReserve && size <= mallocReserveAmount) { MallocInProgress= true; free(mallocReserve); mallocReserve= NULL; result= (char*)malloc(size); if ((int)result & 0x80000000) fatal("xxxxxxx"); MallocInProgress= false; warning( "Memory for the Self VM is running low; the system may crash\n" "soon. You would be advised to save then exit, and increase the amount\n" "of swap space available to Self. Forcing a garbage collection is\n" "unlikely to help and may in fact precipitate a crash.\n" "You can force an immediate snapshot with the expression\n" "\t'snapshotFileName' _WriteSnapshot" ); } else return NULL; } int32* p = (int32*)result; // assert(true_size_of_malloced_obj(p) >= size, "should be rounded size"); int ts = true_size_of_malloced_obj(p); # if GENERATE_DEBUGGING_AIDS if (CheckAssertions) { // cannot use assert because printf uses malloc() ... if (ts != 0 && ts < size) breakpoint(); if (result == (char*)catchThisOne) breakpoint(); } # endif if (ts) { TrackCHeapInMonitor::adjust(ts); wastedBytes += (ts - size); } return result; }
int main (int argc, char *argv[]) { char **str; int n, i; if (argc != 2) error1 ("usage: load_textfile filename\n"); n = load_textfile (argv[1], &str); if (n <= 0) error1 ("cannot load %s\n", argv[1]); warning1 ("loaded %d lines from %s\n", n, argv[1]); for (i=0; i<n; i++) printf ("%4d. [%s]\n", i, str[i]); return 0; }
oop graph_creator::clone_block_pt(block_node* n) { int size = n->num_of_edges(cutoff); oop oop_node= block_node_pt->cloneSize(size * 2, CANFAIL); if (oop_node == failedAllocationOop) return failedAllocationOop; // find outer most lexical node oop o = n->outer_method(); oop lex_oop = NULL; for (int i= node_path->length() - 1; i >= 0 && !lex_oop ; i--) { if (node_path->nth(i)->callee->is_method_node()) { method_node* mn = (method_node*) node_path->nth(i)->callee; if (mn->method() == o) lex_oop = oop_path->nth(i); } } if (!SpendTimeForDebugging) assert(TARGET_ARCH == PPC_ARCH || lex_oop, "lexical node should be on stack (but PPC may miss frame next to bottom)"); else if (TARGET_ARCH != PPC_ARCH && !lex_oop) { lprintf("\n\nlexical node should be on stack\n"); lprintf("\n\nselector:\n"); n->selector()->print(); lprintf("\nnmethod\n"); n->method()->print(); lprintf("\n\nouter method\n"); n->outer_method()->print(); for (int i= node_path->length() - 1; i >= 0 && !lex_oop; --i) { lprintf("node %d in path:\n", i); if (node_path->nth(i)->callee->is_method_node()) { method_node* mn = (method_node*) node_path->nth(i)->callee; lprintf("\nselector\n"); mn->selector()->print(); lprintf("\nreceiverMapOop\n"); mn->receiverMapOop()->print(); lprintf("\nprint_map\n"); mn->receiverMap()->print_map(); lprintf("\nmethod\n"); mn->method()->print(); lprintf("\n\n"); } } warning1("method = 0x%x\n\n", o); } block_pt_info->fill(oop_node, n, lex_oop ? lex_oop : Memory->nilObj); return oop_node; }
void add_include(struct filepointer *filep, struct inclist *file, struct inclist *file_red, const char *include, int type, boolean failOK) { register struct inclist *newfile; register struct filepointer *content; /* * First decide what the pathname of this include file really is. */ newfile = inc_path(file->i_file, include, type); if (newfile == NULL) { if (failOK) return; if (file != file_red) warning("%s (reading %s, line %ld): ", file_red->i_file, file->i_file, filep->f_line); else warning("%s, line %ld: ", file->i_file, filep->f_line); warning1("cannot find include file \"%s\"\n", include); show_where_not = TRUE; newfile = inc_path(file->i_file, include, type); show_where_not = FALSE; } if (newfile) { included_by(file, newfile); if (!(newfile->i_flags & SEARCHED)) { newfile->i_flags |= SEARCHED; content = getfile(newfile->i_file); find_includes(content, newfile, file_red, 0, failOK); freefile(content); } } }
struct inclist *inc_path(char *file, char *include, boolean dot, struct IncludesCollection *incCollection) { static char path[ BUFSIZ ]; char **pp, *p; struct inclist *ip; struct stat st; boolean found = FALSE; (void)dot; /* * Check all previously found include files for a path that * has already been expanded. */ for (ip = inclist; ip->i_file; ip++) if ((strcmp(ip->i_incstring, include) == 0) && !ip->i_included_sym) { found = TRUE; break; } /* * If the path was surrounded by "" or is an absolute path, * then check the exact path provided. */ // FIXME: creates duplicates in the dependency files if absolute paths are // given, which certainly is not the intended behavior. Also it slows down // makedepend performance considerably. // if (!found && (dot || *include == '/')) { // // if ((exists_path(incCollection, include)) && stat(include, &st) == 0 && !( st.st_mode & S_IFDIR)) { // ip = newinclude(include, include); // found = TRUE; // } // else if (show_where_not) // warning1("\tnot in %s\n", include); // } /* * See if this include file is in the directory of the * file being compiled. */ if (!found) { for (p=file+strlen(file); p>file; p--) if (*p == '/') break; if (p == file) strcpy(path, include); else { strncpy(path, file, (p-file) + 1); path[ (p-file) + 1 ] = '\0'; strcpy(path + (p-file) + 1, include); } remove_dotdot(path); if ((exists_path(incCollection, path)) && stat(path, &st) == 0 && !( st.st_mode & S_IFDIR)) { ip = newinclude(path, include); found = TRUE; } else if (show_where_not) warning1("\tnot in %s\n", path); } /* * Check the include directories specified. (standard include dir * should be at the end.) */ if (!found) for (pp = includedirs; *pp; pp++) { sprintf(path, "%s/%s", *pp, include); remove_dotdot(path); if ((exists_path(incCollection, path)) && stat(path, &st) == 0 && !(st.st_mode & S_IFDIR)) { ip = newinclude(path, include); found = TRUE; break; } else if (show_where_not) warning1("\tnot in %s\n", path); } if (!found) ip = NULL; return(ip); }
int find_includes(struct filepointer *filep, struct inclist *file, struct inclist *file_red, int recursion, boolean failOK) { struct inclist *inclistp; char **includedirsp; register char *line; register int type; boolean recfailOK; while ((line = getnextline(filep))) { switch(type = deftype(line, filep, file_red, file, TRUE)) { case IF: doif: type = find_includes(filep, file, file_red, recursion+1, failOK); while ((type == ELIF) || (type == ELIFFALSE) || (type == ELIFGUESSFALSE)) type = gobble(filep, file, file_red); if (type == ELSE) gobble(filep, file, file_red); break; case IFFALSE: case IFGUESSFALSE: doiffalse: if (type == IFGUESSFALSE || type == ELIFGUESSFALSE) recfailOK = TRUE; else recfailOK = failOK; type = gobble(filep, file, file_red); if (type == ELSE) find_includes(filep, file, file_red, recursion+1, recfailOK); else if (type == ELIF) goto doif; else if ((type == ELIFFALSE) || (type == ELIFGUESSFALSE)) goto doiffalse; break; case IFDEF: case IFNDEF: { int isdef = (isdefined(line, file_red, NULL) != NULL); if (type == IFNDEF) isdef = !isdef; if (isdef) { debug(1,(type == IFNDEF ? "line %d: %s !def'd in %s via %s%s\n" : "", filep->f_line, line, file->i_file, file_red->i_file, ": doit")); type = find_includes(filep, file, file_red, recursion+1, failOK); while (type == ELIF || type == ELIFFALSE || type == ELIFGUESSFALSE) type = gobble(filep, file, file_red); if (type == ELSE) gobble(filep, file, file_red); } else { debug(1,(type == IFDEF ? "line %d: %s !def'd in %s via %s%s\n" : "", filep->f_line, line, file->i_file, file_red->i_file, ": gobble")); type = gobble(filep, file, file_red); if (type == ELSE) find_includes(filep, file, file_red, recursion+1, failOK); else if (type == ELIF) goto doif; else if (type == ELIFFALSE || type == ELIFGUESSFALSE) goto doiffalse; } } break; case ELSE: case ELIFFALSE: case ELIFGUESSFALSE: case ELIF: if (!recursion) gobble(filep, file, file_red); case ENDIF: if (recursion) return(type); case DEFINE: define(line, file); break; case UNDEF: if (!*line) { warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); warning1(", line %d: incomplete undef == \"%s\"\n", filep->f_line, line); break; } undefine(line, file_red); break; case INCLUDE: case INCLUDEDOT: case INCLUDENEXT: case INCLUDENEXTDOT: inclistp = inclistnext; includedirsp = includedirsnext; debug(2,("%s, reading %s, includes %s\n", file_red->i_file, file->i_file, line)); add_include(filep, file, file_red, line, type, failOK); inclistnext = inclistp; includedirsnext = includedirsp; break; case ERROR: case WARNING: warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); warning1(", line %d: %s\n", filep->f_line, line); break; case PRAGMA: case IDENT: case SCCS: case EJECT: break; case -1: warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); warning1(", line %d: unknown directive == \"%s\"\n", filep->f_line, line); break; case -2: warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); warning1(", line %d: incomplete include == \"%s\"\n", filep->f_line, line); break; } } file->i_flags |= FINISHED; debug(2,("finished with %s\n", file->i_file)); return(-1); }
struct inclist *inc_path(char *file, char *include, boolean dot) { static char path[BUFSIZ]; register char **pp, *p; register struct inclist *ip; struct stat st; boolean found = FALSE; /* * Check all previously found include files for a path that * has already been expanded. */ for (ip = inclist; ip->i_file; ip++) if ((strcmp(ip->i_incstring, include) == 0) && !(ip->i_flags & INCLUDED_SYM)) { found = TRUE; break; } /* * If the path was surrounded by "" or is an absolute path, * then check the exact path provided. */ if (!found && (dot || *include == '/')) { if (stat(include, &st) == 0) { ip = newinclude(include, include); found = TRUE; } else if (show_where_not) warning1("\tnot in %s\n", include); } /* * If the path was surrounded by "" see if this include file is in the * directory of the file being parsed. */ if (!found && dot) { for (p = file + strlen(file); p > file; p--) if (*p == '/') break; if (p == file) strcpy(path, include); else { strncpy(path, file, (p - file) + 1); path[(p - file) + 1] = '\0'; strcpy(path + (p - file) + 1, include); } remove_dotdot(path); if (stat(path, &st) == 0) { ip = newinclude(path, include); found = TRUE; } else if (show_where_not) warning1("\tnot in %s\n", path); } /* * Check the include directories specified. (standard include dir * should be at the end.) */ if (!found) for (pp = includedirs; *pp; pp++) { sprintf(path, "%s/%s", *pp, include); remove_dotdot(path); if (stat(path, &st) == 0) { ip = newinclude(path, include); found = TRUE; break; } else if (show_where_not) warning1("\tnot in %s\n", path); } if (!found) ip = NULL; return (ip); }
int find_includes(struct filepointer *filep, struct inclist *file, struct inclist *file_red, int recursion, boolean failOK, struct IncludesCollection* incCollection, struct symhash *symbols) { char *line; int type; boolean recfailOK; while ((line = get_line(filep))) { switch(type = deftype(line, filep, file_red, file, TRUE, symbols)) { case IF: doif: type = find_includes(filep, file, file_red, recursion+1, failOK, incCollection, symbols); while ((type == ELIF) || (type == ELIFFALSE) || (type == ELIFGUESSFALSE)) type = gobble(filep, file, file_red, symbols); if (type == ELSE) gobble(filep, file, file_red, symbols); break; case IFFALSE: case IFGUESSFALSE: doiffalse: if (type == IFGUESSFALSE || type == ELIFGUESSFALSE) recfailOK = TRUE; else recfailOK = failOK; type = gobble(filep, file, file_red, symbols); if (type == ELSE) find_includes(filep, file, file_red, recursion+1, recfailOK, incCollection, symbols); else if (type == ELIF) goto doif; else if ((type == ELIFFALSE) || (type == ELIFGUESSFALSE)) goto doiffalse; break; case IFDEF: case IFNDEF: if ((type == IFDEF && hash_lookup(line, symbols)) || (type == IFNDEF && !hash_lookup(line, symbols))) { debug(1,(type == IFNDEF ? "line %d: %s !def'd in %s via %s%s\n" : "", filep->f_line, line, file->i_file, file_red->i_file, ": doit")); type = find_includes(filep, file, file_red, recursion+1, failOK, incCollection, symbols); while (type == ELIF || type == ELIFFALSE || type == ELIFGUESSFALSE) type = gobble(filep, file, file_red, symbols); if (type == ELSE) gobble(filep, file, file_red, symbols); } else { debug(1,(type == IFDEF ? "line %d: %s !def'd in %s via %s%s\n" : "", filep->f_line, line, file->i_file, file_red->i_file, ": gobble")); type = gobble(filep, file, file_red, symbols); if (type == ELSE) find_includes(filep, file, file_red, recursion + 1, failOK, incCollection, symbols); else if (type == ELIF) goto doif; else if (type == ELIFFALSE || type == ELIFGUESSFALSE) goto doiffalse; } break; case ELSE: case ELIFFALSE: case ELIFGUESSFALSE: case ELIF: if (!recursion) gobble(filep, file, file_red, symbols); /*fall-through*/ case ENDIF: if (recursion) return type; /*fall-through*/ case DEFINE: define(line, &symbols); break; case UNDEF: if (!*line) { warning("%s, line %d: incomplete undef == \"%s\"\n", file_red->i_file, filep->f_line, line); break; } hash_undefine(line, symbols); break; case INCLUDE: add_include(filep, file, file_red, line, FALSE, failOK, incCollection, symbols); break; case INCLUDEDOT: add_include(filep, file, file_red, line, TRUE, failOK, incCollection, symbols); break; case ERROR: warning("%s: %d: %s\n", file_red->i_file, filep->f_line, line); break; case PRAGMA: case IDENT: case SCCS: case EJECT: break; case -1: warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); warning1(", line %d: unknown directive == \"%s\"\n", filep->f_line, line); break; case -2: warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); warning1(", line %d: incomplete include == \"%s\"\n", filep->f_line, line); break; } } return -1; }
int main (int argc, char *argv[]) { int res; char **list, buffer[8192]; double t1; fastlist_t *fl; /* fast_catlist_t *cl; */ if (argc != 2) error1 ("usage: %s exclude-file\n", argv[0]); warning1 ("reading ruleset\n"); list = read_list (argv[1]); if (list == NULL) error1 ("failed to load pattern list from %s\n", argv[1]); fl = prepare_fastlist (list); /* printf ("shortest simple rule: %d\n", fl->shortest); for (i=0; i<fl->n_simple; i++) { printf ("%d %d %s\n", fl->rules[fl->simple[i]].type, fl->rules[fl->simple[i]].category, fl->rules[fl->simple[i]].rule); } */ /* for (i=0; i<fl->n; i++) { printf ("%d %d %s\n", fl->rules[i].type, fl->rules[i].category, fl->rules[i].rule); } */ /* for (i=0; i<fl->n_simple; i++) printf ("SIMPLE: %s\n", fl->simple[i]); */ /* for (i=0; i<fl->n_complex; i++) printf ("COMPLEX: %s\n", fl->complex[i]); */ /* cl = prepare_catlist (list); */ /* for (i=0; i<cl->n_simple; i++) printf ("SIMPLE: %d.%s\n", cl->simple[i].category, cl->simple[i].rule); for (i=0; i<cl->n_coll; i++) { printf ("COMPLEX: %d (%d rules)\n", cl->colls[i].coll_id, cl->colls[i].nrules); for (j=0; j<cl->colls[i].nrules; j++) { printf (" %s\n", cl->colls[i].rules[j]); } } */ /* printf ("slow:\n"); t1 = clock1 (); res = check_list (list, argv[2]); t1 = clock1 () - t1; if (res) printf ("%s is included (%.3f sec)\n", argv[2], t1); else printf ("%s is excluded (%.3f sec)\n", argv[2], t1); */ while ((fgets (buffer, sizeof(buffer), stdin) != NULL)) { str_strip (buffer, " \r\n"); if (normalize_url2 (buffer) < 0) { printf ("bad url: %s\n", buffer); continue; } t1 = clock1 (); res = check_fastlist (fl, buffer); t1 = clock1 () - t1; if (res) printf ("%s is included (%.3f sec)\n", buffer, t1); else printf ("%s is excluded (%.3f sec)\n", buffer, t1); } return 0; }
struct inclist * inc_path(char *file, char *include, int type) { static char path[ BUFSIZ ]; register char **pp, *p; register struct inclist *ip; struct stat st; /* * Check all previously found include files for a path that * has already been expanded. */ if ((type == INCLUDE) || (type == INCLUDEDOT)) inclistnext = inclist; ip = inclistnext; for (; ip->i_file; ip++) { if ((strcmp(ip->i_incstring, include) == 0) && !(ip->i_flags & INCLUDED_SYM)) { inclistnext = ip + 1; return ip; } } if (inclistnext == inclist) { /* * If the path was surrounded by "" or is an absolute path, * then check the exact path provided. */ if ((type == INCLUDEDOT) || (type == INCLUDENEXTDOT) || (*include == '/')) { if (stat(include, &st) == 0) return newinclude(include, include); if (show_where_not) warning1("\tnot in %s\n", include); } /* * If the path was surrounded by "" see if this include file is * in the directory of the file being parsed. */ if ((type == INCLUDEDOT) || (type == INCLUDENEXTDOT)) { for (p=file+strlen(file); p>file; p--) if (*p == '/') break; if (p == file) { strcpy(path, include); } else { strncpy(path, file, (p-file) + 1); path[ (p-file) + 1 ] = '\0'; strcpy(path + (p-file) + 1, include); } remove_dotdot(path); if (stat(path, &st) == 0) return newinclude(path, include); if (show_where_not) warning1("\tnot in %s\n", path); } } /* * Check the include directories specified. Standard include dirs * should be at the end. */ if ((type == INCLUDE) || (type == INCLUDEDOT)) includedirsnext = includedirs; pp = includedirsnext; for (; *pp; pp++) { sprintf(path, "%s/%s", *pp, include); remove_dotdot(path); if (stat(path, &st) == 0) { includedirsnext = pp + 1; return newinclude(path, include); } if (show_where_not) warning1("\tnot in %s\n", path); } return NULL; }
int find_includes (struct filepointer *filep, struct inclist *file, struct inclist *file_red, int recursion, bool failOK) { register char *line; register int type; bool recfailOK; while ((line = getline (filep))) { switch (type = deftype (line, filep, file_red, file, true)) { case IF: doif: type = find_includes (filep, file, file_red, recursion + 1, failOK); while ((type == ELIF) || (type == ELIFFALSE) || (type == ELIFGUESSFALSE)) type = gobble (filep, file, file_red); if (type == ELSE) gobble (filep, file, file_red); break; case IFFALSE: case IFGUESSFALSE: doiffalse: if (type == IFGUESSFALSE || type == ELIFGUESSFALSE) recfailOK = true; else recfailOK = failOK; type = gobble (filep, file, file_red); if (type == ELSE) find_includes (filep, file, file_red, recursion + 1, recfailOK); else if (type == ELIF) goto doif; else if ((type == ELIFFALSE) || (type == ELIFGUESSFALSE)) goto doiffalse; break; case IFDEF: case IFNDEF: if ((type == IFDEF && isdefined (line, file_red, NULL)) || (type == IFNDEF && !isdefined (line, file_red, NULL))) { debug (1, (type == IFNDEF ? "line %d: %s !def'd in %s via %s%s\n" : "", filep->f_line, line, file->i_file, file_red->i_file, ": doit")); type = find_includes (filep, file, file_red, recursion + 1, failOK); while (type == ELIF || type == ELIFFALSE || type == ELIFGUESSFALSE) type = gobble (filep, file, file_red); if (type == ELSE) gobble (filep, file, file_red); } else { debug (1, (type == IFDEF ? "line %d: %s !def'd in %s via %s%s\n" : "", filep->f_line, line, file->i_file, file_red->i_file, ": gobble")); type = gobble (filep, file, file_red); if (type == ELSE) find_includes (filep, file, file_red, recursion + 1, failOK); else if (type == ELIF) goto doif; else if (type == ELIFFALSE || type == ELIFGUESSFALSE) goto doiffalse; } break; case ELSE: case ELIFFALSE: case ELIFGUESSFALSE: case ELIF: if (!recursion) gobble (filep, file, file_red); case ENDIF: if (recursion) return (type); case DEFINE: define (line, file); break; case UNDEF: if (!*line) { warning ("%s, line %d: incomplete undef == \"%s\"\n", file->i_file, filep->f_line, line); display_included (file_red, file); break; } undefine (line, file_red); break; case INCLUDE: add_include (filep, file, file_red, line, false, failOK); break; case INCLUDEDOT: add_include (filep, file, file_red, line, true, failOK); break; case ERROR: case WARNING: warning ("%s: %d: %s\n", file->i_file, filep->f_line, line); display_included (file_red, file); break; case PRAGMA: case IDENT: case SCCS: case EJECT: break; case -1: warning ("%s", file_red->i_file); if (file_red != file) warning1 (" (reading %s)", file->i_file); warning1 (", line %d: unknown directive == \"%s\"\n", filep->f_line, line); break; case -2: warning ("%s", file_red->i_file); if (file_red != file) warning1 (" (reading %s)", file->i_file); warning1 (", line %d: incomplete include == \"%s\"\n", filep->f_line, line); break; } } file->i_flags |= FINISHED; return (-1); }
nmethod::nmethod(AbstractCompiler* c, bool generateDebugCode) { CHECK_VTBL_VALUE; _instsLen = roundTo(iLen, oopSize); _locsLen = ilLen; depsLen = dLen; // backpointer is just before deps depsAddr = (nmln*) ((char*)dAddr + sizeof(nmethod*)); *dBackLinkAddr() = this; // Copy the nmethodScopes scopeDescs generated by the ScopeDescRecorder // to the allocation area. c->scopeDescRecorder()->copyTo((VtblPtr_t*)sAddr, (int32)this); this->scopes = (nmethodScopes*) sAddr; oldCount = 0; flags.clear(); flags.isDebug = generateDebugCode; setCompiler(c->name()); flags.isUncommonRecompiled = currentProcess->isUncommon(); verifiedOffset = c->verifiedOffset(); diCheckOffset = c->diCheckOffset(); frameCreationOffset = c->frameCreationOffset(); rememberLink.init(); codeTableLink= NULL; diLink.init(c->diLink); if (diLink.notEmpty()) flags.isDI = true; flags.level = c->level(); if (flags.level >= MaxRecompilationLevels) { // added = zzzz warning1("setting invalid nmethod level %ld", flags.level); // fix this flags.level = 0; } flags.version = c->version(); if (c->nmName() == nm_nic && ((FCompiler*)c)->isImpure) makeImpureNIC(); key.set_from(c->L->key); check_store(); clear_frame_chain(); assert(c->frameSize() >= 0, "frame size cannot be negative"); frame_size = c->frameSize(); _incoming_arg_count = c->incoming_arg_count(); get_platform_specific_data(c); Assembler* instsA = c->instructions(); copy_bytes( instsA->instsStart, insts(), instsLen()); copy_words((int32*)instsA->locsStart, (int32*)locs(), ilLen/4); copy_words((int32*)depsStart, (int32*)deps(), depsLen/4); addrDesc *l, *lend; for (l = locs(), lend = locsEnd(); l < lend; l++) { l->initialShift(this, (char*)insts() - (char*)instsA->instsStart, 0); } char* bound = Memory->new_gen->boundary(); for (l = locs(), lend = locsEnd(); l < lend; l++) { if (l->isOop()) OopNCode::check_store(oop(l->referent(this)), bound); // cfront garbage else if (l->isSendDesc()) { l->asSendDesc(this)->dependency()->init(); } else if (l->isDIDesc()) { l->asDIDesc(this)->dependency()->init(); flags.isDI = true; } } for (nmln* d = deps(), *dend = depsEnd(); d < dend; d++) { d->relocate(); } MachineCache::flush_instruction_cache_range(insts(), instsEnd()); MachineCache::flush_instruction_cache_for_debugging(); if (this == (nmethod*)catchThisOne) warning("caught nmethod"); }