< prev index next >

hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp

Print this page




1335 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
1336 
1337 #define STRING                "Ljava/lang/String;"
1338 #define OBJECT                "Ljava/lang/Object;"
1339 #define CLASS                 "Ljava/lang/Class;"
1340 #define STACK_TRACE_ELEMENT   "Ljava/lang/StackTraceElement;"
1341 #define INSTALLED_CODE        "Ljdk/vm/ci/code/InstalledCode;"
1342 #define TARGET_DESCRIPTION    "Ljdk/vm/ci/code/TargetDescription;"
1343 #define RESOLVED_METHOD       "Ljdk/vm/ci/meta/ResolvedJavaMethod;"
1344 #define HS_RESOLVED_METHOD    "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl;"
1345 #define HS_RESOLVED_KLASS     "Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;"
1346 #define HS_CONSTANT_POOL      "Ljdk/vm/ci/hotspot/HotSpotConstantPool;"
1347 #define HS_COMPILED_CODE      "Ljdk/vm/ci/hotspot/HotSpotCompiledCode;"
1348 #define HS_CONFIG             "Ljdk/vm/ci/hotspot/HotSpotVMConfig;"
1349 #define HS_METADATA           "Ljdk/vm/ci/hotspot/HotSpotMetaData;"
1350 #define HS_STACK_FRAME_REF    "Ljdk/vm/ci/hotspot/HotSpotStackFrameReference;"
1351 #define HS_SPECULATION_LOG    "Ljdk/vm/ci/hotspot/HotSpotSpeculationLog;"
1352 #define METASPACE_METHOD_DATA "J"
1353 
1354 JNINativeMethod CompilerToVM::methods[] = {
1355   {CC"getBytecode",                                  CC"("HS_RESOLVED_METHOD")[B",                                                     FN_PTR(getBytecode)},
1356   {CC"getExceptionTableStart",                       CC"("HS_RESOLVED_METHOD")J",                                                      FN_PTR(getExceptionTableStart)},
1357   {CC"getExceptionTableLength",                      CC"("HS_RESOLVED_METHOD")I",                                                      FN_PTR(getExceptionTableLength)},
1358   {CC"findUniqueConcreteMethod",                     CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD")"HS_RESOLVED_METHOD,                   FN_PTR(findUniqueConcreteMethod)},
1359   {CC"getImplementor",                               CC"("HS_RESOLVED_KLASS")"HS_RESOLVED_KLASS,                                       FN_PTR(getImplementor)},
1360   {CC"getStackTraceElement",                         CC"("HS_RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT,                                   FN_PTR(getStackTraceElement)},
1361   {CC"methodIsIgnoredBySecurityStackWalk",           CC"("HS_RESOLVED_METHOD")Z",                                                      FN_PTR(methodIsIgnoredBySecurityStackWalk)},
1362   {CC"doNotInlineOrCompile",                         CC"("HS_RESOLVED_METHOD")V",                                                      FN_PTR(doNotInlineOrCompile)},
1363   {CC"canInlineMethod",                              CC"("HS_RESOLVED_METHOD")Z",                                                      FN_PTR(canInlineMethod)},
1364   {CC"shouldInlineMethod",                           CC"("HS_RESOLVED_METHOD")Z",                                                      FN_PTR(shouldInlineMethod)},
1365   {CC"lookupType",                                   CC"("STRING CLASS"Z)"HS_RESOLVED_KLASS,                                           FN_PTR(lookupType)},
1366   {CC"lookupNameInPool",                             CC"("HS_CONSTANT_POOL"I)"STRING,                                                  FN_PTR(lookupNameInPool)},
1367   {CC"lookupNameAndTypeRefIndexInPool",              CC"("HS_CONSTANT_POOL"I)I",                                                       FN_PTR(lookupNameAndTypeRefIndexInPool)},
1368   {CC"lookupSignatureInPool",                        CC"("HS_CONSTANT_POOL"I)"STRING,                                                  FN_PTR(lookupSignatureInPool)},
1369   {CC"lookupKlassRefIndexInPool",                    CC"("HS_CONSTANT_POOL"I)I",                                                       FN_PTR(lookupKlassRefIndexInPool)},
1370   {CC"lookupKlassInPool",                            CC"("HS_CONSTANT_POOL"I)Ljava/lang/Object;",                                      FN_PTR(lookupKlassInPool)},
1371   {CC"lookupAppendixInPool",                         CC"("HS_CONSTANT_POOL"I)"OBJECT,                                                  FN_PTR(lookupAppendixInPool)},
1372   {CC"lookupMethodInPool",                           CC"("HS_CONSTANT_POOL"IB)"HS_RESOLVED_METHOD,                                     FN_PTR(lookupMethodInPool)},
1373   {CC"constantPoolRemapInstructionOperandFromCache", CC"("HS_CONSTANT_POOL"I)I",                                                       FN_PTR(constantPoolRemapInstructionOperandFromCache)},
1374   {CC"resolveConstantInPool",                        CC"("HS_CONSTANT_POOL"I)"OBJECT,                                                  FN_PTR(resolveConstantInPool)},
1375   {CC"resolvePossiblyCachedConstantInPool",          CC"("HS_CONSTANT_POOL"I)"OBJECT,                                                  FN_PTR(resolvePossiblyCachedConstantInPool)},
1376   {CC"resolveTypeInPool",                            CC"("HS_CONSTANT_POOL"I)"HS_RESOLVED_KLASS,                                       FN_PTR(resolveTypeInPool)},
1377   {CC"resolveFieldInPool",                           CC"("HS_CONSTANT_POOL"IB[J)"HS_RESOLVED_KLASS,                                    FN_PTR(resolveFieldInPool)},
1378   {CC"resolveInvokeDynamicInPool",                   CC"("HS_CONSTANT_POOL"I)V",                                                       FN_PTR(resolveInvokeDynamicInPool)},
1379   {CC"resolveInvokeHandleInPool",                    CC"("HS_CONSTANT_POOL"I)V",                                                       FN_PTR(resolveInvokeHandleInPool)},
1380   {CC"resolveMethod",                                CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD HS_RESOLVED_KLASS")"HS_RESOLVED_METHOD, FN_PTR(resolveMethod)},
1381   {CC"getVtableIndexForInterfaceMethod",             CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD")I",                                    FN_PTR(getVtableIndexForInterfaceMethod)},
1382   {CC"getClassInitializer",                          CC"("HS_RESOLVED_KLASS")"HS_RESOLVED_METHOD,                                      FN_PTR(getClassInitializer)},
1383   {CC"hasFinalizableSubclass",                       CC"("HS_RESOLVED_KLASS")Z",                                                       FN_PTR(hasFinalizableSubclass)},
1384   {CC"getMaxCallTargetOffset",                       CC"(J)J",                                                                         FN_PTR(getMaxCallTargetOffset)},
1385   {CC"getResolvedJavaMethodAtSlot",                  CC"("CLASS"I)"HS_RESOLVED_METHOD,                                                 FN_PTR(getResolvedJavaMethodAtSlot)},
1386   {CC"getResolvedJavaMethod",                        CC"(Ljava/lang/Object;J)"HS_RESOLVED_METHOD,                                      FN_PTR(getResolvedJavaMethod)},
1387   {CC"getConstantPool",                              CC"(Ljava/lang/Object;J)"HS_CONSTANT_POOL,                                        FN_PTR(getConstantPool)},
1388   {CC"getResolvedJavaType",                          CC"(Ljava/lang/Object;JZ)"HS_RESOLVED_KLASS,                                      FN_PTR(getResolvedJavaType)},
1389   {CC"initializeConfiguration",                      CC"("HS_CONFIG")J",                                                               FN_PTR(initializeConfiguration)},
1390   {CC"installCode",                                  CC"("TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE HS_SPECULATION_LOG")I",   FN_PTR(installCode)},
1391   {CC"getMetadata",                                  CC"("TARGET_DESCRIPTION HS_COMPILED_CODE HS_METADATA")I",                         FN_PTR(getMetadata)},
1392   {CC"notifyCompilationStatistics",                  CC"(I"HS_RESOLVED_METHOD"ZIJJ"INSTALLED_CODE")V",                                 FN_PTR(notifyCompilationStatistics)},
1393   {CC"resetCompilationStatistics",                   CC"()V",                                                                          FN_PTR(resetCompilationStatistics)},
1394   {CC"disassembleCodeBlob",                          CC"("INSTALLED_CODE")"STRING,                                                     FN_PTR(disassembleCodeBlob)},
1395   {CC"executeInstalledCode",                         CC"(["OBJECT INSTALLED_CODE")"OBJECT,                                             FN_PTR(executeInstalledCode)},
1396   {CC"getLineNumberTable",                           CC"("HS_RESOLVED_METHOD")[J",                                                     FN_PTR(getLineNumberTable)},
1397   {CC"getLocalVariableTableStart",                   CC"("HS_RESOLVED_METHOD")J",                                                      FN_PTR(getLocalVariableTableStart)},
1398   {CC"getLocalVariableTableLength",                  CC"("HS_RESOLVED_METHOD")I",                                                      FN_PTR(getLocalVariableTableLength)},
1399   {CC"reprofile",                                    CC"("HS_RESOLVED_METHOD")V",                                                      FN_PTR(reprofile)},
1400   {CC"invalidateInstalledCode",                      CC"("INSTALLED_CODE")V",                                                          FN_PTR(invalidateInstalledCode)},
1401   {CC"readUncompressedOop",                          CC"(J)"OBJECT,                                                                    FN_PTR(readUncompressedOop)},
1402   {CC"collectCounters",                              CC"()[J",                                                                         FN_PTR(collectCounters)},
1403   {CC"allocateCompileId",                            CC"("HS_RESOLVED_METHOD"I)I",                                                     FN_PTR(allocateCompileId)},
1404   {CC"isMature",                                     CC"("METASPACE_METHOD_DATA")Z",                                                   FN_PTR(isMature)},
1405   {CC"hasCompiledCodeForOSR",                        CC"("HS_RESOLVED_METHOD"II)Z",                                                    FN_PTR(hasCompiledCodeForOSR)},
1406   {CC"getSymbol",                                    CC"(J)"STRING,                                                                    FN_PTR(getSymbol)},
1407   {CC"getNextStackFrame",                            CC"("HS_STACK_FRAME_REF "["RESOLVED_METHOD"I)"HS_STACK_FRAME_REF,                 FN_PTR(getNextStackFrame)},
1408   {CC"materializeVirtualObjects",                    CC"("HS_STACK_FRAME_REF"Z)V",                                                     FN_PTR(materializeVirtualObjects)},
1409   {CC"shouldDebugNonSafepoints",                     CC"()Z",                                                                          FN_PTR(shouldDebugNonSafepoints)},
1410   {CC"writeDebugOutput",                             CC"([BII)V",                                                                      FN_PTR(writeDebugOutput)},
1411   {CC"flushDebugOutput",                             CC"()V",                                                                          FN_PTR(flushDebugOutput)},
1412   {CC"methodDataProfileDataSize",                    CC"(JI)I",                                                                        FN_PTR(methodDataProfileDataSize)},
1413 };
1414 
1415 int CompilerToVM::methods_count() {
1416   return sizeof(methods) / sizeof(JNINativeMethod);
1417 }
1418 


