public class CompilerToVMImpl extends Object implements CompilerToVM
Constructor and Description |
---|
CompilerToVMImpl() |
Modifier and Type | Method and Description |
---|---|
int |
allocateCompileId(long metaspaceMethod,
int entryBCI)
Generate a unique id to identify the result of the compile.
|
boolean |
canInlineMethod(long metaspaceMethod)
Determines if a given metaspace Method can be inlined.
|
long[] |
collectCounters()
Collects the current values of all JVMCI benchmark counters, summed up over all threads.
|
long |
constantPoolKlassAt(long metaspaceConstantPool,
int cpi) |
int |
constantPoolRemapInstructionOperandFromCache(long metaspaceConstantPool,
int cpi) |
private int |
constantPoolRemapInstructionOperandFromCache0(long metaspaceConstantPool,
int cpi) |
String |
disassembleCodeBlob(long codeBlob) |
void |
doNotInlineOrCompile(long metaspaceMethod) |
int |
exceptionTableLength(long metaspaceMethod) |
long |
exceptionTableStart(long metaspaceMethod) |
Object |
executeCompiledMethod(Object arg1,
Object arg2,
Object arg3,
InstalledCode hotspotInstalledCode) |
Object |
executeCompiledMethodVarargs(Object[] args,
InstalledCode hotspotInstalledCode) |
long |
findUniqueConcreteMethod(long actualHolderMetaspaceKlass,
long metaspaceMethod)
Used to implement
ResolvedJavaType.findUniqueConcreteMethod(ResolvedJavaMethod) . |
void |
flushDebugOutput() |
byte[] |
getBytecode(long metaspaceMethod)
Copies the original bytecode of a given method into a new byte array and returns it.
|
long |
getClassInitializer(long metaspaceKlass) |
String |
getFileName(HotSpotResolvedJavaType method) |
String |
getGPUs()
Gets the names of the supported GPU architectures.
|
Class<?> |
getJavaMirror(long metaspaceKlass) |
long |
getKlassImplementor(long metaspaceKlass)
Returns the implementor for the given interface class, if there is a single implementor.
|
long[] |
getLineNumberTable(long metaspaceMethod) |
int |
getLocalVariableTableLength(long metaspaceMethod) |
long |
getLocalVariableTableStart(long metaspaceMethod) |
long |
getMaxCallTargetOffset(long address) |
long |
getMetaspaceMethod(Class<?> holder,
int slot)
Gets the metaspace Method object corresponding to a given
Class object and slot
number. |
HotSpotStackFrameReference |
getNextStackFrame(HotSpotStackFrameReference frame,
long[] methods,
int initialSkip)
Looks for the next Java stack frame with the given method.
|
StackTraceElement |
getStackTraceElement(long metaspaceMethod,
int bci) |
String |
getSymbol(long metaspaceSymbol)
Gets the value of a metaspace
Symbol as a String. |
private String |
getSymbol0(long metaspaceSymbol) |
long |
getTimeStamp()
Fetch the time stamp used for printing inside hotspot.
|
int |
getVtableIndexForInterface(long metaspaceKlass,
long metaspaceMethod) |
boolean |
hasBalancedMonitors(long metaspaceMethod)
Determines if a given metaspace Method object has balanced monitors.
|
boolean |
hasCompiledCodeForOSR(long metaspaceMethod,
int entryBCI,
int level) |
boolean |
hasFinalizableSubclass(long metaspaceKlass) |
private static void |
init()
Initializes the native part of the JVMCI runtime.
|
void |
initializeConfiguration(HotSpotVMConfig config) |
int |
installCode(HotSpotCompiledCode compiledCode,
InstalledCode code,
SpeculationLog speculationLog)
Installs the result of a compilation into the code cache.
|
void |
invalidateInstalledCode(InstalledCode hotspotInstalledCode) |
boolean |
isMature(long method) |
Object |
lookupAppendixInPool(long metaspaceConstantPool,
int cpi) |
private Object |
lookupAppendixInPool0(long metaspaceConstantPool,
int cpi) |
long |
lookupKlassInPool(long metaspaceConstantPool,
int cpi)
Looks up a class entry in a constant pool.
|
int |
lookupKlassRefIndexInPool(long metaspaceConstantPool,
int cpi) |
private int |
lookupKlassRefIndexInPool0(long metaspaceConstantPool,
int cpi) |
long |
lookupMethodInPool(long metaspaceConstantPool,
int cpi,
byte opcode)
Looks up a method entry in a constant pool.
|
int |
lookupNameAndTypeRefIndexInPool(long metaspaceConstantPool,
int cpi) |
String |
lookupNameRefInPool(long metaspaceConstantPool,
int cpi) |
private String |
lookupNameRefInPool0(long metaspaceConstantPool,
int cpi) |
String |
lookupSignatureRefInPool(long metaspaceConstantPool,
int cpi) |
private String |
lookupSignatureRefInPool0(long metaspaceConstantPool,
int cpi) |
long |
lookupType(String name,
Class<?> accessingClass,
boolean eagerResolve)
Converts a name to a metaspace klass.
|
void |
materializeVirtualObjects(HotSpotStackFrameReference stackFrame,
boolean invalidate)
Materialized all virtual objects within the given stack frame and update the locals within
the given stackFrame object.
|
boolean |
methodIsIgnoredBySecurityStackWalk(long metaspaceMethod)
Determines if a given metaspace method is ignored by security stack walks.
|
void |
notifyCompilationStatistics(int id,
HotSpotResolvedJavaMethod method,
boolean osr,
int processedBytecodes,
long time,
long timeUnitsPerSecond,
InstalledCode installedCode)
Notifies the VM of statistics for a completed compilation.
|
Object |
readUncompressedOop(long address)
Reads an object pointer within a VM data structure.
|
long |
readUnsafeKlassPointer(Object o) |
void |
reprofile(long metaspaceMethod)
Invalidates the profiling information and restarts profiling upon the next invocation.
|
void |
resetCompilationStatistics() |
Object |
resolveConstantInPool(long metaspaceConstantPool,
int cpi) |
long |
resolveField(long metaspaceConstantPool,
int cpi,
byte opcode,
long[] info)
Looks up a field entry in a constant pool and attempts to resolve it.
|
void |
resolveInvokeDynamic(long metaspaceConstantPool,
int index) |
void |
resolveInvokeHandle(long metaspaceConstantPool,
int index) |
long |
resolveMethod(long metaspaceKlassExactReceiver,
long metaspaceMethod,
long metaspaceKlassCaller) |
Object |
resolvePossiblyCachedConstantInPool(long metaspaceConstantPool,
int cpi) |
private Object |
resolvePossiblyCachedConstantInPool0(long metaspaceConstantPool,
int cpi) |
boolean |
shouldDebugNonSafepoints() |
boolean |
shouldInlineMethod(long metaspaceMethod)
Determines if a given metaspace Method should be inlined at any cost.
|
void |
writeDebugOutput(byte[] bytes,
int offset,
int length) |
public CompilerToVMImpl()
private static void init()
public int installCode(HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog)
CompilerToVM
installCode
in interface CompilerToVM
compiledCode
- the result of a compilationcode
- the details of the installed CodeBlob are written to this objectHotSpotVMConfig.codeInstallResultOk
,
HotSpotVMConfig.codeInstallResultCacheFull
,
HotSpotVMConfig.codeInstallResultCodeTooLarge
,
HotSpotVMConfig.codeInstallResultDependenciesFailed
or
HotSpotVMConfig.codeInstallResultDependenciesInvalid
.public long getMetaspaceMethod(Class<?> holder, int slot)
CompilerToVM
Class
object and slot
number.getMetaspaceMethod
in interface CompilerToVM
holder
- method holderslot
- slot number of the methodpublic byte[] getBytecode(long metaspaceMethod)
CompilerToVM
getBytecode
in interface CompilerToVM
metaspaceMethod
- the metaspace Method objectpublic int exceptionTableLength(long metaspaceMethod)
exceptionTableLength
in interface CompilerToVM
public long exceptionTableStart(long metaspaceMethod)
exceptionTableStart
in interface CompilerToVM
public boolean hasBalancedMonitors(long metaspaceMethod)
CompilerToVM
hasBalancedMonitors
in interface CompilerToVM
metaspaceMethod
- the metaspace Method object to querypublic long findUniqueConcreteMethod(long actualHolderMetaspaceKlass, long metaspaceMethod)
CompilerToVM
ResolvedJavaType.findUniqueConcreteMethod(ResolvedJavaMethod)
.findUniqueConcreteMethod
in interface CompilerToVM
actualHolderMetaspaceKlass
- the best known type of receivermetaspaceMethod
- the metaspace Method on which to based the searchmetaspaceMethod
public long getKlassImplementor(long metaspaceKlass)
CompilerToVM
getKlassImplementor
in interface CompilerToVM
metaspaceKlass
- the metaspace klass to get the implementor formetaspaceKlass
) itself if there is more than one implementor.public long lookupType(String name, Class<?> accessingClass, boolean eagerResolve)
CompilerToVM
lookupType
in interface CompilerToVM
name
- a well formed Java type in internal formataccessingClass
- the context of resolution (must not be null)eagerResolve
- force resolution to a ResolvedJavaType
. If true, this method will
either return a ResolvedJavaType
or throw an exceptionname
public Object resolveConstantInPool(long metaspaceConstantPool, int cpi)
resolveConstantInPool
in interface CompilerToVM
public Object resolvePossiblyCachedConstantInPool(long metaspaceConstantPool, int cpi)
resolvePossiblyCachedConstantInPool
in interface CompilerToVM
private Object resolvePossiblyCachedConstantInPool0(long metaspaceConstantPool, int cpi)
public int lookupNameAndTypeRefIndexInPool(long metaspaceConstantPool, int cpi)
lookupNameAndTypeRefIndexInPool
in interface CompilerToVM
public String lookupNameRefInPool(long metaspaceConstantPool, int cpi)
lookupNameRefInPool
in interface CompilerToVM
private String lookupNameRefInPool0(long metaspaceConstantPool, int cpi)
public String lookupSignatureRefInPool(long metaspaceConstantPool, int cpi)
lookupSignatureRefInPool
in interface CompilerToVM
private String lookupSignatureRefInPool0(long metaspaceConstantPool, int cpi)
public int lookupKlassRefIndexInPool(long metaspaceConstantPool, int cpi)
lookupKlassRefIndexInPool
in interface CompilerToVM
private int lookupKlassRefIndexInPool0(long metaspaceConstantPool, int cpi)
public long constantPoolKlassAt(long metaspaceConstantPool, int cpi)
constantPoolKlassAt
in interface CompilerToVM
public long lookupKlassInPool(long metaspaceConstantPool, int cpi)
CompilerToVM
lookupKlassInPool
in interface CompilerToVM
metaspaceConstantPool
- metaspace constant pool pointercpi
- constant pool indexpublic long lookupMethodInPool(long metaspaceConstantPool, int cpi, byte opcode)
CompilerToVM
lookupMethodInPool
in interface CompilerToVM
metaspaceConstantPool
- metaspace constant pool pointercpi
- constant pool indexpublic long resolveField(long metaspaceConstantPool, int cpi, byte opcode, long[] info)
CompilerToVM
info
are:
[(int) flags, // only valid if field is resolved (int) offset] // only valid if field is resolved
resolveField
in interface CompilerToVM
metaspaceConstantPool
- metaspace constant pool pointercpi
- constant pool indexinfo
- an array in which the details of the field are returnedpublic int constantPoolRemapInstructionOperandFromCache(long metaspaceConstantPool, int cpi)
constantPoolRemapInstructionOperandFromCache
in interface CompilerToVM
private int constantPoolRemapInstructionOperandFromCache0(long metaspaceConstantPool, int cpi)
public Object lookupAppendixInPool(long metaspaceConstantPool, int cpi)
lookupAppendixInPool
in interface CompilerToVM
private Object lookupAppendixInPool0(long metaspaceConstantPool, int cpi)
public void initializeConfiguration(HotSpotVMConfig config)
initializeConfiguration
in interface CompilerToVM
public long resolveMethod(long metaspaceKlassExactReceiver, long metaspaceMethod, long metaspaceKlassCaller)
resolveMethod
in interface CompilerToVM
public boolean hasFinalizableSubclass(long metaspaceKlass)
hasFinalizableSubclass
in interface CompilerToVM
public boolean methodIsIgnoredBySecurityStackWalk(long metaspaceMethod)
CompilerToVM
methodIsIgnoredBySecurityStackWalk
in interface CompilerToVM
metaspaceMethod
- the metaspace Method objectpublic long getClassInitializer(long metaspaceKlass)
getClassInitializer
in interface CompilerToVM
public long getMaxCallTargetOffset(long address)
getMaxCallTargetOffset
in interface CompilerToVM
public String disassembleCodeBlob(long codeBlob)
disassembleCodeBlob
in interface CompilerToVM
public StackTraceElement getStackTraceElement(long metaspaceMethod, int bci)
getStackTraceElement
in interface CompilerToVM
public Object executeCompiledMethodVarargs(Object[] args, InstalledCode hotspotInstalledCode)
executeCompiledMethodVarargs
in interface CompilerToVM
public long[] getLineNumberTable(long metaspaceMethod)
getLineNumberTable
in interface CompilerToVM
public long getLocalVariableTableStart(long metaspaceMethod)
getLocalVariableTableStart
in interface CompilerToVM
public int getLocalVariableTableLength(long metaspaceMethod)
getLocalVariableTableLength
in interface CompilerToVM
public String getFileName(HotSpotResolvedJavaType method)
getFileName
in interface CompilerToVM
public void reprofile(long metaspaceMethod)
CompilerToVM
reprofile
in interface CompilerToVM
metaspaceMethod
- the metaspace Method objectpublic void invalidateInstalledCode(InstalledCode hotspotInstalledCode)
invalidateInstalledCode
in interface CompilerToVM
public Class<?> getJavaMirror(long metaspaceKlass)
getJavaMirror
in interface CompilerToVM
public long readUnsafeKlassPointer(Object o)
readUnsafeKlassPointer
in interface CompilerToVM
public Object readUncompressedOop(long address)
CompilerToVM
HotSpotVMField
whose
type
is "oop"
(e.g.,
ArrayKlass::_component_mirror
, Klass::_java_mirror
,
JavaThread::_threadObj
).
Note that Unsafe.getObject(Object, long)
cannot be used for this since it does a
narrowOop
read if the VM is using compressed oops whereas oops within VM data
structures are (currently) always uncompressed.readUncompressedOop
in interface CompilerToVM
address
- address of an oop field within a VM data structurepublic void doNotInlineOrCompile(long metaspaceMethod)
doNotInlineOrCompile
in interface CompilerToVM
public Object executeCompiledMethod(Object arg1, Object arg2, Object arg3, InstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException
executeCompiledMethod
in interface CompilerToVM
InvalidInstalledCodeException
public void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond, InstalledCode installedCode)
CompilerToVM
notifyCompilationStatistics
in interface CompilerToVM
id
- the identifier of the compilationmethod
- the method compiledosr
- specifies if the compilation was for on-stack-replacementprocessedBytecodes
- the number of bytecodes processed during the compilation, including
the bytecodes of all inlined methodstime
- the amount time spent compiling method
timeUnitsPerSecond
- the granularity of the units for the time
valueinstalledCode
- the nmethod installed as a result of the compilationpublic void resetCompilationStatistics()
resetCompilationStatistics
in interface CompilerToVM
public long[] collectCounters()
CompilerToVM
collectCounters
in interface CompilerToVM
public boolean isMature(long method)
isMature
in interface CompilerToVM
public int allocateCompileId(long metaspaceMethod, int entryBCI)
CompilerToVM
allocateCompileId
in interface CompilerToVM
public String getGPUs()
CompilerToVM
getGPUs
in interface CompilerToVM
public boolean canInlineMethod(long metaspaceMethod)
CompilerToVM
canInlineMethod
in interface CompilerToVM
metaspaceMethod
- the metaspace Method object to querypublic boolean shouldInlineMethod(long metaspaceMethod)
CompilerToVM
shouldInlineMethod
in interface CompilerToVM
metaspaceMethod
- the metaspace Method object to querypublic boolean hasCompiledCodeForOSR(long metaspaceMethod, int entryBCI, int level)
hasCompiledCodeForOSR
in interface CompilerToVM
metaspaceMethod
- the method to checklevel
- the compilation levelmetaspaceMethod
has code for level
public HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, long[] methods, int initialSkip)
CompilerToVM
getNextStackFrame
in interface CompilerToVM
frame
- the starting point of the search, where null
refers to the topmost framemethods
- the metaspace methods to look for, where null
means that any frame is
returnednull
if the end of the stack was reached during the searchpublic void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate)
CompilerToVM
materializeVirtualObjects
in interface CompilerToVM
invalidate
- if true
, the compiled method for the stack frame will be
invalidated.public long getTimeStamp()
CompilerToVM
getTimeStamp
in interface CompilerToVM
public String getSymbol(long metaspaceSymbol)
CompilerToVM
Symbol
as a String.getSymbol
in interface CompilerToVM
private String getSymbol0(long metaspaceSymbol)
public void resolveInvokeDynamic(long metaspaceConstantPool, int index)
resolveInvokeDynamic
in interface CompilerToVM
public void resolveInvokeHandle(long metaspaceConstantPool, int index)
resolveInvokeHandle
in interface CompilerToVM
public int getVtableIndexForInterface(long metaspaceKlass, long metaspaceMethod)
getVtableIndexForInterface
in interface CompilerToVM
public boolean shouldDebugNonSafepoints()
shouldDebugNonSafepoints
in interface CompilerToVM
public void writeDebugOutput(byte[] bytes, int offset, int length)
writeDebugOutput
in interface CompilerToVM
public void flushDebugOutput()
flushDebugOutput
in interface CompilerToVM