comparison src/share/vm/graal/graalVMEntries.cpp @ 3619:5e9645341ec3

support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 09 Nov 2011 11:27:38 +0100
parents 1692a2f9bfc5
children 75e92277ad05
comparison
equal deleted inserted replaced
3601:3822c5969a8b 3619:5e9645341ec3
22 */ 22 */
23 23
24 #include "precompiled.hpp" 24 #include "precompiled.hpp"
25 #include "c1/c1_Runtime1.hpp" 25 #include "c1/c1_Runtime1.hpp"
26 #include "ci/ciMethodData.hpp" 26 #include "ci/ciMethodData.hpp"
27 #include "compiler/compileBroker.hpp"
27 #include "graal/graalVMEntries.hpp" 28 #include "graal/graalVMEntries.hpp"
28 #include "graal/graalCompiler.hpp" 29 #include "graal/graalCompiler.hpp"
29 #include "graal/graalJavaAccess.hpp" 30 #include "graal/graalJavaAccess.hpp"
30 #include "graal/graalCodeInstaller.hpp" 31 #include "graal/graalCodeInstaller.hpp"
31 #include "graal/graalVMExits.hpp" 32 #include "graal/graalVMExits.hpp"
984 set_int_array(env, config, "arrayOffsets", arrayOffsets); 985 set_int_array(env, config, "arrayOffsets", arrayOffsets);
985 set_int(env, config, "arrayClassElementOffset", objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)); 986 set_int(env, config, "arrayClassElementOffset", objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc));
986 return config; 987 return config;
987 } 988 }
988 989
989 // public void installMethod(HotSpotTargetMethod targetMethod); 990 // public long installMethod(HotSpotTargetMethod targetMethod, boolean installCode);
990 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_VMEntries_installMethod(JNIEnv *jniEnv, jobject, jobject targetMethod) { 991 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_installMethod(JNIEnv *jniEnv, jobject, jobject targetMethod, jboolean install_code) {
991 VM_ENTRY_MARK; 992 VM_ENTRY_MARK;
993 nmethod* nm = NULL;
992 if (CURRENT_ENV == NULL) { 994 if (CURRENT_ENV == NULL) {
993 Arena arena; 995 Arena arena;
994 ciEnv env(&arena); 996 ciEnv env(&arena);
995 ResourceMark rm; 997 ResourceMark rm;
996 CodeInstaller installer(JNIHandles::resolve(targetMethod)); 998 CodeInstaller installer(JNIHandles::resolve(targetMethod), nm, install_code);
997 } else { 999 } else {
998 ResourceMark rm; 1000 ResourceMark rm;
999 CodeInstaller installer(JNIHandles::resolve(targetMethod)); 1001 CodeInstaller installer(JNIHandles::resolve(targetMethod), nm, install_code);
1000 } 1002 }
1003 return (jlong) nm;
1001 } 1004 }
1002 1005
1003 // public HotSpotProxy installStub(HotSpotTargetMethod targetMethod, String name); 1006 // public HotSpotProxy installStub(HotSpotTargetMethod targetMethod, String name);
1004 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_installStub(JNIEnv *jniEnv, jobject, jobject targetMethod) { 1007 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_installStub(JNIEnv *jniEnv, jobject, jobject targetMethod) {
1005 VM_ENTRY_MARK; 1008 VM_ENTRY_MARK;
1023 if (!msg.is_null()) { 1026 if (!msg.is_null()) {
1024 java_lang_String::print(msg, tty); 1027 java_lang_String::print(msg, tty);
1025 } 1028 }
1026 vm_abort(false); 1029 vm_abort(false);
1027 } 1030 }
1031 }
1032
1033 // public void notifyJavaQueue();
1034 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_VMEntries_notifyJavaQueue(JNIEnv *jniEnv, jobject) {
1035 CompileBroker::notify_java_queue();
1028 } 1036 }
1029 1037
1030 1038
1031 1039
1032 1040
1086 {CC"RiType_isInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_RiType_1isInitialized)}, 1094 {CC"RiType_isInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_RiType_1isInitialized)},
1087 {CC"getPrimitiveArrayType", CC"("CI_KIND")"TYPE, FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_getPrimitiveArrayType)}, 1095 {CC"getPrimitiveArrayType", CC"("CI_KIND")"TYPE, FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_getPrimitiveArrayType)},
1088 {CC"getMaxCallTargetOffset", CC"("CI_RUNTIME_CALL")J", FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_getMaxCallTargetOffset)}, 1096 {CC"getMaxCallTargetOffset", CC"("CI_RUNTIME_CALL")J", FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_getMaxCallTargetOffset)},
1089 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_getType)}, 1097 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_getType)},
1090 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_getConfiguration)}, 1098 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_getConfiguration)},
1091 {CC"installMethod", CC"("TARGET_METHOD")V", FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_installMethod)}, 1099 {CC"installMethod", CC"("TARGET_METHOD"Z)J", FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_installMethod)},
1092 {CC"installStub", CC"("TARGET_METHOD")"PROXY, FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_installStub)}, 1100 {CC"installStub", CC"("TARGET_METHOD")"PROXY, FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_installStub)},
1093 {CC"recordBailout", CC"("STRING")V", FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_recordBailout)} 1101 {CC"recordBailout", CC"("STRING")V", FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_recordBailout)},
1102 {CC"notifyJavaQueue", CC"()V", FN_PTR(Java_com_oracle_graal_hotspot_VMEntries_notifyJavaQueue)}
1094 }; 1103 };
1095 1104
1096 int VMEntries_methods_count() { 1105 int VMEntries_methods_count() {
1097 return sizeof(VMEntries_methods) / sizeof(JNINativeMethod); 1106 return sizeof(VMEntries_methods) / sizeof(JNINativeMethod);
1098 } 1107 }