Top Description Fields Constructors Methods
jdk.vm.ci.hotspot

public Class HotSpotNmethod

extends HotSpotInstalledCode
Class Inheritance
Static Imports
jdk.vm.ci.hotspot.CompilerToVM.compilerToVM, jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE

Implementation of InstalledCode for code installed as an nmethod. The address of the nmethod is stored in InstalledCode#address and the value of nmethod::verified_entry_point() is in InstalledCode#entryPoint.

Field Summary

Modifier and TypeField and Description
private final long
compileIdSnapshot

If this field is 0, this object is in the oops table of the nmethod.

private final boolean
isDefault

Specifies whether the nmethod associated with this object is the code executed by default HotSpot linkage when a normal Java call to method is made.

private final HotSpotResolvedJavaMethodImpl
method

This (indirect) Method* reference is safe since class redefinition preserves all methods associated with nmethods in the code cache.

private HotSpotSpeculationLog
speculationLog

The speculation log containing speculations embedded in the nmethod.

Constructor Summary

AccessConstructor and Description
pack-priv
HotSpotNmethod(HotSpotResolvedJavaMethodImpl method, String name, boolean isDefault, long compileId)

Method Summary

Modifier and TypeMethod and Description
private boolean
checkArgs(Object... args)

public Object
executeVarargs(Object...
the array of object arguments
args
)

Overrides jdk.vm.ci.code.InstalledCode.executeVarargs.

Executes the installed code with a variable number of arguments.

public long
public long
public ResolvedJavaMethod
public long
getStart()

Overrides jdk.vm.ci.hotspot.HotSpotInstalledCode.getStart.

Gets the value of CodeBlob::code_begin() if valid, 0 otherwise.

pack-priv boolean
inOopsTable()

Determines whether this object is in the oops table of the nmethod.

public void
invalidate(boolean
if true, all existing invocations will be immediately deoptimized. If false, any existing invocation will continue until it completes or there is a subsequent call to this method with deoptimize == true before the invocation completes.
deoptimize
)

Overrides jdk.vm.ci.code.InstalledCode.invalidate.

Invalidates this installed code such that any subsequent invocation will throw an InvalidInstalledCodeException.

public boolean
isDefault()

Determines if the nmethod associated with this object is the compiled entry point for getMethod().

public boolean
public void
setSpeculationLog(HotSpotSpeculationLog log)

Attaches log to this object.

public String
toString()

Implements abstract jdk.vm.ci.hotspot.HotSpotInstalledCode.toString.

Returns a string representation of the object.

Inherited from jdk.vm.ci.hotspot.HotSpotInstalledCode:
getCodegetCodeSizegetSize

Field Detail

compileIdSnapshotback to summary
private final long compileIdSnapshot

If this field is 0, this object is in the oops table of the nmethod. Otherwise, the value of the field records the nmethod's compile identifier. This value is used to confirm if an entry in the code cache retrieved by address is indeed the nmethod represented by this object.

See Also
inOopsTable
isDefaultback to summary
private final boolean isDefault

Specifies whether the nmethod associated with this object is the code executed by default HotSpot linkage when a normal Java call to method is made. That is, does this.method.metadataHandle->_code == this.address. If not, then the nmethod can only be invoked via a reference to this object. An example of this is the trampoline mechanism used by Truffle: https://goo.gl/LX88rZ.

methodback to summary
private final HotSpotResolvedJavaMethodImpl method

This (indirect) Method* reference is safe since class redefinition preserves all methods associated with nmethods in the code cache.

speculationLogback to summary
private HotSpotSpeculationLog speculationLog

The speculation log containing speculations embedded in the nmethod. If speculationLog.managesFailedSpeculations() == true, this field ensures the failed speculation list lives at least as long as this object. This prevents deoptimization from appending to an already freed list.

Annotations
@SuppressWarnings:unused

Constructor Detail

