7094138: JSR 292: JRuby junit test fails in CallSite.setTargetNormal: obj->is_oop() failed: sanity check

Reviewed-by: iveresov, never
This commit is contained in:
Christian Thalinger 2011-10-25 00:55:10 -07:00
parent ae64d0bc30
commit 249b9c657d
3 changed files with 24 additions and 21 deletions

View File

@ -549,8 +549,8 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecode
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));
Handle call_site (THREAD, *((oop*) thread->last_frame().interpreter_frame_tos_at(-1 * direction)));
Handle method_handle(THREAD, *((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");

View File

@ -3079,26 +3079,26 @@ JVM_ENTRY(jint, MHN_getMembers(JNIEnv *env, jobject igcls,
JVM_END
JVM_ENTRY(void, MHN_setCallSiteTargetNormal(JNIEnv* env, jobject igcls, jobject call_site_jh, jobject target_jh)) {
oop call_site = JNIHandles::resolve_non_null(call_site_jh);
oop target = JNIHandles::resolve(target_jh);
Handle call_site(THREAD, JNIHandles::resolve_non_null(call_site_jh));
Handle target (THREAD, JNIHandles::resolve(target_jh));
{
// Walk all nmethods depending on this call site.
MutexLocker mu(Compile_lock, thread);
Universe::flush_dependents_on(call_site, target);
}
java_lang_invoke_CallSite::set_target(call_site, target);
java_lang_invoke_CallSite::set_target(call_site(), target());
}
JVM_END
JVM_ENTRY(void, MHN_setCallSiteTargetVolatile(JNIEnv* env, jobject igcls, jobject call_site_jh, jobject target_jh)) {
oop call_site = JNIHandles::resolve_non_null(call_site_jh);
oop target = JNIHandles::resolve(target_jh);
Handle call_site(THREAD, JNIHandles::resolve_non_null(call_site_jh));
Handle target (THREAD, JNIHandles::resolve(target_jh));
{
// Walk all nmethods depending on this call site.
MutexLocker mu(Compile_lock, thread);
Universe::flush_dependents_on(call_site, target);
}
java_lang_invoke_CallSite::set_target_volatile(call_site, target);
java_lang_invoke_CallSite::set_target_volatile(call_site(), target());
}
JVM_END

View File

@ -302,21 +302,24 @@ UNSAFE_END
UNSAFE_ENTRY(void, Unsafe_SetObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h))
UnsafeWrapper("Unsafe_SetObjectVolatile");
oop x = JNIHandles::resolve(x_h);
oop p = JNIHandles::resolve(obj);
// Catch VolatileCallSite.target stores (via
// CallSite.setTargetVolatile) and check call site dependencies.
if ((offset == java_lang_invoke_CallSite::target_offset_in_bytes()) && p->is_a(SystemDictionary::CallSite_klass())) {
oop call_site = p;
oop method_handle = x;
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 this call site.
MutexLocker mu(Compile_lock, thread);
Universe::flush_dependents_on(call_site, method_handle);
{
// Catch VolatileCallSite.target stores (via
// CallSite.setTargetVolatile) and check call site dependencies.
oop p = JNIHandles::resolve(obj);
if ((offset == java_lang_invoke_CallSite::target_offset_in_bytes()) && p->is_a(SystemDictionary::CallSite_klass())) {
Handle call_site (THREAD, p);
Handle method_handle(THREAD, JNIHandles::resolve(x_h));
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 this call site.
MutexLocker mu(Compile_lock, thread);
Universe::flush_dependents_on(call_site(), method_handle());
}
}
}
oop x = JNIHandles::resolve(x_h);
oop p = JNIHandles::resolve(obj);
void* addr = index_oop_from_field_offset_long(p, offset);
OrderAccess::release();
if (UseCompressedOops) {