Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/vm/interpreter/interpreterRuntime.cpp
          +++ new/src/share/vm/interpreter/interpreterRuntime.cpp
↓ open down ↓ 501 lines elided ↑ open up ↑
 502  502  
 503  503  
 504  504  //------------------------------------------------------------------------------------------------------------------------
 505  505  // Fields
 506  506  //
 507  507  
 508  508  IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode))
 509  509    // resolve field
 510  510    FieldAccessInfo info;
 511  511    constantPoolHandle pool(thread, method(thread)->constants());
      512 +  bool is_put    = (bytecode == Bytecodes::_putfield  || bytecode == Bytecodes::_putstatic);
 512  513    bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
 513  514  
 514  515    {
 515  516      JvmtiHideSingleStepping jhss(thread);
 516  517      LinkResolver::resolve_field(info, pool, get_index_u2_cpcache(thread, bytecode),
 517  518                                  bytecode, false, CHECK);
 518  519    } // end JvmtiHideSingleStepping
 519  520  
 520  521    // check if link resolution caused cpCache to be updated
 521  522    if (already_resolved(thread)) return;
 522  523  
 523  524    // compute auxiliary field attributes
 524  525    TosState state  = as_TosState(info.field_type());
 525  526  
 526  527    // We need to delay resolving put instructions on final fields
 527  528    // until we actually invoke one. This is required so we throw
 528  529    // exceptions at the correct place. If we do not resolve completely
 529  530    // in the current pass, leaving the put_code set to zero will
 530  531    // cause the next put instruction to reresolve.
 531      -  bool is_put = (bytecode == Bytecodes::_putfield ||
 532      -                 bytecode == Bytecodes::_putstatic);
 533  532    Bytecodes::Code put_code = (Bytecodes::Code)0;
 534  533  
 535  534    // We also need to delay resolving getstatic instructions until the
 536  535    // class is intitialized.  This is required so that access to the static
 537  536    // field will call the initialization function every time until the class
 538  537    // is completely initialized ala. in 2.17.5 in JVM Specification.
 539  538    instanceKlass *klass = instanceKlass::cast(info.klass()->as_klassOop());
 540  539    bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) &&
 541  540                                 !klass->is_initialized());
 542  541    Bytecodes::Code get_code = (Bytecodes::Code)0;
 543  542  
 544      -
 545  543    if (!uninitialized_static) {
 546  544      get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield);
 547  545      if (is_put || !info.access_flags().is_final()) {
 548  546        put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_putfield);
 549  547      }
 550  548    }
 551  549  
      550 +  if (is_put && !is_static && klass->is_subclass_of(SystemDictionary::CallSite_klass()) && (info.name() == vmSymbols::target_name())) {
      551 +    const jint direction = frame::interpreter_frame_expression_stack_direction();
      552 +    oop call_site     = *((oop*) thread->last_frame().interpreter_frame_tos_at(-1 * direction));
      553 +    oop method_handle = *((oop*) thread->last_frame().interpreter_frame_tos_at( 0 * direction));
      554 +    assert(call_site    ->is_a(SystemDictionary::CallSite_klass()),     "must be");
      555 +    assert(method_handle->is_a(SystemDictionary::MethodHandle_klass()), "must be");
      556 +
      557 +    {
      558 +      // Walk all nmethods depending on CallSite
      559 +      MutexLocker mu(Compile_lock, thread);
      560 +      Universe::flush_dependents_on(call_site, method_handle);
      561 +    }
      562 +
      563 +    // Don't allow fast path for setting CallSite.target and sub-classes.
      564 +    put_code = (Bytecodes::Code) 0;
      565 +  }
      566 +
 552  567    cache_entry(thread)->set_field(
 553  568      get_code,
 554  569      put_code,
 555  570      info.klass(),
 556  571      info.field_index(),
 557  572      info.field_offset(),
 558  573      state,
 559  574      info.access_flags().is_final(),
 560  575      info.access_flags().is_volatile()
 561  576    );
↓ open down ↓ 689 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX