Mercurial > hg > truffle
comparison src/share/vm/classfile/classLoader.cpp @ 4559:723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Use the --vm option instead of a special -vm option in the bench command
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 10 Feb 2012 17:04:03 +0100 |
parents | 04b9a2566eec |
children | 532be189cf09 |
comparison
equal
deleted
inserted
replaced
4558:3706975946e4 | 4559:723df37192d6 |
---|---|
182 } | 182 } |
183 | 183 |
184 | 184 |
185 ClassPathEntry::ClassPathEntry() { | 185 ClassPathEntry::ClassPathEntry() { |
186 set_next(NULL); | 186 set_next(NULL); |
187 _compiler_thread_only = false; | |
188 } | 187 } |
189 | 188 |
190 | 189 |
191 bool ClassPathEntry::is_lazy() { | 190 bool ClassPathEntry::is_lazy() { |
192 return false; | 191 return false; |
441 } | 440 } |
442 | 441 |
443 void ClassLoader::setup_bootstrap_search_path() { | 442 void ClassLoader::setup_bootstrap_search_path() { |
444 assert(_first_entry == NULL, "should not setup bootstrap class search path twice"); | 443 assert(_first_entry == NULL, "should not setup bootstrap class search path twice"); |
445 char* sys_class_path = os::strdup(Arguments::get_sysclasspath()); | 444 char* sys_class_path = os::strdup(Arguments::get_sysclasspath()); |
445 #ifdef GRAAL | |
446 char* compiler_class_path = os::strdup(Arguments::get_compilerclasspath()); | 446 char* compiler_class_path = os::strdup(Arguments::get_compilerclasspath()); |
447 #endif | |
447 if (TraceClassLoading && Verbose) { | 448 if (TraceClassLoading && Verbose) { |
448 tty->print_cr("[Bootstrap loader class path=%s]", sys_class_path); | 449 tty->print_cr("[Bootstrap loader class path=%s]", sys_class_path); |
450 #ifdef GRAAL | |
449 tty->print_cr("[Compiler loader class path=%s]", compiler_class_path); | 451 tty->print_cr("[Compiler loader class path=%s]", compiler_class_path); |
450 } | 452 #endif |
451 | 453 } |
452 setup_bootstrap_search_path(sys_class_path, false); | 454 |
453 setup_bootstrap_search_path(compiler_class_path, true); | 455 setup_bootstrap_search_path(sys_class_path); |
454 } | 456 #ifdef GRAAL |
455 | 457 setup_bootstrap_search_path(compiler_class_path); |
456 void ClassLoader::setup_bootstrap_search_path(char* sys_class_path, bool compiler_cp) { | 458 #endif |
459 } | |
460 | |
461 void ClassLoader::setup_bootstrap_search_path(char* sys_class_path) { | |
457 int len = (int)strlen(sys_class_path); | 462 int len = (int)strlen(sys_class_path); |
458 int end = 0; | 463 int end = 0; |
459 | 464 |
460 // Iterate over class path entries | 465 // Iterate over class path entries |
461 for (int start = 0; start < len; start = end) { | 466 for (int start = 0; start < len; start = end) { |
463 end++; | 468 end++; |
464 } | 469 } |
465 char* path = NEW_C_HEAP_ARRAY(char, end-start+1); | 470 char* path = NEW_C_HEAP_ARRAY(char, end-start+1); |
466 strncpy(path, &sys_class_path[start], end-start); | 471 strncpy(path, &sys_class_path[start], end-start); |
467 path[end-start] = '\0'; | 472 path[end-start] = '\0'; |
468 update_class_path_entry_list(path, false, compiler_cp); | 473 update_class_path_entry_list(path, false); |
469 FREE_C_HEAP_ARRAY(char, path); | 474 FREE_C_HEAP_ARRAY(char, path); |
470 while (sys_class_path[end] == os::path_separator()[0]) { | 475 while (sys_class_path[end] == os::path_separator()[0]) { |
471 end++; | 476 end++; |
472 } | 477 } |
473 } | 478 } |
559 // returns true if entry already on class path | 564 // returns true if entry already on class path |
560 bool ClassLoader::contains_entry(ClassPathEntry *entry) { | 565 bool ClassLoader::contains_entry(ClassPathEntry *entry) { |
561 ClassPathEntry* e = _first_entry; | 566 ClassPathEntry* e = _first_entry; |
562 while (e != NULL) { | 567 while (e != NULL) { |
563 // assume zip entries have been canonicalized | 568 // assume zip entries have been canonicalized |
564 if (e->compiler_thread_only() == entry->compiler_thread_only() && strcmp(entry->name(), e->name()) == 0) { | 569 if (strcmp(entry->name(), e->name()) == 0) { |
565 return true; | 570 return true; |
566 } | 571 } |
567 e = e->next(); | 572 e = e->next(); |
568 } | 573 } |
569 return false; | 574 return false; |
579 } | 584 } |
580 } | 585 } |
581 } | 586 } |
582 | 587 |
583 void ClassLoader::update_class_path_entry_list(const char *path, | 588 void ClassLoader::update_class_path_entry_list(const char *path, |
584 bool check_for_duplicates, | 589 bool check_for_duplicates) { |
585 bool compiler_cp) { | |
586 struct stat st; | 590 struct stat st; |
587 if (os::stat((char *)path, &st) == 0) { | 591 if (os::stat((char *)path, &st) == 0) { |
588 // File or directory found | 592 // File or directory found |
589 ClassPathEntry* new_entry = NULL; | 593 ClassPathEntry* new_entry = NULL; |
590 create_class_path_entry((char *)path, st, &new_entry, LazyBootClassLoader); | 594 create_class_path_entry((char *)path, st, &new_entry, LazyBootClassLoader); |
591 //new_entry->set_compiler_thread_only(compiler_cp); | |
592 // The kernel VM adds dynamically to the end of the classloader path and | 595 // The kernel VM adds dynamically to the end of the classloader path and |
593 // doesn't reorder the bootclasspath which would break java.lang.Package | 596 // doesn't reorder the bootclasspath which would break java.lang.Package |
594 // (see PackageInfo). | 597 // (see PackageInfo). |
595 // Add new entry to linked list | 598 // Add new entry to linked list |
596 if (!check_for_duplicates || !contains_entry(new_entry)) { | 599 if (!check_for_duplicates || !contains_entry(new_entry)) { |
903 PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(), | 906 PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(), |
904 ((JavaThread*) THREAD)->get_thread_stat()->perf_timers_addr(), | 907 ((JavaThread*) THREAD)->get_thread_stat()->perf_timers_addr(), |
905 PerfClassTraceTime::CLASS_LOAD); | 908 PerfClassTraceTime::CLASS_LOAD); |
906 ClassPathEntry* e = _first_entry; | 909 ClassPathEntry* e = _first_entry; |
907 while (e != NULL) { | 910 while (e != NULL) { |
908 if (THREAD->is_Compiler_thread() || !Universe::_fully_initialized || !e->compiler_thread_only()) { | 911 stream = e->open_stream(name); |
909 stream = e->open_stream(name); | |
910 } | |
911 if (stream != NULL) { | 912 if (stream != NULL) { |
912 break; | 913 break; |
913 } | 914 } |
914 e = e->next(); | 915 e = e->next(); |
915 ++classpath_index; | 916 ++classpath_index; |