src/hotspot/share/aot/aotCompiledMethod.cpp
changeset 54150 5529640c5f67
parent 53641 c572eb605087
child 54623 1126f0607c70
equal deleted inserted replaced
54149:c61f09122d3b 54150:5529640c5f67
   244 }
   244 }
   245 #endif // TIERED
   245 #endif // TIERED
   246 
   246 
   247 // Iterate over metadata calling this function.   Used by RedefineClasses
   247 // Iterate over metadata calling this function.   Used by RedefineClasses
   248 // Copied from nmethod::metadata_do
   248 // Copied from nmethod::metadata_do
   249 void AOTCompiledMethod::metadata_do(void f(Metadata*)) {
   249 void AOTCompiledMethod::metadata_do(MetadataClosure* f) {
   250   address low_boundary = verified_entry_point();
   250   address low_boundary = verified_entry_point();
   251   {
   251   {
   252     // Visit all immediate references that are embedded in the instruction stream.
   252     // Visit all immediate references that are embedded in the instruction stream.
   253     RelocIterator iter(this, low_boundary);
   253     RelocIterator iter(this, low_boundary);
   254     while (iter.next()) {
   254     while (iter.next()) {
   260         assert(1 == (r->metadata_is_immediate()) +
   260         assert(1 == (r->metadata_is_immediate()) +
   261                (r->metadata_addr() >= metadata_begin() && r->metadata_addr() < metadata_end()),
   261                (r->metadata_addr() >= metadata_begin() && r->metadata_addr() < metadata_end()),
   262                "metadata must be found in exactly one place");
   262                "metadata must be found in exactly one place");
   263         if (r->metadata_is_immediate() && r->metadata_value() != NULL) {
   263         if (r->metadata_is_immediate() && r->metadata_value() != NULL) {
   264           Metadata* md = r->metadata_value();
   264           Metadata* md = r->metadata_value();
   265           if (md != _method) f(md);
   265           if (md != _method) f->do_metadata(md);
   266         }
   266         }
   267       } else if (iter.type() == relocInfo::virtual_call_type) {
   267       } else if (iter.type() == relocInfo::virtual_call_type) {
   268         ResourceMark rm;
   268         ResourceMark rm;
   269         // Check compiledIC holders associated with this nmethod
   269         // Check compiledIC holders associated with this nmethod
   270         CompiledIC *ic = CompiledIC_at(&iter);
   270         CompiledIC *ic = CompiledIC_at(&iter);
   271         if (ic->is_icholder_call()) {
   271         if (ic->is_icholder_call()) {
   272           CompiledICHolder* cichk = ic->cached_icholder();
   272           CompiledICHolder* cichk = ic->cached_icholder();
   273           f(cichk->holder_metadata());
   273           f->do_metadata(cichk->holder_metadata());
   274           f(cichk->holder_klass());
   274           f->do_metadata(cichk->holder_klass());
   275         } else {
   275         } else {
   276           // Get Klass* or NULL (if value is -1) from GOT cell of virtual call PLT stub.
   276           // Get Klass* or NULL (if value is -1) from GOT cell of virtual call PLT stub.
   277           Metadata* ic_oop = ic->cached_metadata();
   277           Metadata* ic_oop = ic->cached_metadata();
   278           if (ic_oop != NULL) {
   278           if (ic_oop != NULL) {
   279             f(ic_oop);
   279             f->do_metadata(ic_oop);
   280           }
   280           }
   281         }
   281         }
   282       } else if (iter.type() == relocInfo::static_call_type ||
   282       } else if (iter.type() == relocInfo::static_call_type ||
   283                  iter.type() == relocInfo::opt_virtual_call_type){
   283                  iter.type() == relocInfo::opt_virtual_call_type){
   284         // Check Method* in AOT c2i stub for other calls.
   284         // Check Method* in AOT c2i stub for other calls.
   285         Metadata* meta = (Metadata*)nativeLoadGot_at(nativePltCall_at(iter.addr())->plt_c2i_stub())->data();
   285         Metadata* meta = (Metadata*)nativeLoadGot_at(nativePltCall_at(iter.addr())->plt_c2i_stub())->data();
   286         if (meta != NULL) {
   286         if (meta != NULL) {
   287           f(meta);
   287           f->do_metadata(meta);
   288         }
   288         }
   289       }
   289       }
   290     }
   290     }
   291   }
   291   }
   292 
   292 
   300       m = (Metadata*)(meta & ~1);
   300       m = (Metadata*)(meta & ~1);
   301     } else {
   301     } else {
   302       continue;
   302       continue;
   303     }
   303     }
   304     assert(Metaspace::contains(m), "");
   304     assert(Metaspace::contains(m), "");
   305     f(m);
   305     f->do_metadata(m);
   306   }
   306   }
   307 
   307 
   308   // Visit metadata not embedded in the other places.
   308   // Visit metadata not embedded in the other places.
   309   if (_method != NULL) f(_method);
   309   if (_method != NULL) f->do_metadata(_method);
   310 }
   310 }
   311 
   311 
   312 void AOTCompiledMethod::print() const {
   312 void AOTCompiledMethod::print() const {
   313   print_on(tty, "AOTCompiledMethod");
   313   print_on(tty, "AOTCompiledMethod");
   314 }
   314 }