Mercurial > hg > truffle
comparison src/share/vm/graal/graalVMEntries.cpp @ 3636:c7d4198a9bce
Use GraalEnv for installing code.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 15 Nov 2011 22:06:02 +0100 |
parents | 136ea96eb7f8 |
children | ff6a991c6e3c |
comparison
equal
deleted
inserted
replaced
3635:cb1181db8bec | 3636:c7d4198a9bce |
---|---|
971 | 971 |
972 // public long installMethod(HotSpotTargetMethod targetMethod, boolean installCode); | 972 // public long installMethod(HotSpotTargetMethod targetMethod, boolean installCode); |
973 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_installMethod(JNIEnv *jniEnv, jobject, jobject targetMethod, jboolean install_code) { | 973 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_installMethod(JNIEnv *jniEnv, jobject, jobject targetMethod, jboolean install_code) { |
974 VM_ENTRY_MARK; | 974 VM_ENTRY_MARK; |
975 nmethod* nm = NULL; | 975 nmethod* nm = NULL; |
976 if (CURRENT_ENV == NULL) { | 976 ciEnv* current_env = JavaThread::current()->env(); |
977 Arena arena; | 977 JavaThread::current()->set_env(NULL); |
978 ciEnv env(&arena); | 978 Arena arena; |
979 ResourceMark rm; | 979 ciEnv env(&arena); |
980 CodeInstaller installer(JNIHandles::resolve(targetMethod), nm, install_code != 0); | 980 ResourceMark rm; |
981 } else { | 981 CodeInstaller installer(JNIHandles::resolve(targetMethod), nm, install_code != 0); |
982 ResourceMark rm; | 982 JavaThread::current()->set_env(current_env); |
983 CodeInstaller installer(JNIHandles::resolve(targetMethod), nm, install_code != 0); | |
984 } | |
985 return (jlong) nm; | 983 return (jlong) nm; |
986 } | 984 } |
987 | 985 |
988 // public HotSpotProxy installStub(HotSpotTargetMethod targetMethod, String name); | 986 // public HotSpotProxy installStub(HotSpotTargetMethod targetMethod, String name); |
989 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_installStub(JNIEnv *jniEnv, jobject, jobject targetMethod) { | 987 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_installStub(JNIEnv *jniEnv, jobject, jobject targetMethod) { |
990 VM_ENTRY_MARK; | 988 VM_ENTRY_MARK; |
991 jlong id; | 989 jlong id; |
992 if (CURRENT_ENV == NULL) { | 990 ciEnv* current_env = JavaThread::current()->env(); |
993 Arena arena; | 991 JavaThread::current()->set_env(NULL); |
994 ciEnv env(&arena); | 992 Arena arena; |
995 ResourceMark rm; | 993 ciEnv env(&arena); |
996 CodeInstaller installer(JNIHandles::resolve(targetMethod), id); | 994 ResourceMark rm; |
997 } else { | 995 CodeInstaller installer(JNIHandles::resolve(targetMethod), id); |
998 ResourceMark rm; | 996 JavaThread::current()->set_env(current_env); |
999 CodeInstaller installer(JNIHandles::resolve(targetMethod), id); | |
1000 } | |
1001 return id; | 997 return id; |
1002 } | 998 } |
1003 | 999 |
1004 // public void recordBailout(String reason); | 1000 // public void recordBailout(String reason); |
1005 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_VMEntries_recordBailout(JNIEnv *jniEnv, jobject, jobject message) { | 1001 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_VMEntries_recordBailout(JNIEnv *jniEnv, jobject, jobject message) { |