public class CompilationResult extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CompilationResult.Call
Represents a call in the code.
|
static class |
CompilationResult.CodeAnnotation
Provides extra information about instructions or data at specific positions in
getTargetCode() . |
static class |
CompilationResult.CodeComment
A string comment about one or more instructions at a specific position in the code.
|
static class |
CompilationResult.ConstantReference |
static class |
CompilationResult.DataPatch
Represents a code site that references some data.
|
static class |
CompilationResult.DataSectionReference |
static class |
CompilationResult.ExceptionHandler
Represents exception handler information for a specific code position.
|
static class |
CompilationResult.Infopoint
Represents an infopoint with associated debug info.
|
static class |
CompilationResult.JumpTable
Describes a table of signed offsets embedded in the code.
|
static class |
CompilationResult.Mark
Represents a mark in the machine code that can be used by the runtime for its own purposes.
|
static class |
CompilationResult.Reference
Represents some external data that is referenced by the code.
|
static class |
CompilationResult.Site
Represents a code position with associated additional information.
|
Modifier and Type | Field and Description |
---|---|
private ArrayList<CompilationResult.CodeAnnotation> |
annotations |
private Assumptions.Assumption[] |
assumptions |
private int |
bytecodeSize |
private int |
customStackAreaOffset |
private List<CompilationResult.DataPatch> |
dataPatches |
private DataSection |
dataSection |
private int |
entryBCI |
private List<CompilationResult.ExceptionHandler> |
exceptionHandlers |
private boolean |
hasUnsafeAccess |
private int |
id |
private List<CompilationResult.Infopoint> |
infopoints |
private List<CompilationResult.Mark> |
marks |
private ResolvedJavaMethod[] |
methods
The list of the methods whose bytecodes were used as input to the compilation.
|
private String |
name |
private byte[] |
targetCode
The buffer containing the emitted machine code.
|
private int |
targetCodeSize
The leading number of bytes in
targetCode containing the emitted machine code. |
private int |
totalFrameSize |
Constructor and Description |
---|
CompilationResult() |
CompilationResult(String name) |
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(CompilationResult.CodeAnnotation annotation) |
void |
addInfopoint(CompilationResult.Infopoint infopoint)
Records a custom infopoint in the code section.
|
private static void |
appendDebugInfo(StringBuilder sb,
DebugInfo info) |
boolean |
equals(Object obj) |
List<CompilationResult.CodeAnnotation> |
getAnnotations() |
Assumptions.Assumption[] |
getAssumptions()
Gets the assumptions made during compilation.
|
int |
getBytecodeSize() |
int |
getCustomStackAreaOffset()
Offset in bytes for the custom stack area (relative to sp).
|
List<CompilationResult.DataPatch> |
getDataPatches() |
DataSection |
getDataSection() |
int |
getEntryBCI() |
private CompilationResult.ExceptionHandler |
getExceptionHandlerForCodePos(int codePos)
Returns the first ExceptionHandler which matches codePos.
|
List<CompilationResult.ExceptionHandler> |
getExceptionHandlers() |
int |
getId() |
List<CompilationResult.Infopoint> |
getInfopoints() |
List<CompilationResult.Mark> |
getMarks() |
ResolvedJavaMethod[] |
getMethods()
Gets the methods whose bytecodes were used as input to the compilation.
|
String |
getName() |
byte[] |
getTargetCode() |
int |
getTargetCodeSize() |
int |
getTotalFrameSize()
The total frame size of the method in bytes.
|
int |
hashCode() |
boolean |
hasUnsafeAccess() |
void |
recordCall(int codePos,
int size,
InvokeTarget target,
DebugInfo debugInfo,
boolean direct)
Records a call in the code array.
|
void |
recordDataPatch(int codePos,
CompilationResult.Reference ref)
Records a data patch in the code section.
|
void |
recordExceptionHandler(int codePos,
int handlerPos)
Records an exception handler for this method.
|
void |
recordInfopoint(int codePos,
DebugInfo debugInfo,
InfopointReason reason)
Records an infopoint in the code array.
|
CompilationResult.Mark |
recordMark(int codePos,
Object markId)
Records an instruction mark within this method.
|
void |
reset() |
void |
setAssumptions(Assumptions.Assumption[] assumptions)
Sets the assumptions made during compilation.
|
void |
setBytecodeSize(int bytecodeSize) |
void |
setCustomStackAreaOffset(int offset) |
void |
setEntryBCI(int entryBCI) |
void |
setHasUnsafeAccess(boolean hasUnsafeAccess) |
void |
setId(int id) |
void |
setMethods(ResolvedJavaMethod rootMethod,
Collection<ResolvedJavaMethod> inlinedMethods)
Sets the methods whose bytecodes were used as input to the compilation.
|
void |
setTargetCode(byte[] code,
int size)
Sets the machine that has been generated by the compiler.
|
void |
setTotalFrameSize(int size)
Sets the total frame size in bytes.
|
String |
toString() |
private boolean |
validateExceptionHandlerAdd(int codePos,
int handlerPos)
Validate if the exception handler for codePos already exists and handlerPos is different.
|
private int id
private int entryBCI
private final DataSection dataSection
private final List<CompilationResult.Infopoint> infopoints
private final List<CompilationResult.DataPatch> dataPatches
private final List<CompilationResult.ExceptionHandler> exceptionHandlers
private final List<CompilationResult.Mark> marks
private int totalFrameSize
private int customStackAreaOffset
private byte[] targetCode
private int targetCodeSize
targetCode
containing the emitted machine code.private ArrayList<CompilationResult.CodeAnnotation> annotations
private Assumptions.Assumption[] assumptions
private ResolvedJavaMethod[] methods
null
, then the compilation did not record method dependencies. Otherwise, the first
element of this array is the root method of the compilation.private int bytecodeSize
private boolean hasUnsafeAccess
public CompilationResult()
public CompilationResult(String name)
public int getId()
public void setId(int id)
id
- the compile id to setpublic int getEntryBCI()
public void setEntryBCI(int entryBCI)
entryBCI
- the entryBCI to setpublic void setAssumptions(Assumptions.Assumption[] assumptions)
public Assumptions.Assumption[] getAssumptions()
public void setMethods(ResolvedJavaMethod rootMethod, Collection<ResolvedJavaMethod> inlinedMethods)
rootMethod
- the root method of the compilationinlinedMethods
- the methods inlined during compilationpublic ResolvedJavaMethod[] getMethods()
null
if the compilation did not record method dependencies otherwise the
methods whose bytecodes were used as input to the compilation with the first element
being the root method of the compilationpublic void setBytecodeSize(int bytecodeSize)
public int getBytecodeSize()
public DataSection getDataSection()
public int getTotalFrameSize()
public void setTotalFrameSize(int size)
size
- the size of the frame in bytespublic void setTargetCode(byte[] code, int size)
code
- the machine code generatedsize
- the size of the machine codepublic void recordDataPatch(int codePos, CompilationResult.Reference ref)
data section
or directly to an inlined
constant
.codePos
- The position in the code that needs to be patched.ref
- The reference that should be inserted in the code.public void recordCall(int codePos, int size, InvokeTarget target, DebugInfo debugInfo, boolean direct)
codePos
- the position of the call in the code arraysize
- the size of the call instructiontarget
- the being calleddebugInfo
- the debug info for the calldirect
- specifies if this is a direct callpublic void recordExceptionHandler(int codePos, int handlerPos)
codePos
- the position in the code that is covered by the handlerhandlerPos
- the position of the handlerprivate boolean validateExceptionHandlerAdd(int codePos, int handlerPos)
codePos
- handlerPos
- private CompilationResult.ExceptionHandler getExceptionHandlerForCodePos(int codePos)
codePos
- position to search forpublic void recordInfopoint(int codePos, DebugInfo debugInfo, InfopointReason reason)
codePos
- the position of the infopoint in the code arraydebugInfo
- the debug info for the infopointpublic void addInfopoint(CompilationResult.Infopoint infopoint)
recordCall(int, int, jdk.internal.jvmci.meta.InvokeTarget, jdk.internal.jvmci.code.DebugInfo, boolean)
.infopoint
- the infopoint to record, usually a derived class from CompilationResult.Infopoint
public CompilationResult.Mark recordMark(int codePos, Object markId)
codePos
- the position in the code that is covered by the handlermarkId
- the identifier for this markpublic int getCustomStackAreaOffset()
public void setCustomStackAreaOffset(int offset)
offset
- getCustomStackAreaOffset()
public byte[] getTargetCode()
public int getTargetCodeSize()
public List<CompilationResult.CodeAnnotation> getAnnotations()
null
if there are nonepublic void addAnnotation(CompilationResult.CodeAnnotation annotation)
private static void appendDebugInfo(StringBuilder sb, DebugInfo info)
public List<CompilationResult.Infopoint> getInfopoints()
CompilationResult.Site.pcOffset
public List<CompilationResult.DataPatch> getDataPatches()
public List<CompilationResult.ExceptionHandler> getExceptionHandlers()
public List<CompilationResult.Mark> getMarks()
public void setHasUnsafeAccess(boolean hasUnsafeAccess)
public boolean hasUnsafeAccess()
public void reset()