73
73
#include " utilities/resourceHash.hpp"
74
74
#include " utilities/stringUtils.hpp"
75
75
76
+ SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_static_archive;
77
+ SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_dynamic_archive;
78
+
76
79
DumpTimeSharedClassTable* SystemDictionaryShared::_dumptime_table = NULL ;
77
80
DumpTimeSharedClassTable* SystemDictionaryShared::_cloned_dumptime_table = NULL ;
78
81
DumpTimeLambdaProxyClassDictionary* SystemDictionaryShared::_dumptime_lambda_proxy_class_dictionary = NULL ;
79
82
DumpTimeLambdaProxyClassDictionary* SystemDictionaryShared::_cloned_dumptime_lambda_proxy_class_dictionary = NULL ;
80
- // SystemDictionaries in the base layer static archive
81
- RunTimeSharedDictionary SystemDictionaryShared::_builtin_dictionary;
82
- RunTimeSharedDictionary SystemDictionaryShared::_unregistered_dictionary;
83
- // SystemDictionaries in the top layer dynamic archive
84
- RunTimeSharedDictionary SystemDictionaryShared::_dynamic_builtin_dictionary;
85
- RunTimeSharedDictionary SystemDictionaryShared::_dynamic_unregistered_dictionary;
86
-
87
- LambdaProxyClassDictionary SystemDictionaryShared::_lambda_proxy_class_dictionary;
88
- LambdaProxyClassDictionary SystemDictionaryShared::_dynamic_lambda_proxy_class_dictionary;
89
83
90
84
DEBUG_ONLY (bool SystemDictionaryShared::_no_class_loading_should_happen = false ;)
91
85
bool SystemDictionaryShared::_dump_in_progress = false;
@@ -127,7 +121,9 @@ InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name,
127
121
return NULL ;
128
122
}
129
123
130
- const RunTimeClassInfo* record = find_record (&_unregistered_dictionary, &_dynamic_unregistered_dictionary, class_name);
124
+ const RunTimeClassInfo* record = find_record (&_static_archive._unregistered_dictionary ,
125
+ &_dynamic_archive._unregistered_dictionary ,
126
+ class_name);
131
127
if (record == NULL ) {
132
128
return NULL ;
133
129
}
@@ -843,10 +839,9 @@ InstanceKlass* SystemDictionaryShared::get_shared_lambda_proxy_class(InstanceKla
843
839
MutexLocker ml (CDSLambda_lock, Mutex::_no_safepoint_check_flag);
844
840
LambdaProxyClassKey key (caller_ik, invoked_name, invoked_type,
845
841
method_type, member_method, instantiated_method_type);
846
- const RunTimeLambdaProxyClassInfo* info = _lambda_proxy_class_dictionary. lookup (&key, key. hash (), 0 );
842
+ const RunTimeLambdaProxyClassInfo* info = _static_archive. lookup_lambda_proxy_class (&key);
847
843
if (info == NULL ) {
848
- // Try lookup from the dynamic lambda proxy class dictionary.
849
- info = _dynamic_lambda_proxy_class_dictionary.lookup (&key, key.hash (), 0 );
844
+ info = _dynamic_archive.lookup_lambda_proxy_class (&key);
850
845
}
851
846
InstanceKlass* proxy_klass = NULL ;
852
847
if (info != NULL ) {
@@ -1303,15 +1298,14 @@ void SystemDictionaryShared::write_dictionary(RunTimeSharedDictionary* dictionar
1303
1298
}
1304
1299
1305
1300
void SystemDictionaryShared::write_to_archive (bool is_static_archive) {
1306
- if (is_static_archive) {
1307
- write_dictionary (&_builtin_dictionary, true );
1308
- write_dictionary (&_unregistered_dictionary, false );
1309
- } else {
1310
- write_dictionary (&_dynamic_builtin_dictionary, true );
1311
- write_dictionary (&_dynamic_unregistered_dictionary, false );
1301
+ ArchiveInfo* archive = get_archive (is_static_archive);
1302
+
1303
+ if (_dumptime_table != NULL ) {
1304
+ write_dictionary (&archive->_builtin_dictionary , true );
1305
+ write_dictionary (&archive->_unregistered_dictionary , false );
1312
1306
}
1313
1307
if (_dumptime_lambda_proxy_class_dictionary != NULL ) {
1314
- write_lambda_proxy_class_dictionary (&_lambda_proxy_class_dictionary);
1308
+ write_lambda_proxy_class_dictionary (&archive-> _lambda_proxy_class_dictionary );
1315
1309
}
1316
1310
}
1317
1311
@@ -1324,22 +1318,11 @@ void SystemDictionaryShared::adjust_lambda_proxy_class_dictionary() {
1324
1318
1325
1319
void SystemDictionaryShared::serialize_dictionary_headers (SerializeClosure* soc,
1326
1320
bool is_static_archive) {
1327
- FileMapInfo *dynamic_mapinfo = FileMapInfo::dynamic_info ();
1328
- if (is_static_archive) {
1329
- _builtin_dictionary.serialize_header (soc);
1330
- _unregistered_dictionary.serialize_header (soc);
1331
- if (dynamic_mapinfo == NULL || DynamicDumpSharedSpaces || (dynamic_mapinfo != NULL && UseSharedSpaces)) {
1332
- _lambda_proxy_class_dictionary.serialize_header (soc);
1333
- }
1334
- } else {
1335
- _dynamic_builtin_dictionary.serialize_header (soc);
1336
- _dynamic_unregistered_dictionary.serialize_header (soc);
1337
- if (DynamicDumpSharedSpaces) {
1338
- _lambda_proxy_class_dictionary.serialize_header (soc);
1339
- } else {
1340
- _dynamic_lambda_proxy_class_dictionary.serialize_header (soc);
1341
- }
1342
- }
1321
+ ArchiveInfo* archive = get_archive (is_static_archive);
1322
+
1323
+ archive->_builtin_dictionary .serialize_header (soc);
1324
+ archive->_unregistered_dictionary .serialize_header (soc);
1325
+ archive->_lambda_proxy_class_dictionary .serialize_header (soc);
1343
1326
}
1344
1327
1345
1328
void SystemDictionaryShared::serialize_vm_classes (SerializeClosure* soc) {
@@ -1384,7 +1367,9 @@ SystemDictionaryShared::find_record(RunTimeSharedDictionary* static_dict, RunTim
1384
1367
}
1385
1368
1386
1369
InstanceKlass* SystemDictionaryShared::find_builtin_class (Symbol* name) {
1387
- const RunTimeClassInfo* record = find_record (&_builtin_dictionary, &_dynamic_builtin_dictionary, name);
1370
+ const RunTimeClassInfo* record = find_record (&_static_archive._builtin_dictionary ,
1371
+ &_dynamic_archive._builtin_dictionary ,
1372
+ name);
1388
1373
if (record != NULL ) {
1389
1374
assert (!record->_klass ->is_hidden (), " hidden class cannot be looked up by name" );
1390
1375
assert (check_alignment (record->_klass ), " Address not aligned" );
@@ -1456,56 +1441,51 @@ class SharedLambdaDictionaryPrinter : StackObj {
1456
1441
}
1457
1442
};
1458
1443
1459
- void SystemDictionaryShared::print_on (const char * prefix,
1460
- RunTimeSharedDictionary* builtin_dictionary,
1461
- RunTimeSharedDictionary* unregistered_dictionary,
1462
- LambdaProxyClassDictionary* lambda_dictionary,
1463
- outputStream* st) {
1444
+ void SystemDictionaryShared::ArchiveInfo::print_on (const char * prefix,
1445
+ outputStream* st) {
1464
1446
st->print_cr (" %sShared Dictionary" , prefix);
1465
1447
SharedDictionaryPrinter p (st);
1466
1448
st->print_cr (" %sShared Builtin Dictionary" , prefix);
1467
- builtin_dictionary-> iterate(&p);
1449
+ _builtin_dictionary. iterate(&p);
1468
1450
st->print_cr (" %sShared Unregistered Dictionary" , prefix);
1469
- unregistered_dictionary-> iterate(&p);
1470
- if (!lambda_dictionary-> empty ()) {
1451
+ _unregistered_dictionary. iterate(&p);
1452
+ if (!_lambda_proxy_class_dictionary. empty ()) {
1471
1453
st->print_cr (" %sShared Lambda Dictionary" , prefix);
1472
1454
SharedLambdaDictionaryPrinter ldp (st, p.index ());
1473
- lambda_dictionary-> iterate(&ldp);
1455
+ _lambda_proxy_class_dictionary. iterate(&ldp);
1474
1456
}
1475
1457
}
1476
1458
1459
+ void SystemDictionaryShared::ArchiveInfo::print_table_statistics (const char * prefix,
1460
+ outputStream* st) {
1461
+ st->print_cr (" %sArchve Statistics" , prefix);
1462
+ _builtin_dictionary.print_table_statistics (st, " Builtin Shared Dictionary" );
1463
+ _unregistered_dictionary.print_table_statistics (st, " Unregistered Shared Dictionary" );
1464
+ _lambda_proxy_class_dictionary.print_table_statistics (st, " Lambda Shared Dictionary" );
1465
+ }
1466
+
1477
1467
void SystemDictionaryShared::print_shared_archive (outputStream* st, bool is_static) {
1478
1468
if (UseSharedSpaces) {
1479
1469
if (is_static) {
1480
- print_on (" " , &_builtin_dictionary, &_unregistered_dictionary, &_lambda_proxy_class_dictionary , st);
1470
+ _static_archive. print_on (" " , st);
1481
1471
} else {
1482
1472
if (DynamicArchive::is_mapped ()) {
1483
- print_on (" " , &_dynamic_builtin_dictionary, &_dynamic_unregistered_dictionary,
1484
- &_dynamic_lambda_proxy_class_dictionary, st);
1473
+ _dynamic_archive.print_on (" Dynamic " , st);
1485
1474
}
1486
1475
}
1487
1476
}
1488
1477
}
1489
1478
1490
1479
void SystemDictionaryShared::print_on (outputStream* st) {
1491
- if (UseSharedSpaces) {
1492
- print_on (" " , &_builtin_dictionary, &_unregistered_dictionary, &_lambda_proxy_class_dictionary, st);
1493
- if (DynamicArchive::is_mapped ()) {
1494
- print_on (" " , &_dynamic_builtin_dictionary, &_dynamic_unregistered_dictionary,
1495
- &_dynamic_lambda_proxy_class_dictionary, st);
1496
- }
1497
- }
1480
+ print_shared_archive (st, true );
1481
+ print_shared_archive (st, false );
1498
1482
}
1499
1483
1500
1484
void SystemDictionaryShared::print_table_statistics (outputStream* st) {
1501
1485
if (UseSharedSpaces) {
1502
- _builtin_dictionary.print_table_statistics (st, " Builtin Shared Dictionary" );
1503
- _unregistered_dictionary.print_table_statistics (st, " Unregistered Shared Dictionary" );
1504
- _lambda_proxy_class_dictionary.print_table_statistics (st, " Lambda Shared Dictionary" );
1486
+ _static_archive.print_table_statistics (" Static " , st);
1505
1487
if (DynamicArchive::is_mapped ()) {
1506
- _dynamic_builtin_dictionary.print_table_statistics (st, " Dynamic Builtin Shared Dictionary" );
1507
- _dynamic_unregistered_dictionary.print_table_statistics (st, " Unregistered Shared Dictionary" );
1508
- _dynamic_lambda_proxy_class_dictionary.print_table_statistics (st, " Dynamic Lambda Shared Dictionary" );
1488
+ _dynamic_archive.print_table_statistics (" Dynamic " , st);
1509
1489
}
1510
1490
}
1511
1491
}
@@ -1680,9 +1660,10 @@ void SystemDictionaryShared::update_archived_mirror_native_pointers() {
1680
1660
if (MetaspaceShared::relocation_delta () == 0 ) {
1681
1661
return ;
1682
1662
}
1683
- update_archived_mirror_native_pointers_for (&_builtin_dictionary);
1684
- update_archived_mirror_native_pointers_for (&_unregistered_dictionary);
1685
- update_archived_mirror_native_pointers_for (&_lambda_proxy_class_dictionary);
1663
+ // mirrors are not archived for the classes in the dynamic archive
1664
+ update_archived_mirror_native_pointers_for (&_static_archive._builtin_dictionary );
1665
+ update_archived_mirror_native_pointers_for (&_static_archive._unregistered_dictionary );
1666
+ update_archived_mirror_native_pointers_for (&_static_archive._lambda_proxy_class_dictionary );
1686
1667
1687
1668
for (int t = T_BOOLEAN; t <= T_LONG; t++) {
1688
1669
Klass* k = Universe::typeArrayKlassObj ((BasicType)t);
0 commit comments