HotSpotNmethodback to summary
pack-priv HotSpotNmethod(HotSpotResolvedJavaMethodImpl method, String name, boolean isDefault, long compileId)

Method Detail

checkArgsback to summary
private boolean checkArgs(Object... args)
executeVarargsback to summary
public Object executeVarargs(Object... args) throws InvalidInstalledCodeException

Overrides jdk.vm.ci.code.InstalledCode.executeVarargs.

Doc from jdk.vm.ci.code.InstalledCode.executeVarargs.

Executes the installed code with a variable number of arguments. It's possible for the HotSpot runtime to sweep nmethods at any point in time. As a result, there is no guarantee that calling this method will execute the wrapped nmethod. Instead, it may end up executing the bytecode of the associated Java method. Only if isValid() is true after returning can the caller be sure that the nmethod was executed. If isValid() is false, then the only way to determine if the nmethod was executed is to test for some side-effect specific to the nmethod (e.g., update to a field) that is not performed by the bytecode of the associated Java method.

Parameters
args:Object[]

the array of object arguments

Returns:Object

the value returned by the executed code

Annotations
@Override
getAddressback to summary
public long getAddress()

Overrides jdk.vm.ci.code.InstalledCode.getAddress.

Returns:long

Doc from jdk.vm.ci.code.InstalledCode.getAddress.

the address of entity (e.g., HotSpot nmethod or RuntimeStub) representing this installed code

Annotations
@Override
getEntryPointback to summary
public long getEntryPoint()

Overrides jdk.vm.ci.code.InstalledCode.getEntryPoint.

Returns:long

Doc from jdk.vm.ci.code.InstalledCode.getEntryPoint.

the address of the normal entry point of the installed code.

Annotations
@Override
getMethodback to summary
public ResolvedJavaMethod getMethod()
getStartback to summary
public long getStart()

Overrides jdk.vm.ci.hotspot.HotSpotInstalledCode.getStart.

Doc from jdk.vm.ci.hotspot.HotSpotInstalledCode.getStart.

Gets the value of CodeBlob::code_begin() if valid, 0 otherwise.

Annotations
@Override
inOopsTableback to summary
pack-priv boolean inOopsTable()

Determines whether this object is in the oops table of the nmethod.

If this object is in the oops table, the VM uses the oops table entry to update this object's address and entryPoint fields when the state of the nmethod changes. The nmethod will be unloadable when this object dies.

Otherwise, the nmethod's unloadability is not changed when this object dies.

invalidateback to summary
public void invalidate(boolean deoptimize)

Overrides jdk.vm.ci.code.InstalledCode.invalidate.

Doc from jdk.vm.ci.code.InstalledCode.invalidate.

Invalidates this installed code such that any subsequent invocation will throw an InvalidInstalledCodeException. If this installed code is already invalid, this method has no effect. A subsequent call to isAlive() or isValid() on this object will return false.

Parameters
deoptimize:boolean

if true, all existing invocations will be immediately deoptimized. If false, any existing invocation will continue until it completes or there is a subsequent call to this method with deoptimize == true before the invocation completes.

Annotations
@Override
isDefaultback to summary
public boolean isDefault()

Determines if the nmethod associated with this object is the compiled entry point for getMethod().

isValidback to summary
public boolean isValid()

Overrides jdk.vm.ci.code.InstalledCode.isValid.

Returns:boolean

Doc from jdk.vm.ci.code.InstalledCode.isValid.

true if the code represented by this object is still valid for invocation, false otherwise (may happen due to deopt, etc.)

Annotations
@Override
setSpeculationLogback to summary
public void setSpeculationLog(HotSpotSpeculationLog log)

Attaches log to this object. If log.managesFailedSpeculations() == true, this ensures the failed speculation list lives at least as long as this object.

toStringback to summary
public String toString()

Implements abstract jdk.vm.ci.hotspot.HotSpotInstalledCode.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override