comparison src/share/vm/graal/graalCompilerToVM.cpp @ 15968:42eaa579e134

more improvements to runtime initialization: - replaced HotSpotSymbol with native method for reading a symbol - moved more ForeignCallDescriptors to HotSpotBackend to reduce class initialization
author Doug Simon <doug.simon@oracle.com>
date Wed, 28 May 2014 17:41:59 +0200
parents 747bc4099ad8
children 66a9286203a2 151fe6b1e511
comparison
equal deleted inserted replaced
15967:9a7803400ba7 15968:42eaa579e134
265 C2V_VMENTRY(jint, lookupNameAndTypeRefIndexInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index)) 265 C2V_VMENTRY(jint, lookupNameAndTypeRefIndexInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
266 constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool; 266 constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
267 return cp->name_and_type_ref_index_at(index); 267 return cp->name_and_type_ref_index_at(index);
268 C2V_END 268 C2V_END
269 269
270 C2V_VMENTRY(jlong, lookupNameRefInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index)) 270 C2V_VMENTRY(jobject, lookupNameRefInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
271 constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool; 271 constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
272 return (jlong) (address) cp->name_ref_at(index); 272 Handle sym = java_lang_String::create_from_symbol(cp->name_ref_at(index), CHECK_NULL);
273 C2V_END 273 return JNIHandles::make_local(THREAD, sym());
274 274 C2V_END
275 C2V_VMENTRY(jlong, lookupSignatureRefInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index)) 275
276 C2V_VMENTRY(jobject, lookupSignatureRefInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
276 constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool; 277 constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
277 return (jlong) (address) cp->signature_ref_at(index); 278 Handle sym = java_lang_String::create_from_symbol(cp->signature_ref_at(index), CHECK_NULL);
279 return JNIHandles::make_local(THREAD, sym());
278 C2V_END 280 C2V_END
279 281
280 C2V_VMENTRY(jint, lookupKlassRefIndexInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index)) 282 C2V_VMENTRY(jint, lookupKlassRefIndexInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
281 constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool; 283 constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
282 return cp->klass_ref_index_at(index); 284 return cp->klass_ref_index_at(index);
727 // tty->time_stamp is the time since VM start which should be used 729 // tty->time_stamp is the time since VM start which should be used
728 // for all HotSpot log output when a timestamp is required. 730 // for all HotSpot log output when a timestamp is required.
729 return tty->time_stamp().milliseconds(); 731 return tty->time_stamp().milliseconds();
730 C2V_END 732 C2V_END
731 733
734 C2V_VMENTRY(jobject, getSymbol, (JNIEnv*, jobject, jlong metaspaceSymbol))
735 Handle sym = java_lang_String::create_from_symbol((Symbol*)(address)metaspaceSymbol, CHECK_NULL);
736 return JNIHandles::make_local(THREAD, sym());
737 C2V_END
738
732 bool matches(jlongArray methods, Method* method) { 739 bool matches(jlongArray methods, Method* method) {
733 typeArrayOop methods_oop = (typeArrayOop) JNIHandles::resolve(methods); 740 typeArrayOop methods_oop = (typeArrayOop) JNIHandles::resolve(methods);
734 741
735 for (int i = 0; i < methods_oop->length(); i++) { 742 for (int i = 0; i < methods_oop->length(); i++) {
736 if (methods_oop->long_at(i) == (jlong) method) { 743 if (methods_oop->long_at(i) == (jlong) method) {
997 #define HS_STACK_FRAME_REF "Lcom/oracle/graal/hotspot/HotSpotStackFrameReference;" 1004 #define HS_STACK_FRAME_REF "Lcom/oracle/graal/hotspot/HotSpotStackFrameReference;"
998 #define METASPACE_KLASS "J" 1005 #define METASPACE_KLASS "J"
999 #define METASPACE_METHOD "J" 1006 #define METASPACE_METHOD "J"
1000 #define METASPACE_METHOD_DATA "J" 1007 #define METASPACE_METHOD_DATA "J"
1001 #define METASPACE_CONSTANT_POOL "J" 1008 #define METASPACE_CONSTANT_POOL "J"
1002 #define METASPACE_SYMBOL "J"
1003 1009
1004 JNINativeMethod CompilerToVM_methods[] = { 1010 JNINativeMethod CompilerToVM_methods[] = {
1005 {CC"getBytecode", CC"("METASPACE_METHOD")[B", FN_PTR(getBytecode)}, 1011 {CC"getBytecode", CC"("METASPACE_METHOD")[B", FN_PTR(getBytecode)},
1006 {CC"exceptionTableStart", CC"("METASPACE_METHOD")J", FN_PTR(exceptionTableStart)}, 1012 {CC"exceptionTableStart", CC"("METASPACE_METHOD")J", FN_PTR(exceptionTableStart)},
1007 {CC"exceptionTableLength", CC"("METASPACE_METHOD")I", FN_PTR(exceptionTableLength)}, 1013 {CC"exceptionTableLength", CC"("METASPACE_METHOD")I", FN_PTR(exceptionTableLength)},
1014 {CC"canInlineMethod", CC"("METASPACE_METHOD")Z", FN_PTR(canInlineMethod)}, 1020 {CC"canInlineMethod", CC"("METASPACE_METHOD")Z", FN_PTR(canInlineMethod)},
1015 {CC"shouldInlineMethod", CC"("METASPACE_METHOD")Z", FN_PTR(shouldInlineMethod)}, 1021 {CC"shouldInlineMethod", CC"("METASPACE_METHOD")Z", FN_PTR(shouldInlineMethod)},
1016 {CC"lookupType", CC"("STRING CLASS"Z)"METASPACE_KLASS, FN_PTR(lookupType)}, 1022 {CC"lookupType", CC"("STRING CLASS"Z)"METASPACE_KLASS, FN_PTR(lookupType)},
1017 {CC"resolveConstantInPool", CC"("METASPACE_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolveConstantInPool)}, 1023 {CC"resolveConstantInPool", CC"("METASPACE_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolveConstantInPool)},
1018 {CC"resolvePossiblyCachedConstantInPool", CC"("METASPACE_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolvePossiblyCachedConstantInPool)}, 1024 {CC"resolvePossiblyCachedConstantInPool", CC"("METASPACE_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolvePossiblyCachedConstantInPool)},
1019 {CC"lookupNameRefInPool", CC"("METASPACE_CONSTANT_POOL"I)"METASPACE_SYMBOL, FN_PTR(lookupNameRefInPool)}, 1025 {CC"lookupNameRefInPool", CC"("METASPACE_CONSTANT_POOL"I)"STRING, FN_PTR(lookupNameRefInPool)},
1020 {CC"lookupNameAndTypeRefIndexInPool", CC"("METASPACE_CONSTANT_POOL"I)I", FN_PTR(lookupNameAndTypeRefIndexInPool)}, 1026 {CC"lookupNameAndTypeRefIndexInPool", CC"("METASPACE_CONSTANT_POOL"I)I", FN_PTR(lookupNameAndTypeRefIndexInPool)},
1021 {CC"lookupSignatureRefInPool", CC"("METASPACE_CONSTANT_POOL"I)"METASPACE_SYMBOL, FN_PTR(lookupSignatureRefInPool)}, 1027 {CC"lookupSignatureRefInPool", CC"("METASPACE_CONSTANT_POOL"I)"STRING, FN_PTR(lookupSignatureRefInPool)},
1022 {CC"lookupKlassRefIndexInPool", CC"("METASPACE_CONSTANT_POOL"I)I", FN_PTR(lookupKlassRefIndexInPool)}, 1028 {CC"lookupKlassRefIndexInPool", CC"("METASPACE_CONSTANT_POOL"I)I", FN_PTR(lookupKlassRefIndexInPool)},
1023 {CC"constantPoolKlassAt", CC"("METASPACE_CONSTANT_POOL"I)"METASPACE_KLASS, FN_PTR(constantPoolKlassAt)}, 1029 {CC"constantPoolKlassAt", CC"("METASPACE_CONSTANT_POOL"I)"METASPACE_KLASS, FN_PTR(constantPoolKlassAt)},
1024 {CC"lookupKlassInPool", CC"("METASPACE_CONSTANT_POOL"I)"METASPACE_KLASS, FN_PTR(lookupKlassInPool)}, 1030 {CC"lookupKlassInPool", CC"("METASPACE_CONSTANT_POOL"I)"METASPACE_KLASS, FN_PTR(lookupKlassInPool)},
1025 {CC"lookupAppendixInPool", CC"("METASPACE_CONSTANT_POOL"I)"OBJECT, FN_PTR(lookupAppendixInPool)}, 1031 {CC"lookupAppendixInPool", CC"("METASPACE_CONSTANT_POOL"I)"OBJECT, FN_PTR(lookupAppendixInPool)},
1026 {CC"lookupMethodInPool", CC"("METASPACE_CONSTANT_POOL"IB)"METASPACE_METHOD, FN_PTR(lookupMethodInPool)}, 1032 {CC"lookupMethodInPool", CC"("METASPACE_CONSTANT_POOL"IB)"METASPACE_METHOD, FN_PTR(lookupMethodInPool)},
1050 {CC"collectCounters", CC"()[J", FN_PTR(collectCounters)}, 1056 {CC"collectCounters", CC"()[J", FN_PTR(collectCounters)},
1051 {CC"getGPUs", CC"()"STRING, FN_PTR(getGPUs)}, 1057 {CC"getGPUs", CC"()"STRING, FN_PTR(getGPUs)},
1052 {CC"allocateCompileId", CC"("METASPACE_METHOD"I)I", FN_PTR(allocateCompileId)}, 1058 {CC"allocateCompileId", CC"("METASPACE_METHOD"I)I", FN_PTR(allocateCompileId)},
1053 {CC"isMature", CC"("METASPACE_METHOD_DATA")Z", FN_PTR(isMature)}, 1059 {CC"isMature", CC"("METASPACE_METHOD_DATA")Z", FN_PTR(isMature)},
1054 {CC"hasCompiledCodeForOSR", CC"("METASPACE_METHOD"II)Z", FN_PTR(hasCompiledCodeForOSR)}, 1060 {CC"hasCompiledCodeForOSR", CC"("METASPACE_METHOD"II)Z", FN_PTR(hasCompiledCodeForOSR)},
1061 {CC"getSymbol", CC"(J)"STRING, FN_PTR(getSymbol)},
1055 {CC"getTimeStamp", CC"()J", FN_PTR(getTimeStamp)}, 1062 {CC"getTimeStamp", CC"()J", FN_PTR(getTimeStamp)},
1056 {CC"getNextStackFrame", CC"("HS_STACK_FRAME_REF "[JI)"HS_STACK_FRAME_REF, FN_PTR(getNextStackFrame)}, 1063 {CC"getNextStackFrame", CC"("HS_STACK_FRAME_REF "[JI)"HS_STACK_FRAME_REF, FN_PTR(getNextStackFrame)},
1057 {CC"materializeVirtualObjects", CC"("HS_STACK_FRAME_REF"Z)V", FN_PTR(materializeVirtualObjects)}, 1064 {CC"materializeVirtualObjects", CC"("HS_STACK_FRAME_REF"Z)V", FN_PTR(materializeVirtualObjects)},
1058 }; 1065 };
1059 1066