hotspot/src/share/vm/oops/method.cpp
changeset 46727 6e4a84748e2c
parent 46630 75aa3e39d02c
child 46746 ea379ebb9447
equal deleted inserted replaced
46726:7801367e3cc9 46727:6e4a84748e2c
   173   }
   173   }
   174 
   174 
   175   return buf;
   175   return buf;
   176 }
   176 }
   177 
   177 
   178 int Method::fast_exception_handler_bci_for(methodHandle mh, Klass* ex_klass, int throw_bci, TRAPS) {
   178 int Method::fast_exception_handler_bci_for(const methodHandle& mh, Klass* ex_klass, int throw_bci, TRAPS) {
   179   // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
   179   // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
   180   // access exception table
   180   // access exception table
   181   ExceptionTable table(mh());
   181   ExceptionTable table(mh());
   182   int length = table.length();
   182   int length = table.length();
   183   // iterate through all entries sequentially
   183   // iterate through all entries sequentially
  1076 
  1076 
  1077   // ONLY USE the h_method now as make_adapter may have blocked
  1077   // ONLY USE the h_method now as make_adapter may have blocked
  1078 
  1078 
  1079 }
  1079 }
  1080 
  1080 
  1081 address Method::make_adapters(methodHandle mh, TRAPS) {
  1081 address Method::make_adapters(const methodHandle& mh, TRAPS) {
  1082   // Adapters for compiled code are made eagerly here.  They are fairly
  1082   // Adapters for compiled code are made eagerly here.  They are fairly
  1083   // small (generally < 100 bytes) and quick to make (and cached and shared)
  1083   // small (generally < 100 bytes) and quick to make (and cached and shared)
  1084   // so making them eagerly shouldn't be too expensive.
  1084   // so making them eagerly shouldn't be too expensive.
  1085   AdapterHandlerEntry* adapter = AdapterHandlerLibrary::get_adapter(mh);
  1085   AdapterHandlerEntry* adapter = AdapterHandlerLibrary::get_adapter(mh);
  1086   if (adapter == NULL ) {
  1086   if (adapter == NULL ) {
  1145   CompiledMethod *code = (CompiledMethod *)OrderAccess::load_ptr_acquire(&_code);
  1145   CompiledMethod *code = (CompiledMethod *)OrderAccess::load_ptr_acquire(&_code);
  1146   return code == NULL || (code->method() == NULL) || (code->method() == (Method*)this && !code->is_osr_method());
  1146   return code == NULL || (code->method() == NULL) || (code->method() == (Method*)this && !code->is_osr_method());
  1147 }
  1147 }
  1148 
  1148 
  1149 // Install compiled code.  Instantly it can execute.
  1149 // Install compiled code.  Instantly it can execute.
  1150 void Method::set_code(methodHandle mh, CompiledMethod *code) {
  1150 void Method::set_code(const methodHandle& mh, CompiledMethod *code) {
  1151   MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
  1151   MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
  1152   assert( code, "use clear_code to remove code" );
  1152   assert( code, "use clear_code to remove code" );
  1153   assert( mh->check_code(), "" );
  1153   assert( mh->check_code(), "" );
  1154 
  1154 
  1155   guarantee(mh->adapter() != NULL, "Adapter blob must already exist!");
  1155   guarantee(mh->adapter() != NULL, "Adapter blob must already exist!");
  1348   }
  1348   }
  1349   return NULL;
  1349   return NULL;
  1350 }
  1350 }
  1351 
  1351 
  1352 
  1352 
  1353 methodHandle Method::clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length,
  1353 methodHandle Method::clone_with_new_data(const methodHandle& m, u_char* new_code, int new_code_length,
  1354                                                 u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS) {
  1354                                                 u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS) {
  1355   // Code below does not work for native methods - they should never get rewritten anyway
  1355   // Code below does not work for native methods - they should never get rewritten anyway
  1356   assert(!m->is_native(), "cannot rewrite native methods");
  1356   assert(!m->is_native(), "cannot rewrite native methods");
  1357   // Allocate new Method*
  1357   // Allocate new Method*
  1358   AccessFlags flags = m->access_flags();
  1358   AccessFlags flags = m->access_flags();
  1543     return;
  1543     return;
  1544   }
  1544   }
  1545 }
  1545 }
  1546 
  1546 
  1547 // These two methods are static since a GC may move the Method
  1547 // These two methods are static since a GC may move the Method
  1548 bool Method::load_signature_classes(methodHandle m, TRAPS) {
  1548 bool Method::load_signature_classes(const methodHandle& m, TRAPS) {
  1549   if (!THREAD->can_call_java()) {
  1549   if (!THREAD->can_call_java()) {
  1550     // There is nothing useful this routine can do from within the Compile thread.
  1550     // There is nothing useful this routine can do from within the Compile thread.
  1551     // Hopefully, the signature contains only well-known classes.
  1551     // Hopefully, the signature contains only well-known classes.
  1552     // We could scan for this and return true/false, but the caller won't care.
  1552     // We could scan for this and return true/false, but the caller won't care.
  1553     return false;
  1553     return false;
  1577     }
  1577     }
  1578   }
  1578   }
  1579   return sig_is_loaded;
  1579   return sig_is_loaded;
  1580 }
  1580 }
  1581 
  1581 
  1582 bool Method::has_unloaded_classes_in_signature(methodHandle m, TRAPS) {
  1582 bool Method::has_unloaded_classes_in_signature(const methodHandle& m, TRAPS) {
  1583   Handle class_loader(THREAD, m->method_holder()->class_loader());
  1583   Handle class_loader(THREAD, m->method_holder()->class_loader());
  1584   Handle protection_domain(THREAD, m->method_holder()->protection_domain());
  1584   Handle protection_domain(THREAD, m->method_holder()->protection_domain());
  1585   ResourceMark rm(THREAD);
  1585   ResourceMark rm(THREAD);
  1586   Symbol*  signature = m->signature();
  1586   Symbol*  signature = m->signature();
  1587   for(SignatureStream ss(signature); !ss.is_done(); ss.next()) {
  1587   for(SignatureStream ss(signature); !ss.is_done(); ss.next()) {