Mercurial > hg > truffle
changeset 3667:e755289380e3
Removed a safepoint possibility in the code installer when creating CiVirtualObject objects.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 18 Nov 2011 13:07:25 +0100 |
parents | 6e1abd79e7c8 |
children | 46f211fe010c |
files | src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalCodeInstaller.hpp src/share/vm/graal/graalVMEntries.cpp |
diffstat | 3 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/graal/graalCodeInstaller.cpp Thu Nov 17 19:11:55 2011 +0100 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Fri Nov 18 13:07:25 2011 +0100 @@ -186,7 +186,7 @@ } else if (value->is_a(CiVirtualObject::klass())) { oop type = CiVirtualObject::type(value); int id = CiVirtualObject::id(value); - ciKlass* klass = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type))); + instanceKlass* klass = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type))); assert(klass->is_instance_klass() || klass->is_array_klass(), "Not supported allocation."); for (jint i = 0; i < objects->length(); i++) { @@ -196,7 +196,7 @@ } } - ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(klass->constant_encoding())); + ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), klass->as_klassOop()))); arrayOop values = (arrayOop) CiVirtualObject::values(value); for (jint i = 0; i < values->length(); i++) { @@ -231,7 +231,7 @@ } // constructor used to create a method -CodeInstaller::CodeInstaller(Handle target_method, nmethod*& nm, bool install_code) { +CodeInstaller::CodeInstaller(Handle& target_method, nmethod*& nm, bool install_code) { _env = CURRENT_ENV; GraalCompiler::initialize_buffer_blob(); CodeBuffer buffer(JavaThread::current()->get_buffer_blob()); @@ -275,7 +275,7 @@ } // constructor used to create a stub -CodeInstaller::CodeInstaller(Handle target_method, jlong& id) { +CodeInstaller::CodeInstaller(Handle& target_method, jlong& id) { No_Safepoint_Verifier no_safepoint; _env = CURRENT_ENV;
--- a/src/share/vm/graal/graalCodeInstaller.hpp Thu Nov 17 19:11:55 2011 +0100 +++ b/src/share/vm/graal/graalCodeInstaller.hpp Fri Nov 18 13:07:25 2011 +0100 @@ -82,10 +82,10 @@ public: // constructor used to create a method - CodeInstaller(Handle target_method, nmethod*& nm, bool install_code); + CodeInstaller(Handle& target_method, nmethod*& nm, bool install_code); // constructor used to create a stub - CodeInstaller(Handle target_method, jlong& id); + CodeInstaller(Handle& target_method, jlong& id); static address runtime_call_target_address(oop runtime_call);
--- a/src/share/vm/graal/graalVMEntries.cpp Thu Nov 17 19:11:55 2011 +0100 +++ b/src/share/vm/graal/graalVMEntries.cpp Fri Nov 18 13:07:25 2011 +0100 @@ -925,13 +925,14 @@ // public long installMethod(HotSpotTargetMethod targetMethod, boolean installCode); JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_installMethod(JNIEnv *jniEnv, jobject, jobject targetMethod, jboolean install_code) { VM_ENTRY_MARK; + Handle targetMethodHandle = JNIHandles::resolve(targetMethod); nmethod* nm = NULL; ciEnv* current_env = JavaThread::current()->env(); JavaThread::current()->set_env(NULL); Arena arena; ciEnv env(&arena); ResourceMark rm; - CodeInstaller installer(JNIHandles::resolve(targetMethod), nm, install_code != 0); + CodeInstaller installer(targetMethodHandle, nm, install_code != 0); JavaThread::current()->set_env(current_env); return (jlong) nm; } @@ -939,13 +940,14 @@ // public HotSpotProxy installStub(HotSpotTargetMethod targetMethod, String name); JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_installStub(JNIEnv *jniEnv, jobject, jobject targetMethod) { VM_ENTRY_MARK; + Handle targetMethodHandle = JNIHandles::resolve(targetMethod); jlong id; ciEnv* current_env = JavaThread::current()->env(); JavaThread::current()->set_env(NULL); Arena arena; ciEnv env(&arena); ResourceMark rm; - CodeInstaller installer(JNIHandles::resolve(targetMethod), id); + CodeInstaller installer(targetMethodHandle, id); JavaThread::current()->set_env(current_env); return id; }