--- old/src/share/vm/interpreter/interpreterRuntime.cpp 2015-12-05 15:20:04.826452274 +0100 +++ new/src/share/vm/interpreter/interpreterRuntime.cpp 2015-12-05 15:20:04.706452271 +0100 @@ -588,24 +588,55 @@ !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 (info.is_accessor()) { + // If it is an accessor (not a real field) change bytecode + // semantic to be a call to the accessor-method) + InstanceKlass* current_klass = method(thread)->method_holder(); + // find method based on get/put + Method* m = klass->method_with_idnum(is_put + ? info.get_put_accessor() + : info.get_get_accessor() + ); + + // Create a linkinfo to resolve the method + LinkInfo linfo(klass,m->name(),m->signature(),current_klass,true); + + // Resolve static/non-static method and initialize cp_cache_entry + // accordingly + if (is_static) { + methodHandle mh = LinkResolver::resolve_static_call_or_null(linfo); + cp_cache_entry->set_direct_call( + Bytecodes::_invokestatic, + mh); + }else { + methodHandle mh = LinkResolver::resolve_virtual_call_or_null(klass,linfo); + cp_cache_entry->set_vtable_call( + Bytecodes::_invokevirtual, + mh, + m->vtable_index()); + } + + }else { + 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); + } } - } - cp_cache_entry->set_field( - get_code, - put_code, - info.field_holder(), - info.index(), - info.offset(), - state, - info.access_flags().is_final(), - info.access_flags().is_volatile(), - pool->pool_holder() - ); + cp_cache_entry->set_field( + get_code, + put_code, + info.field_holder(), + info.index(), + info.offset(), + state, + info.access_flags().is_final(), + info.access_flags().is_volatile(), + pool->pool_holder() + ); + } }