@@ -287,7 +287,7 @@ ClassPathZipEntry::~ClassPathZipEntry() {
287
287
288
288
u1* ClassPathZipEntry::open_entry (const char * name, jint* filesize, bool nul_terminate, TRAPS) {
289
289
// enable call to C land
290
- JavaThread* thread = JavaThread::current ();
290
+ JavaThread* thread = THREAD-> as_Java_thread ();
291
291
ThreadToNativeFromVM ttn (thread);
292
292
// check whether zip archive contains name
293
293
jint name_len;
@@ -501,7 +501,7 @@ void ClassLoader::trace_class_path(const char* msg, const char* name) {
501
501
}
502
502
}
503
503
504
- void ClassLoader::setup_bootstrap_search_path () {
504
+ void ClassLoader::setup_bootstrap_search_path (TRAPS ) {
505
505
const char * sys_class_path = Arguments::get_sysclasspath ();
506
506
assert (sys_class_path != NULL , " System boot class path must not be NULL" );
507
507
if (PrintSharedArchiveAndExit) {
@@ -510,19 +510,19 @@ void ClassLoader::setup_bootstrap_search_path() {
510
510
} else {
511
511
trace_class_path (" bootstrap loader class path=" , sys_class_path);
512
512
}
513
- setup_boot_search_path (sys_class_path);
513
+ setup_bootstrap_search_path_impl (sys_class_path, CHECK );
514
514
}
515
515
516
516
#if INCLUDE_CDS
517
- void ClassLoader::setup_app_search_path (const char *class_path) {
517
+ void ClassLoader::setup_app_search_path (const char *class_path, TRAPS ) {
518
518
Arguments::assert_is_dumping_archive ();
519
519
520
520
ResourceMark rm;
521
521
ClasspathStream cp_stream (class_path);
522
522
523
523
while (cp_stream.has_next ()) {
524
524
const char * path = cp_stream.get_next ();
525
- update_class_path_entry_list (path, false , false , false );
525
+ update_class_path_entry_list (path, false , false , false , CHECK );
526
526
}
527
527
}
528
528
@@ -542,7 +542,7 @@ void ClassLoader::add_to_module_path_entries(const char* path,
542
542
}
543
543
544
544
// Add a module path to the _module_path_entries list.
545
- void ClassLoader::update_module_path_entry_list (const char * path, TRAPS) {
545
+ void ClassLoader::setup_module_search_path (const char * path, TRAPS) {
546
546
Arguments::assert_is_dumping_archive ();
547
547
struct stat st;
548
548
if (os::stat (path, &st) != 0 ) {
@@ -562,10 +562,6 @@ void ClassLoader::update_module_path_entry_list(const char *path, TRAPS) {
562
562
return ;
563
563
}
564
564
565
- void ClassLoader::setup_module_search_path (const char * path, TRAPS) {
566
- update_module_path_entry_list (path, THREAD);
567
- }
568
-
569
565
#endif // INCLUDE_CDS
570
566
571
567
void ClassLoader::close_jrt_image () {
@@ -632,8 +628,7 @@ bool ClassLoader::is_in_patch_mod_entries(Symbol* module_name) {
632
628
}
633
629
634
630
// Set up the _jrt_entry if present and boot append path
635
- void ClassLoader::setup_boot_search_path (const char *class_path) {
636
- EXCEPTION_MARK;
631
+ void ClassLoader::setup_bootstrap_search_path_impl (const char *class_path, TRAPS) {
637
632
ResourceMark rm (THREAD);
638
633
ClasspathStream cp_stream (class_path);
639
634
bool set_base_piece = true ;
@@ -675,7 +670,7 @@ void ClassLoader::setup_boot_search_path(const char *class_path) {
675
670
} else {
676
671
// Every entry on the system boot class path after the initial base piece,
677
672
// which is set by os::set_boot_path(), is considered an appended entry.
678
- update_class_path_entry_list (path, false , true , false );
673
+ update_class_path_entry_list (path, false , true , false , CHECK );
679
674
}
680
675
}
681
676
}
@@ -722,7 +717,7 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
722
717
bool is_boot_append,
723
718
bool from_class_path_attr,
724
719
TRAPS) {
725
- JavaThread* thread = JavaThread::current ();
720
+ JavaThread* thread = THREAD-> as_Java_thread ();
726
721
ClassPathEntry* new_entry = NULL ;
727
722
if ((st->st_mode & S_IFMT) == S_IFREG) {
728
723
ResourceMark rm (thread);
@@ -847,7 +842,8 @@ void ClassLoader::add_to_boot_append_entries(ClassPathEntry *new_entry) {
847
842
// jdk/internal/loader/ClassLoaders$AppClassLoader instance.
848
843
void ClassLoader::add_to_app_classpath_entries (const char * path,
849
844
ClassPathEntry* entry,
850
- bool check_for_duplicates) {
845
+ bool check_for_duplicates,
846
+ TRAPS) {
851
847
#if INCLUDE_CDS
852
848
assert (entry != NULL , " ClassPathEntry should not be NULL" );
853
849
ClassPathEntry* e = _app_classpath_entries;
@@ -871,7 +867,7 @@ void ClassLoader::add_to_app_classpath_entries(const char* path,
871
867
}
872
868
873
869
if (entry->is_jar_file ()) {
874
- ClassLoaderExt::process_jar_manifest (entry, check_for_duplicates);
870
+ ClassLoaderExt::process_jar_manifest (entry, check_for_duplicates, CHECK );
875
871
}
876
872
#endif
877
873
}
@@ -881,13 +877,12 @@ bool ClassLoader::update_class_path_entry_list(const char *path,
881
877
bool check_for_duplicates,
882
878
bool is_boot_append,
883
879
bool from_class_path_attr,
884
- bool throw_exception ) {
880
+ TRAPS ) {
885
881
struct stat st;
886
882
if (os::stat (path, &st) == 0 ) {
887
883
// File or directory found
888
884
ClassPathEntry* new_entry = NULL ;
889
- Thread* THREAD = Thread::current ();
890
- new_entry = create_class_path_entry (path, &st, throw_exception, is_boot_append, from_class_path_attr, CHECK_ (false ));
885
+ new_entry = create_class_path_entry (path, &st, /* throw_exception=*/ true , is_boot_append, from_class_path_attr, CHECK_false);
891
886
if (new_entry == NULL ) {
892
887
return false ;
893
888
}
@@ -897,7 +892,7 @@ bool ClassLoader::update_class_path_entry_list(const char *path,
897
892
if (is_boot_append) {
898
893
add_to_boot_append_entries (new_entry);
899
894
} else {
900
- add_to_app_classpath_entries (path, new_entry, check_for_duplicates);
895
+ add_to_app_classpath_entries (path, new_entry, check_for_duplicates, CHECK_false );
901
896
}
902
897
return true ;
903
898
} else {
@@ -1286,7 +1281,7 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
1286
1281
return NULL ;
1287
1282
}
1288
1283
1289
- result->set_classpath_index (classpath_index, THREAD );
1284
+ result->set_classpath_index (classpath_index);
1290
1285
return result;
1291
1286
}
1292
1287
@@ -1421,7 +1416,7 @@ void ClassLoader::record_result(InstanceKlass* ik, const ClassFileStream* stream
1421
1416
ik->name ()->utf8_length ());
1422
1417
assert (file_name != NULL , " invariant" );
1423
1418
1424
- ClassLoaderExt::record_result (classpath_index, ik, THREAD );
1419
+ ClassLoaderExt::record_result (classpath_index, ik, CHECK );
1425
1420
}
1426
1421
#endif // INCLUDE_CDS
1427
1422
@@ -1430,9 +1425,7 @@ void ClassLoader::record_result(InstanceKlass* ik, const ClassFileStream* stream
1430
1425
// this list has been created, it must not change order (see class PackageInfo)
1431
1426
// it can be appended to and is by jvmti.
1432
1427
1433
- void ClassLoader::initialize () {
1434
- EXCEPTION_MARK;
1435
-
1428
+ void ClassLoader::initialize (TRAPS) {
1436
1429
if (UsePerfData) {
1437
1430
// jvmstat performance counters
1438
1431
NEWPERFTICKCOUNTER (_perf_accumulated_time, SUN_CLS, " time" );
@@ -1464,7 +1457,7 @@ void ClassLoader::initialize() {
1464
1457
// lookup java library entry points
1465
1458
load_java_library ();
1466
1459
// jimage library entry points are loaded below, in lookup_vm_options
1467
- setup_bootstrap_search_path ();
1460
+ setup_bootstrap_search_path (CHECK );
1468
1461
}
1469
1462
1470
1463
char * lookup_vm_resource (JImageFile *jimage, const char *jimage_version, const char *path) {
@@ -1501,16 +1494,16 @@ char* ClassLoader::lookup_vm_options() {
1501
1494
}
1502
1495
1503
1496
#if INCLUDE_CDS
1504
- void ClassLoader::initialize_shared_path () {
1497
+ void ClassLoader::initialize_shared_path (TRAPS ) {
1505
1498
if (Arguments::is_dumping_archive ()) {
1506
- ClassLoaderExt::setup_search_paths ();
1499
+ ClassLoaderExt::setup_search_paths (CHECK );
1507
1500
}
1508
1501
}
1509
1502
1510
1503
void ClassLoader::initialize_module_path (TRAPS) {
1511
1504
if (Arguments::is_dumping_archive ()) {
1512
- ClassLoaderExt::setup_module_paths (THREAD );
1513
- FileMapInfo::allocate_shared_path_table ();
1505
+ ClassLoaderExt::setup_module_paths (CHECK );
1506
+ FileMapInfo::allocate_shared_path_table (CHECK );
1514
1507
}
1515
1508
}
1516
1509
@@ -1566,7 +1559,11 @@ int ClassLoader::compute_Object_vtable() {
1566
1559
1567
1560
1568
1561
void classLoader_init1 () {
1569
- ClassLoader::initialize ();
1562
+ EXCEPTION_MARK;
1563
+ ClassLoader::initialize (THREAD);
1564
+ if (HAS_PENDING_EXCEPTION) {
1565
+ vm_exit_during_initialization (" ClassLoader::initialize() failed unexpectedly" );
1566
+ }
1570
1567
}
1571
1568
1572
1569
// Complete the ClassPathEntry setup for the boot loader
0 commit comments