< prev index next >

src/share/vm/aot/aotCompiledMethod.cpp

Print this page




 135     bool klass_matched = true;
 136 
 137     ResourceMark rm; // for signature_name() and find_method()
 138     if (strncmp(k->signature_name(), klass_name, klass_len) != 0) { // Does not match?
 139       // Search klass in got cells in DSO which have this compiled method.
 140       k = _heap->get_klass_from_got(klass_name, klass_len, _method);
 141       klass_matched = false;
 142     }
 143     int method_name_len = build_u2_from((address)klass_name + klass_len);
 144     if (method_name_len == 0) { // Array or Klass name only?
 145       meta = ((intptr_t)k) | 1;
 146       *entry = (Metadata*)meta; // Should be atomic on x64
 147       return (Metadata*)k;
 148     } else { // Method
 149       // Quick check the current method's name.
 150       Method* m = _method;
 151       int signature_len = build_u2_from((address)klass_name + klass_len + 2 + method_name_len);
 152       int full_len = 2 + klass_len + 2 + method_name_len + 2 + signature_len;
 153       if (!klass_matched || memcmp(_name, meta_name, full_len) != 0) { // Does not match?
 154         Thread* thread = Thread::current();
 155         KlassHandle klass = KlassHandle(thread, k);
 156         const char* method_name = klass_name + klass_len;
 157         m = AOTCodeHeap::find_method(klass, thread, method_name);
 158       }
 159       meta = ((intptr_t)m) | 1;
 160       *entry = (Metadata*)meta; // Should be atomic on x64
 161       return (Metadata*)m;
 162     }
 163     // need to resolve it here..., patching of GOT need to be CAS or atomic operation.
 164     // FIXIT: need methods for debuginfo.
 165     // return _method;
 166   }
 167   ShouldNotReachHere(); return NULL;
 168 }
 169 
 170 bool AOTCompiledMethod::make_not_entrant_helper(int new_state) {
 171   // Make sure the method is not flushed in case of a safepoint in code below.
 172   methodHandle the_method(method());
 173   NoSafepointVerifier nsv;
 174 
 175   {
 176     // Enter critical section.  Does not block for safepoint.
 177     MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);


 234 
 235     // Change state
 236     OrderAccess::storestore();
 237     *_state_adr = in_use;
 238 
 239     // Log the transition once
 240     log_state_change();
 241   } // leave critical region under Patching_lock
 242 
 243 
 244   if (TraceCreateZombies) {
 245     ResourceMark m;
 246     tty->print_cr("aot method <" INTPTR_FORMAT "> %s code made entrant", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null");
 247   }
 248 
 249   return true;
 250 }
 251 
 252 // We don't have full dependencies for AOT methods, so flushing is
 253 // more conservative than for nmethods.
 254 void AOTCompiledMethod::flush_evol_dependents_on(instanceKlassHandle dependee) {
 255   if (is_java_method()) {
 256     cleanup_inline_caches();
 257     mark_for_deoptimization();
 258     make_not_entrant();
 259   }
 260 }
 261 
 262 // Iterate over metadata calling this function.   Used by RedefineClasses
 263 // Copied from nmethod::metadata_do
 264 void AOTCompiledMethod::metadata_do(void f(Metadata*)) {
 265   address low_boundary = verified_entry_point();
 266   {
 267     // Visit all immediate references that are embedded in the instruction stream.
 268     RelocIterator iter(this, low_boundary);
 269     while (iter.next()) {
 270       if (iter.type() == relocInfo::metadata_type ) {
 271         metadata_Relocation* r = iter.metadata_reloc();
 272         // In this metadata, we must only follow those metadatas directly embedded in
 273         // the code.  Other metadatas (oop_index>0) are seen as part of
 274         // the metadata section below.




 135     bool klass_matched = true;
 136 
 137     ResourceMark rm; // for signature_name() and find_method()
 138     if (strncmp(k->signature_name(), klass_name, klass_len) != 0) { // Does not match?
 139       // Search klass in got cells in DSO which have this compiled method.
 140       k = _heap->get_klass_from_got(klass_name, klass_len, _method);
 141       klass_matched = false;
 142     }
 143     int method_name_len = build_u2_from((address)klass_name + klass_len);
 144     if (method_name_len == 0) { // Array or Klass name only?
 145       meta = ((intptr_t)k) | 1;
 146       *entry = (Metadata*)meta; // Should be atomic on x64
 147       return (Metadata*)k;
 148     } else { // Method
 149       // Quick check the current method's name.
 150       Method* m = _method;
 151       int signature_len = build_u2_from((address)klass_name + klass_len + 2 + method_name_len);
 152       int full_len = 2 + klass_len + 2 + method_name_len + 2 + signature_len;
 153       if (!klass_matched || memcmp(_name, meta_name, full_len) != 0) { // Does not match?
 154         Thread* thread = Thread::current();

 155         const char* method_name = klass_name + klass_len;
 156         m = AOTCodeHeap::find_method(k, thread, method_name);
 157       }
 158       meta = ((intptr_t)m) | 1;
 159       *entry = (Metadata*)meta; // Should be atomic on x64
 160       return (Metadata*)m;
 161     }
 162     // need to resolve it here..., patching of GOT need to be CAS or atomic operation.
 163     // FIXIT: need methods for debuginfo.
 164     // return _method;
 165   }
 166   ShouldNotReachHere(); return NULL;
 167 }
 168 
 169 bool AOTCompiledMethod::make_not_entrant_helper(int new_state) {
 170   // Make sure the method is not flushed in case of a safepoint in code below.
 171   methodHandle the_method(method());
 172   NoSafepointVerifier nsv;
 173 
 174   {
 175     // Enter critical section.  Does not block for safepoint.
 176     MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);


 233 
 234     // Change state
 235     OrderAccess::storestore();
 236     *_state_adr = in_use;
 237 
 238     // Log the transition once
 239     log_state_change();
 240   } // leave critical region under Patching_lock
 241 
 242 
 243   if (TraceCreateZombies) {
 244     ResourceMark m;
 245     tty->print_cr("aot method <" INTPTR_FORMAT "> %s code made entrant", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null");
 246   }
 247 
 248   return true;
 249 }
 250 
 251 // We don't have full dependencies for AOT methods, so flushing is
 252 // more conservative than for nmethods.
 253 void AOTCompiledMethod::flush_evol_dependents_on(InstanceKlass* dependee) {
 254   if (is_java_method()) {
 255     cleanup_inline_caches();
 256     mark_for_deoptimization();
 257     make_not_entrant();
 258   }
 259 }
 260 
 261 // Iterate over metadata calling this function.   Used by RedefineClasses
 262 // Copied from nmethod::metadata_do
 263 void AOTCompiledMethod::metadata_do(void f(Metadata*)) {
 264   address low_boundary = verified_entry_point();
 265   {
 266     // Visit all immediate references that are embedded in the instruction stream.
 267     RelocIterator iter(this, low_boundary);
 268     while (iter.next()) {
 269       if (iter.type() == relocInfo::metadata_type ) {
 270         metadata_Relocation* r = iter.metadata_reloc();
 271         // In this metadata, we must only follow those metadatas directly embedded in
 272         // the code.  Other metadatas (oop_index>0) are seen as part of
 273         // the metadata section below.


< prev index next >