1335 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
1336 
1337 #define STRING                "Ljava/lang/String;"
1338 #define OBJECT                "Ljava/lang/Object;"
1339 #define CLASS                 "Ljava/lang/Class;"
1340 #define STACK_TRACE_ELEMENT   "Ljava/lang/StackTraceElement;"
1341 #define INSTALLED_CODE        "Ljdk/vm/ci/code/InstalledCode;"
1342 #define TARGET_DESCRIPTION    "Ljdk/vm/ci/code/TargetDescription;"
1343 #define RESOLVED_METHOD       "Ljdk/vm/ci/meta/ResolvedJavaMethod;"
1344 #define HS_RESOLVED_METHOD    "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl;"
1345 #define HS_RESOLVED_KLASS     "Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;"
1346 #define HS_CONSTANT_POOL      "Ljdk/vm/ci/hotspot/HotSpotConstantPool;"
1347 #define HS_COMPILED_CODE      "Ljdk/vm/ci/hotspot/HotSpotCompiledCode;"
1348 #define HS_CONFIG             "Ljdk/vm/ci/hotspot/HotSpotVMConfig;"
1349 #define HS_METADATA           "Ljdk/vm/ci/hotspot/HotSpotMetaData;"
1350 #define HS_STACK_FRAME_REF    "Ljdk/vm/ci/hotspot/HotSpotStackFrameReference;"
1351 #define HS_SPECULATION_LOG    "Ljdk/vm/ci/hotspot/HotSpotSpeculationLog;"
1352 #define METASPACE_METHOD_DATA "J"
1353 
1354 JNINativeMethod CompilerToVM::methods[] = {
1355   {CC "getBytecode",                                  CC "(" HS_RESOLVED_METHOD ")[B",                                                       FN_PTR(getBytecode)},
1356   {CC "getExceptionTableStart",                       CC "(" HS_RESOLVED_METHOD ")J",                                                        FN_PTR(getExceptionTableStart)},
1357   {CC "getExceptionTableLength",                      CC "(" HS_RESOLVED_METHOD ")I",                                                        FN_PTR(getExceptionTableLength)},
1358   {CC "findUniqueConcreteMethod",                     CC "(" HS_RESOLVED_KLASS HS_RESOLVED_METHOD ")" HS_RESOLVED_METHOD,                    FN_PTR(findUniqueConcreteMethod)},
1359   {CC "getImplementor",                               CC "(" HS_RESOLVED_KLASS ")" HS_RESOLVED_KLASS,                                        FN_PTR(getImplementor)},
1360   {CC "getStackTraceElement",                         CC "(" HS_RESOLVED_METHOD "I)" STACK_TRACE_ELEMENT,                                    FN_PTR(getStackTraceElement)},
1361   {CC "methodIsIgnoredBySecurityStackWalk",           CC "(" HS_RESOLVED_METHOD ")Z",                                                        FN_PTR(methodIsIgnoredBySecurityStackWalk)},
1362   {CC "doNotInlineOrCompile",                         CC "(" HS_RESOLVED_METHOD ")V",                                                        FN_PTR(doNotInlineOrCompile)},
1363   {CC "canInlineMethod",                              CC "(" HS_RESOLVED_METHOD ")Z",                                                        FN_PTR(canInlineMethod)},
1364   {CC "shouldInlineMethod",                           CC "(" HS_RESOLVED_METHOD ")Z",                                                        FN_PTR(shouldInlineMethod)},
1365   {CC "lookupType",                                   CC "(" STRING CLASS "Z)" HS_RESOLVED_KLASS,                                            FN_PTR(lookupType)},
1366   {CC "lookupNameInPool",                             CC "(" HS_CONSTANT_POOL "I)" STRING,                                                   FN_PTR(lookupNameInPool)},
1367   {CC "lookupNameAndTypeRefIndexInPool",              CC "(" HS_CONSTANT_POOL "I)I",                                                         FN_PTR(lookupNameAndTypeRefIndexInPool)},
1368   {CC "lookupSignatureInPool",                        CC "(" HS_CONSTANT_POOL "I)" STRING,                                                   FN_PTR(lookupSignatureInPool)},
1369   {CC "lookupKlassRefIndexInPool",                    CC "(" HS_CONSTANT_POOL "I)I",                                                         FN_PTR(lookupKlassRefIndexInPool)},
1370   {CC "lookupKlassInPool",                            CC "(" HS_CONSTANT_POOL "I)Ljava/lang/Object;",                                        FN_PTR(lookupKlassInPool)},
1371   {CC "lookupAppendixInPool",                         CC "(" HS_CONSTANT_POOL "I)" OBJECT,                                                   FN_PTR(lookupAppendixInPool)},
1372   {CC "lookupMethodInPool",                           CC "(" HS_CONSTANT_POOL "IB)" HS_RESOLVED_METHOD,                                      FN_PTR(lookupMethodInPool)},
1373   {CC "constantPoolRemapInstructionOperandFromCache", CC "(" HS_CONSTANT_POOL "I)I",                                                         FN_PTR(constantPoolRemapInstructionOperandFromCache)},
1374   {CC "resolveConstantInPool",                        CC "(" HS_CONSTANT_POOL "I)" OBJECT,                                                   FN_PTR(resolveConstantInPool)},
1375   {CC "resolvePossiblyCachedConstantInPool",          CC "(" HS_CONSTANT_POOL "I)" OBJECT,                                                   FN_PTR(resolvePossiblyCachedConstantInPool)},
1376   {CC "resolveTypeInPool",                            CC "(" HS_CONSTANT_POOL "I)" HS_RESOLVED_KLASS,                                        FN_PTR(resolveTypeInPool)},
1377   {CC "resolveFieldInPool",                           CC "(" HS_CONSTANT_POOL "IB[J)" HS_RESOLVED_KLASS,                                     FN_PTR(resolveFieldInPool)},
1378   {CC "resolveInvokeDynamicInPool",                   CC "(" HS_CONSTANT_POOL "I)V",                                                         FN_PTR(resolveInvokeDynamicInPool)},
1379   {CC "resolveInvokeHandleInPool",                    CC "(" HS_CONSTANT_POOL "I)V",                                                         FN_PTR(resolveInvokeHandleInPool)},
1380   {CC "resolveMethod",                                CC "(" HS_RESOLVED_KLASS HS_RESOLVED_METHOD HS_RESOLVED_KLASS ")" HS_RESOLVED_METHOD,  FN_PTR(resolveMethod)},
1381   {CC "getVtableIndexForInterfaceMethod",             CC "(" HS_RESOLVED_KLASS HS_RESOLVED_METHOD ")I",                                      FN_PTR(getVtableIndexForInterfaceMethod)},
1382   {CC "getClassInitializer",                          CC "(" HS_RESOLVED_KLASS ")" HS_RESOLVED_METHOD,                                       FN_PTR(getClassInitializer)},
1383   {CC "hasFinalizableSubclass",                       CC "(" HS_RESOLVED_KLASS ")Z",                                                         FN_PTR(hasFinalizableSubclass)},
1384   {CC "getMaxCallTargetOffset",                       CC "(J)J",                                                                             FN_PTR(getMaxCallTargetOffset)},
1385   {CC "getResolvedJavaMethodAtSlot",                  CC "(" CLASS "I)" HS_RESOLVED_METHOD,                                                  FN_PTR(getResolvedJavaMethodAtSlot)},
1386   {CC "getResolvedJavaMethod",                        CC "(Ljava/lang/Object;J)" HS_RESOLVED_METHOD,                                         FN_PTR(getResolvedJavaMethod)},
1387   {CC "getConstantPool",                              CC "(Ljava/lang/Object;J)" HS_CONSTANT_POOL,                                           FN_PTR(getConstantPool)},
1388   {CC "getResolvedJavaType",                          CC "(Ljava/lang/Object;JZ)" HS_RESOLVED_KLASS,                                         FN_PTR(getResolvedJavaType)},
1389   {CC "initializeConfiguration",                      CC "(" HS_CONFIG ")J",                                                                 FN_PTR(initializeConfiguration)},
1390   {CC "installCode",                                  CC "(" TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE HS_SPECULATION_LOG ")I",     FN_PTR(installCode)},
1391   {CC "getMetadata",                                  CC "(" TARGET_DESCRIPTION HS_COMPILED_CODE HS_METADATA ")I",                           FN_PTR(getMetadata)},
1392   {CC "notifyCompilationStatistics",                  CC "(I" HS_RESOLVED_METHOD "ZIJJ" INSTALLED_CODE ")V",                                 FN_PTR(notifyCompilationStatistics)},
1393   {CC "resetCompilationStatistics",                   CC "()V",                                                                              FN_PTR(resetCompilationStatistics)},
1394   {CC "disassembleCodeBlob",                          CC "(" INSTALLED_CODE ")" STRING,                                                      FN_PTR(disassembleCodeBlob)},
1395   {CC "executeInstalledCode",                         CC "([" OBJECT INSTALLED_CODE ")" OBJECT,                                              FN_PTR(executeInstalledCode)},
1396   {CC "getLineNumberTable",                           CC "(" HS_RESOLVED_METHOD ")[J",                                                       FN_PTR(getLineNumberTable)},
1397   {CC "getLocalVariableTableStart",                   CC "(" HS_RESOLVED_METHOD ")J",                                                        FN_PTR(getLocalVariableTableStart)},
1398   {CC "getLocalVariableTableLength",                  CC "(" HS_RESOLVED_METHOD ")I",                                                        FN_PTR(getLocalVariableTableLength)},
1399   {CC "reprofile",                                    CC "(" HS_RESOLVED_METHOD ")V",                                                        FN_PTR(reprofile)},
1400   {CC "invalidateInstalledCode",                      CC "(" INSTALLED_CODE ")V",                                                            FN_PTR(invalidateInstalledCode)},
1401   {CC "readUncompressedOop",                          CC "(J)" OBJECT,                                                                       FN_PTR(readUncompressedOop)},
1402   {CC "collectCounters",                              CC "()[J",                                                                             FN_PTR(collectCounters)},
1403   {CC "allocateCompileId",                            CC "(" HS_RESOLVED_METHOD "I)I",                                                       FN_PTR(allocateCompileId)},
1404   {CC "isMature",                                     CC "(" METASPACE_METHOD_DATA ")Z",                                                     FN_PTR(isMature)},
1405   {CC "hasCompiledCodeForOSR",                        CC "(" HS_RESOLVED_METHOD "II)Z",                                                      FN_PTR(hasCompiledCodeForOSR)},
1406   {CC "getSymbol",                                    CC "(J)" STRING,                                                                       FN_PTR(getSymbol)},
1407   {CC "getNextStackFrame",                            CC "(" HS_STACK_FRAME_REF "[" RESOLVED_METHOD "I)" HS_STACK_FRAME_REF,                 FN_PTR(getNextStackFrame)},
1408   {CC "materializeVirtualObjects",                    CC "(" HS_STACK_FRAME_REF "Z)V",                                                       FN_PTR(materializeVirtualObjects)},
1409   {CC "shouldDebugNonSafepoints",                     CC "()Z",                                                                              FN_PTR(shouldDebugNonSafepoints)},
1410   {CC "writeDebugOutput",                             CC "([BII)V",                                                                          FN_PTR(writeDebugOutput)},
1411   {CC "flushDebugOutput",                             CC "()V",                                                                              FN_PTR(flushDebugOutput)},
1412   {CC "methodDataProfileDataSize",                    CC "(JI)I",                                                                            FN_PTR(methodDataProfileDataSize)},
1413 };
1414 
1415 int CompilerToVM::methods_count() {
1416   return sizeof(methods) / sizeof(JNINativeMethod);
1417 }

< prev index next >