src/share/vm/interpreter/interpreterRuntime.cpp

changeset 3050
fdb992d83a87
parent 2988
2c359f27615c
child 3101
aa67216400d3
child 3111
2fecca53a2c6
     1.1 --- a/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Aug 11 12:08:11 2011 -0700
     1.2 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Tue Aug 16 04:14:05 2011 -0700
     1.3 @@ -509,6 +509,7 @@
     1.4    // resolve field
     1.5    FieldAccessInfo info;
     1.6    constantPoolHandle pool(thread, method(thread)->constants());
     1.7 +  bool is_put    = (bytecode == Bytecodes::_putfield  || bytecode == Bytecodes::_putstatic);
     1.8    bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
     1.9  
    1.10    {
    1.11 @@ -528,8 +529,6 @@
    1.12    // exceptions at the correct place. If we do not resolve completely
    1.13    // in the current pass, leaving the put_code set to zero will
    1.14    // cause the next put instruction to reresolve.
    1.15 -  bool is_put = (bytecode == Bytecodes::_putfield ||
    1.16 -                 bytecode == Bytecodes::_putstatic);
    1.17    Bytecodes::Code put_code = (Bytecodes::Code)0;
    1.18  
    1.19    // We also need to delay resolving getstatic instructions until the
    1.20 @@ -541,7 +540,6 @@
    1.21                                 !klass->is_initialized());
    1.22    Bytecodes::Code get_code = (Bytecodes::Code)0;
    1.23  
    1.24 -
    1.25    if (!uninitialized_static) {
    1.26      get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield);
    1.27      if (is_put || !info.access_flags().is_final()) {
    1.28 @@ -549,6 +547,23 @@
    1.29      }
    1.30    }
    1.31  
    1.32 +  if (is_put && !is_static && klass->is_subclass_of(SystemDictionary::CallSite_klass()) && (info.name() == vmSymbols::target_name())) {
    1.33 +    const jint direction = frame::interpreter_frame_expression_stack_direction();
    1.34 +    oop call_site     = *((oop*) thread->last_frame().interpreter_frame_tos_at(-1 * direction));
    1.35 +    oop method_handle = *((oop*) thread->last_frame().interpreter_frame_tos_at( 0 * direction));
    1.36 +    assert(call_site    ->is_a(SystemDictionary::CallSite_klass()),     "must be");
    1.37 +    assert(method_handle->is_a(SystemDictionary::MethodHandle_klass()), "must be");
    1.38 +
    1.39 +    {
    1.40 +      // Walk all nmethods depending on CallSite
    1.41 +      MutexLocker mu(Compile_lock, thread);
    1.42 +      Universe::flush_dependents_on(call_site, method_handle);
    1.43 +    }
    1.44 +
    1.45 +    // Don't allow fast path for setting CallSite.target and sub-classes.
    1.46 +    put_code = (Bytecodes::Code) 0;
    1.47 +  }
    1.48 +
    1.49    cache_entry(thread)->set_field(
    1.50      get_code,
    1.51      put_code,

mercurial