691 assert(entry_at(offset) == e, "sanity");
692 }
693
694 for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
695 const int cpci = invokedynamic_references_map.at(ref);
696 if (cpci >= 0) {
697 entry_at(cpci)->initialize_resolved_reference_index(ref);
698 }
699 }
700 }
701
702 void ConstantPoolCache::verify_just_initialized() {
703 DEBUG_ONLY(walk_entries_for_initialization(/*check_only = */ true));
704 }
705
706 void ConstantPoolCache::remove_unshareable_info() {
707 walk_entries_for_initialization(/*check_only = */ false);
708 }
709
710 void ConstantPoolCache::walk_entries_for_initialization(bool check_only) {
711 assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "sanity");
712 // When dumping the archive, we want to clean up the ConstantPoolCache
713 // to remove any effect of linking due to the execution of Java code --
714 // each ConstantPoolCacheEntry will have the same contents as if
715 // ConstantPoolCache::initialize has just returned:
716 //
717 // - We keep the ConstantPoolCache::constant_pool_index() bits for all entries.
718 // - We keep the "f2" field for entries used by invokedynamic and invokehandle
719 // - All other bits in the entries are cleared to zero.
720 ResourceMark rm;
721
722 InstanceKlass* ik = constant_pool()->pool_holder();
723 bool* f2_used = NEW_RESOURCE_ARRAY(bool, length());
724 memset(f2_used, 0, sizeof(bool) * length());
725
726 // Find all the slots that we need to preserve f2
727 for (int i = 0; i < ik->methods()->length(); i++) {
728 Method* m = ik->methods()->at(i);
729 RawBytecodeStream bcs(m);
730 while (!bcs.is_last_bytecode()) {
731 Bytecodes::Code opcode = bcs.raw_next();
|
691 assert(entry_at(offset) == e, "sanity");
692 }
693
694 for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
695 const int cpci = invokedynamic_references_map.at(ref);
696 if (cpci >= 0) {
697 entry_at(cpci)->initialize_resolved_reference_index(ref);
698 }
699 }
700 }
701
702 void ConstantPoolCache::verify_just_initialized() {
703 DEBUG_ONLY(walk_entries_for_initialization(/*check_only = */ true));
704 }
705
706 void ConstantPoolCache::remove_unshareable_info() {
707 walk_entries_for_initialization(/*check_only = */ false);
708 }
709
710 void ConstantPoolCache::walk_entries_for_initialization(bool check_only) {
711 Arguments::assert_is_dumping_archive();
712 // When dumping the archive, we want to clean up the ConstantPoolCache
713 // to remove any effect of linking due to the execution of Java code --
714 // each ConstantPoolCacheEntry will have the same contents as if
715 // ConstantPoolCache::initialize has just returned:
716 //
717 // - We keep the ConstantPoolCache::constant_pool_index() bits for all entries.
718 // - We keep the "f2" field for entries used by invokedynamic and invokehandle
719 // - All other bits in the entries are cleared to zero.
720 ResourceMark rm;
721
722 InstanceKlass* ik = constant_pool()->pool_holder();
723 bool* f2_used = NEW_RESOURCE_ARRAY(bool, length());
724 memset(f2_used, 0, sizeof(bool) * length());
725
726 // Find all the slots that we need to preserve f2
727 for (int i = 0; i < ik->methods()->length(); i++) {
728 Method* m = ik->methods()->at(i);
729 RawBytecodeStream bcs(m);
730 while (!bcs.is_last_bytecode()) {
731 Bytecodes::Code opcode = bcs.raw_next();
|