hotspot/src/share/vm/oops/method.cpp
changeset 38133 78b95467b9f1
parent 37439 e8970711113b
child 38144 0976c0c5c5d3
equal deleted inserted replaced
38132:ba888a4f352a 38133:78b95467b9f1
   744   }
   744   }
   745   *native_function = function;
   745   *native_function = function;
   746   // This function can be called more than once. We must make sure that we always
   746   // This function can be called more than once. We must make sure that we always
   747   // use the latest registered method -> check if a stub already has been generated.
   747   // use the latest registered method -> check if a stub already has been generated.
   748   // If so, we have to make it not_entrant.
   748   // If so, we have to make it not_entrant.
   749   nmethod* nm = code(); // Put it into local variable to guard against concurrent updates
   749   CompiledMethod* nm = code(); // Put it into local variable to guard against concurrent updates
   750   if (nm != NULL) {
   750   if (nm != NULL) {
   751     nm->make_not_entrant();
   751     nm->make_not_entrant();
   752   }
   752   }
   753 }
   753 }
   754 
   754 
  1044 // Check that if an nmethod ref exists, it has a backlink to this or no backlink at all
  1044 // Check that if an nmethod ref exists, it has a backlink to this or no backlink at all
  1045 // (could be racing a deopt).
  1045 // (could be racing a deopt).
  1046 // Not inline to avoid circular ref.
  1046 // Not inline to avoid circular ref.
  1047 bool Method::check_code() const {
  1047 bool Method::check_code() const {
  1048   // cached in a register or local.  There's a race on the value of the field.
  1048   // cached in a register or local.  There's a race on the value of the field.
  1049   nmethod *code = (nmethod *)OrderAccess::load_ptr_acquire(&_code);
  1049   CompiledMethod *code = (CompiledMethod *)OrderAccess::load_ptr_acquire(&_code);
  1050   return code == NULL || (code->method() == NULL) || (code->method() == (Method*)this && !code->is_osr_method());
  1050   return code == NULL || (code->method() == NULL) || (code->method() == (Method*)this && !code->is_osr_method());
  1051 }
  1051 }
  1052 
  1052 
  1053 // Install compiled code.  Instantly it can execute.
  1053 // Install compiled code.  Instantly it can execute.
  1054 void Method::set_code(methodHandle mh, nmethod *code) {
  1054 void Method::set_code(methodHandle mh, CompiledMethod *code) {
  1055   assert( code, "use clear_code to remove code" );
  1055   assert( code, "use clear_code to remove code" );
  1056   assert( mh->check_code(), "" );
  1056   assert( mh->check_code(), "" );
  1057 
  1057 
  1058   guarantee(mh->adapter() != NULL, "Adapter blob must already exist!");
  1058   guarantee(mh->adapter() != NULL, "Adapter blob must already exist!");
  1059 
  1059