src/share/vm/interpreter/interpreterRuntime.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Aug 12 04:58:55 2011
--- new/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Aug 12 04:58:55 2011

*** 507,516 **** --- 507,517 ---- IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode)) // resolve field FieldAccessInfo info; constantPoolHandle pool(thread, method(thread)->constants()); + bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_putstatic); bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic); { JvmtiHideSingleStepping jhss(thread); LinkResolver::resolve_field(info, pool, get_index_u2_cpcache(thread, bytecode),
*** 526,537 **** --- 527,536 ---- // We need to delay resolving put instructions on final fields // until we actually invoke one. This is required so we throw // exceptions at the correct place. If we do not resolve completely // in the current pass, leaving the put_code set to zero will // cause the next put instruction to reresolve. bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_putstatic); Bytecodes::Code put_code = (Bytecodes::Code)0; // We also need to delay resolving getstatic instructions until the // class is intitialized. This is required so that access to the static // field will call the initialization function every time until the class
*** 539,556 **** --- 538,571 ---- instanceKlass *klass = instanceKlass::cast(info.klass()->as_klassOop()); bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) && !klass->is_initialized()); Bytecodes::Code get_code = (Bytecodes::Code)0; if (!uninitialized_static) { get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield); if (is_put || !info.access_flags().is_final()) { put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_putfield); } } + if (is_put && !is_static && klass->is_subclass_of(SystemDictionary::CallSite_klass()) && (info.name() == vmSymbols::target_name())) { + const jint direction = frame::interpreter_frame_expression_stack_direction(); + oop call_site = *((oop*) thread->last_frame().interpreter_frame_tos_at(-1 * direction)); + oop method_handle = *((oop*) thread->last_frame().interpreter_frame_tos_at( 0 * direction)); + assert(call_site ->is_a(SystemDictionary::CallSite_klass()), "must be"); + assert(method_handle->is_a(SystemDictionary::MethodHandle_klass()), "must be"); + + { + // Walk all nmethods depending on CallSite + MutexLocker mu(Compile_lock, thread); + Universe::flush_dependents_on(call_site, method_handle); + } + + // Don't allow fast path for setting CallSite.target and sub-classes. + put_code = (Bytecodes::Code) 0; + } + cache_entry(thread)->set_field( get_code, put_code, info.klass(), info.field_index(),

src/share/vm/interpreter/interpreterRuntime.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File