public class BytecodeParser extends Object implements GraphBuilderContext
GraphBuilder
class parses the bytecode of a method and builds the IR graph.Modifier and Type | Class and Description |
---|---|
static class |
BytecodeParser.BytecodeParserError |
private static class |
BytecodeParser.ExplodedLoopContext |
(package private) static class |
BytecodeParser.IntrinsicScope
A scoped object for tasks to be performed after parsing an intrinsic such as processing
placeholder frames states.
|
(package private) class |
BytecodeParser.InvocationPluginAssertions
Contains all the assertion checking logic around the application of an
InvocationPlugin . |
static class |
BytecodeParser.Options |
(package private) static class |
BytecodeParser.SuccessorInfo |
private static class |
BytecodeParser.Target |
Modifier | Constructor and Description |
---|---|
protected |
BytecodeParser(GraphBuilderPhase.Instance graphBuilderInstance,
StructuredGraph graph,
BytecodeParser parent,
ResolvedJavaMethod method,
int entryBCI,
IntrinsicContext intrinsicContext) |
Modifier and Type | Method and Description |
---|---|
private void |
addLoopExits(LoopBeginNode loopBegin,
LoopBeginNode inner,
IdentityHashMap<LoopBeginNode,List<LoopBeginNode>> innerLoopsMap,
NodeBitMap visited) |
private void |
addToMergeCache(FrameStateBuilder key,
int dimension) |
private static boolean |
allPositive(double[] a) |
<T extends ValueNode> |
append(T v)
Raw operation for adding a node to the graph when neither
GraphBuilderContext.add(T) nor
GraphBuilderContext.addPush(Kind, ValueNode) can be used. |
protected ConstantNode |
appendConstant(JavaConstant constant) |
private void |
appendGoto(BciBlockMapping.BciBlock successor) |
private void |
appendInvoke(CallTargetNode.InvokeKind initialInvokeKind,
ResolvedJavaMethod initialTargetMethod,
ValueNode[] args) |
private LoopBeginNode |
appendLoopBegin(FixedWithNextNode fixedWithNext) |
private ValueNode |
appendNullCheck(ValueNode object) |
private static Class<?> |
arrayTypeCodeToClass(int code)
Gets the kind of array elements for the array type code that appears in a
Bytecodes.NEWARRAY bytecode. |
protected BytecodeParser.BytecodeParserError |
asParserError(Throwable e) |
private boolean |
assertAtIfBytecode() |
private static boolean |
assertionsEnabled() |
BailoutException |
bailout(String string) |
int |
bci()
Gets the index of the bytecode instruction currently being parsed.
|
private void |
beforeReturn(ValueNode x,
Kind kind) |
protected double |
branchProbability() |
protected void |
build(FixedWithNextNode startInstruction,
FrameStateBuilder startFrameState) |
protected void |
buildRootMethod() |
private static boolean |
callTargetIsResolved(JavaMethod target)
Ensure that concrete classes are at least linked before generating an invoke.
|
protected boolean |
checkLastInstruction() |
private BytecodeParser.Target |
checkLoopExit(FixedNode target,
BciBlockMapping.BciBlock targetBlock,
FrameStateBuilder state) |
private int |
checkPositiveIntConstantPushed(BciBlockMapping.BciBlock block) |
protected void |
cleanupFinalGraph() |
private boolean |
computeKindVerification(FrameStateBuilder startFrameState) |
private AbstractBeginNode |
createBlockTarget(double probability,
BciBlockMapping.BciBlock block,
FrameStateBuilder stateAfter)
Returns a block begin node with the specified state.
|
private BytecodePosition |
createBytecodePosition() |
protected ValueNode |
createCheckCast(ResolvedJavaType type,
ValueNode object,
JavaTypeProfile profileForTypeCheck,
boolean forStoreCheck) |
private void |
createExceptionDispatch(BciBlockMapping.ExceptionDispatchBlock block) |
private FrameState |
createFrameState(int bci,
StateSplit forStateSplit) |
protected ValueNode |
createInstanceOf(ResolvedJavaType type,
ValueNode object,
JavaTypeProfile profileForTypeCheck) |
protected InvokeNode |
createInvoke(CallTargetNode callTarget,
Kind resultType) |
protected InvokeWithExceptionNode |
createInvokeWithException(CallTargetNode callTarget,
Kind resultType) |
private LogicNode |
createLogicNode(Condition cond,
ValueNode a,
ValueNode b) |
protected MethodCallTargetNode |
createMethodCallTarget(CallTargetNode.InvokeKind invokeKind,
ResolvedJavaMethod targetMethod,
ValueNode[] args,
JavaType returnType,
JavaTypeProfile profile) |
protected NewArrayNode |
createNewArray(ResolvedJavaType elementType,
ValueNode length,
boolean fillContents) |
protected NewInstanceNode |
createNewInstance(ResolvedJavaType type,
boolean fillContents) |
protected NewMultiArrayNode |
createNewMultiArray(ResolvedJavaType type,
List<ValueNode> dimensions) |
private FrameState |
createStateAfterStartOfReplacementGraph()
Creates the frame state after the start node of a graph for an
intrinsic that is the parse root (either for root compiling or for post-parse inlining). |
private FixedNode |
createTarget(BciBlockMapping.BciBlock block,
FrameStateBuilder state) |
private FixedNode |
createTarget(BciBlockMapping.BciBlock block,
FrameStateBuilder state,
boolean canReuseInstruction,
boolean canReuseState) |
private FixedNode |
createTarget(double probability,
BciBlockMapping.BciBlock block,
FrameStateBuilder stateAfter) |
private void |
createUnwind() |
private void |
detectLoops(FixedNode startInstruction) |
protected void |
emitExplicitBoundsCheck(ValueNode index,
ValueNode length) |
protected ValueNode |
emitExplicitExceptions(ValueNode receiver,
ValueNode index) |
protected ValueNode |
emitExplicitNullCheck(ValueNode receiver) |
private int |
findOperatingDimension(BciBlockMapping.BciBlock block,
FrameStateBuilder state) |
private int |
findOperatingDimensionWithLoopExplosion(BciBlockMapping.BciBlock block,
FrameStateBuilder state) |
protected FixedWithNextNode |
finishInstruction(FixedWithNextNode instr,
FrameStateBuilder state)
Hook for subclasses to modify the last instruction or add other instructions.
|
protected void |
finishPrepare(FixedWithNextNode startInstr)
Hook for subclasses to modify the graph start instruction or append new instructions to it.
|
protected boolean |
forceLoopPhis() |
protected ValueNode |
genAnd(ValueNode x,
ValueNode y) |
private void |
genArithmeticOp(Kind kind,
int opcode) |
private void |
genArrayLength() |
protected ValueNode |
genArrayLength(ValueNode x) |
private void |
genCheckCast() |
private void |
genCompareOp(Kind kind,
boolean isUnorderedLess) |
protected ValueNode |
genConditional(ValueNode x) |
private void |
genConditionalForIf(BciBlockMapping.BciBlock trueBlock,
LogicNode condition,
int oldBci,
int trueBlockInt,
int falseBlockInt,
boolean genReturn) |
private void |
genConstantTargetIf(BciBlockMapping.BciBlock trueBlock,
BciBlockMapping.BciBlock falseBlock,
boolean negate,
LogicNode condition) |
protected ValueNode |
genFloatAdd(ValueNode x,
ValueNode y) |
private void |
genFloatConvert(FloatConvert op,
Kind from,
Kind to) |
protected ValueNode |
genFloatConvert(FloatConvert op,
ValueNode input) |
protected ValueNode |
genFloatDiv(ValueNode x,
ValueNode y) |
protected ValueNode |
genFloatMul(ValueNode x,
ValueNode y) |
protected ValueNode |
genFloatRem(ValueNode x,
ValueNode y) |
protected ValueNode |
genFloatSub(ValueNode x,
ValueNode y) |
private void |
genGetField(JavaField field) |
private void |
genGetStatic(JavaField field) |
protected void |
genGoto() |
protected void |
genIf(ValueNode x,
Condition cond,
ValueNode y) |
protected ValueNode |
genIfNode(LogicNode condition,
FixedNode falseSuccessor,
FixedNode trueSuccessor,
double d) |
private void |
genIfNull(Condition cond) |
private void |
genIfSame(Kind kind,
Condition cond) |
private void |
genIfZero(Condition cond) |
private void |
genIncrement() |
private void |
genInfoPointNode(InfopointReason reason,
ValueNode escapedReturnValue) |
private void |
genInstanceOf() |
protected ValueNode |
genIntegerAdd(ValueNode x,
ValueNode y) |
protected ValueNode |
genIntegerDiv(ValueNode x,
ValueNode y) |
private void |
genIntegerDivOp(Kind kind,
int opcode) |
protected LogicNode |
genIntegerEquals(ValueNode x,
ValueNode y) |
protected LogicNode |
genIntegerLessThan(ValueNode x,
ValueNode y) |
protected ValueNode |
genIntegerMul(ValueNode x,
ValueNode y) |
protected ValueNode |
genIntegerRem(ValueNode x,
ValueNode y) |
protected ValueNode |
genIntegerSub(ValueNode x,
ValueNode y) |
protected void |
genIntegerSwitch(ValueNode value,
ArrayList<BciBlockMapping.BciBlock> actualSuccessors,
int[] keys,
double[] keyProbabilities,
int[] keySuccessors) |
protected void |
genInvokeDynamic(JavaMethod target) |
protected void |
genInvokeInterface(JavaMethod target) |
protected void |
genInvokeSpecial(JavaMethod target) |
protected void |
genInvokeStatic(JavaMethod target) |
protected void |
genInvokeVirtual(JavaMethod target) |
protected void |
genJsr(int dest) |
protected ValueNode |
genLeftShift(ValueNode x,
ValueNode y) |
private void |
genLoadConstant(int cpi,
int opcode) |
protected ValueNode |
genLoadField(ValueNode receiver,
ResolvedJavaField field) |
private void |
genLoadIndexed(Kind kind) |
protected ValueNode |
genLoadIndexed(ValueNode array,
ValueNode index,
Kind kind) |
private void |
genLogicOp(Kind kind,
int opcode) |
protected void |
genMonitorEnter(ValueNode x,
int bci) |
protected void |
genMonitorExit(ValueNode x,
ValueNode escapedReturnValue,
int bci) |
private void |
genNarrow(Kind from,
Kind to) |
protected ValueNode |
genNarrow(ValueNode input,
int bitCount) |
private void |
genNegateOp(Kind kind) |
protected ValueNode |
genNegateOp(ValueNode x) |
(package private) void |
genNewInstance(int cpi) |
private void |
genNewMultiArray(int cpi) |
private void |
genNewObjectArray(int cpi) |
private void |
genNewPrimitiveArray(int typeCode) |
protected ValueNode |
genNormalizeCompare(ValueNode x,
ValueNode y,
boolean isUnorderedLess) |
protected LogicNode |
genObjectEquals(ValueNode x,
ValueNode y) |
protected ValueNode |
genOr(ValueNode x,
ValueNode y) |
private void |
genPutField(JavaField field) |
private void |
genPutStatic(JavaField field) |
protected void |
genRet(int localIndex) |
protected void |
genReturn(ValueNode returnVal,
Kind returnKind) |
protected ValueNode |
genRightShift(ValueNode x,
ValueNode y) |
private void |
genShiftOp(Kind kind,
int opcode) |
private void |
genSignExtend(Kind from,
Kind to) |
protected ValueNode |
genSignExtend(ValueNode input,
int bitCount) |
protected void |
genStoreField(ValueNode receiver,
ResolvedJavaField field,
ValueNode value) |
private void |
genStoreIndexed(Kind kind) |
protected void |
genStoreIndexed(ValueNode array,
ValueNode index,
Kind kind,
ValueNode value) |
private void |
genSwitch(BytecodeSwitch bs) |
protected void |
genThrow() |
protected ValueNode |
genUnique(ValueNode x) |
protected ValueNode |
genUnsignedRightShift(ValueNode x,
ValueNode y) |
protected ValueNode |
genXor(ValueNode x,
ValueNode y) |
private void |
genZeroExtend(Kind from,
Kind to) |
protected ValueNode |
genZeroExtend(ValueNode input,
int bitCount) |
FixedWithNextNode |
getBeforeReturnNode() |
FixedWithNextNode |
getBeforeUnwindNode() |
ConstantReflectionProvider |
getConstantReflection() |
private int |
getCurrentDimension() |
private FrameStateBuilder |
getEntryState(BciBlockMapping.BciBlock block,
int dimension) |
private FrameStateBuilder |
getEntryStateMultiDimension(int dimension,
int id) |
private FixedWithNextNode |
getFirstInstruction(BciBlockMapping.BciBlock block,
int dimension) |
private FixedWithNextNode |
getFirstInstructionMultiDimension(int dimension,
int id) |
FrameStateBuilder |
getFrameStateBuilder() |
StructuredGraph |
getGraph()
Gets the graph being processed by this builder.
|
IntrinsicContext |
getIntrinsic()
Gets the intrinsic of the current parsing context or
null if not
parsing an intrinsic . |
CallTargetNode.InvokeKind |
getInvokeKind()
Gets the kind of invocation currently being parsed.
|
JavaType |
getInvokeReturnType()
Gets the return type of the invocation currently being parsed.
|
private ConstantNode |
getJsrConstant(long bci) |
MetaAccessProvider |
getMetaAccess() |
ResolvedJavaMethod |
getMethod()
Gets the method being parsed by this context.
|
BytecodeParser |
getNonIntrinsicAncestor()
Gets the first ancestor parsing context that is not parsing a
intrinsic.
|
BytecodeParser |
getParent()
Gets the parsing context for the method that inlines the method being parsed by this context.
|
private JavaTypeProfile |
getProfileForTypeCheck(ResolvedJavaType type) |
ValueNode |
getReturnValue() |
StampProvider |
getStampProvider() |
protected BytecodeStream |
getStream() |
ValueNode |
getUnwindValue() |
private boolean |
gotoOrFallThroughAfterConstant(BciBlockMapping.BciBlock block) |
private DispatchBeginNode |
handleException(ValueNode exceptionObject,
int bci) |
void |
handleReplacedInvoke(CallTargetNode.InvokeKind invokeKind,
ResolvedJavaMethod targetMethod,
ValueNode[] args,
boolean inlineEverything)
Handles an invocation that a plugin determines can replace the original invocation (i.e., the
one for which the plugin was applied).
|
private void |
handleReturnBlock() |
protected void |
handleUnresolvedCheckCast(JavaType type,
ValueNode object) |
protected void |
handleUnresolvedExceptionType(JavaType type) |
protected void |
handleUnresolvedInstanceOf(JavaType type,
ValueNode object) |
protected void |
handleUnresolvedInvoke(JavaMethod javaMethod,
CallTargetNode.InvokeKind invokeKind) |
protected void |
handleUnresolvedLoadConstant(JavaType type) |
protected void |
handleUnresolvedLoadField(JavaField field,
ValueNode receiver) |
protected void |
handleUnresolvedNewInstance(JavaType type) |
protected void |
handleUnresolvedNewMultiArray(JavaType type,
List<ValueNode> dims) |
protected void |
handleUnresolvedNewObjectArray(JavaType type,
ValueNode length) |
protected void |
handleUnresolvedStoreField(JavaField field,
ValueNode value,
ValueNode receiver) |
private void |
handleUnwindBlock() |
private boolean |
inline(ResolvedJavaMethod targetMethod,
ResolvedJavaMethod inlinedMethod,
boolean isIntrinsic,
ValueNode[] args) |
private void |
insertLoopEnds(FixedNode startInstruction) |
private void |
insertLoopExits(LoopBeginNode loopBegin,
IdentityHashMap<LoopBeginNode,List<LoopBeginNode>> innerLoopsMap) |
void |
intrinsify(ResolvedJavaMethod targetMethod,
ResolvedJavaMethod substitute,
ValueNode[] args)
Intrinsifies an invocation of a given method by inlining the bytecodes of a given
substitution method.
|
protected boolean |
isNeverExecutedCode(double probability) |
private int |
iterateBlock(BciBlockMapping.BciBlock[] blocks,
BciBlockMapping.BciBlock block) |
protected void |
iterateBytecodesForBlock(BciBlockMapping.BciBlock block) |
private int |
iterateExplodedLoopHeader(BciBlockMapping.BciBlock[] blocks,
BciBlockMapping.BciBlock header) |
void |
loadLocal(int index,
Kind kind) |
private Object |
lookupConstant(int cpi,
int opcode) |
private JavaField |
lookupField(int cpi,
int opcode) |
private JavaMethod |
lookupMethod(int cpi,
int opcode) |
protected JavaType |
lookupType(int cpi,
int bytecode) |
private void |
maybeEagerlyResolve(int cpi,
int bytecode) |
(package private) static String |
nSpaces(int n) |
private void |
parseAndInlineCallee(ResolvedJavaMethod targetMethod,
ValueNode[] args,
IntrinsicContext calleeIntrinsicContext) |
boolean |
parsingIntrinsic()
Determines if this parsing context is within the bytecode of an intrinsic or a method inlined
by an intrinsic.
|
private void |
peelIteration(BciBlockMapping.BciBlock[] blocks,
BciBlockMapping.BciBlock header,
BytecodeParser.ExplodedLoopContext context) |
protected void |
processBlock(BytecodeParser parser,
BciBlockMapping.BciBlock block) |
void |
processBytecode(int bci,
int opcode) |
void |
push(Kind slotKind,
ValueNode value)
Pushes a given value to the frame state stack using an explicit kind.
|
protected void |
reanchorGuardedNodes(BeginNode beginNode)
Removes
GuardedNode s from beginNode 's usages and re-attaches them to an
appropriate preceeding GuardingNode . |
<T extends ValueNode> |
recursiveAppend(T v)
Adds the given node to the graph and also adds recursively all referenced inputs.
|
private boolean |
returnAfterConstant(BciBlockMapping.BciBlock block) |
void |
setCurrentFrameState(FrameStateBuilder frameState) |
private void |
setEntryState(BciBlockMapping.BciBlock block,
int dimension,
FrameStateBuilder entryState) |
private void |
setEntryStateMultiDimension(int dimension,
FrameStateBuilder entryState,
int id) |
private void |
setFirstInstruction(BciBlockMapping.BciBlock block,
int dimension,
FixedWithNextNode firstInstruction) |
private void |
setFirstInstructionMultiDimension(int dimension,
FixedWithNextNode firstInstruction,
int id) |
private void |
setMergeStateAfter(BciBlockMapping.BciBlock block,
FixedWithNextNode firstInstruction) |
void |
setStateAfter(StateSplit sideEffect)
Creates a snap shot of the current frame state with the BCI of the instruction after the one
currently being parsed and assigns it to a given side
effect node.
|
void |
storeLocal(Kind kind,
int index) |
private static double[] |
successorProbabilites(int successorCount,
int[] keySuccessors,
double[] keyProbabilities)
Helper function that sums up the probabilities of all keys that lead to a specific successor.
|
private double[] |
switchProbability(int numberOfCases,
int bci) |
private void |
synchronizedEpilogue(int bci,
ValueNode currentReturnValue,
Kind currentReturnValueKind) |
private ValueNode |
synchronizedObject(FrameStateBuilder state,
ResolvedJavaMethod target) |
String |
toString() |
protected boolean |
traceInstruction(int bci,
int opcode,
boolean blockStart) |
private void |
traceInstructionHelper(int bci,
int opcode,
boolean blockStart) |
private boolean |
traceState() |
protected void |
traceWithContext(String format,
Object... args)
Prints a line to
TTY with a prefix indicating the current parse context. |
private boolean |
tryGenConditionalForIf(BciBlockMapping.BciBlock trueBlock,
BciBlockMapping.BciBlock falseBlock,
LogicNode condition,
int oldBci,
int trueBlockInt,
int falseBlockInt) |
private boolean |
tryInline(ValueNode[] args,
ResolvedJavaMethod targetMethod,
JavaType returnType) |
private boolean |
tryInvocationPlugin(ValueNode[] args,
ResolvedJavaMethod targetMethod,
Kind resultType) |
private boolean |
tryNodePluginForInvocation(ValueNode[] args,
ResolvedJavaMethod targetMethod) |
private <T extends ValueNode> |
updateLastInstruction(T v) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add, addPush, getAssumptions, getDepth, getInvokeReturnStamp, nullCheckedValue
public static final int TRACELEVEL_INSTRUCTIONS
BytecodeParser.Options.TraceBytecodeParserLevel
must be set to trace the
bytecode instructions as they are parsed.public static final int TRACELEVEL_STATE
BytecodeParser.Options.TraceBytecodeParserLevel
must be set to trace the
frame state before each bytecode instruction as it is parsed.public static final DebugMetric BytecodesParsed
protected static final DebugMetric EXPLICIT_EXCEPTIONS
private final GraphBuilderPhase.Instance graphBuilderInstance
protected final StructuredGraph graph
private BciBlockMapping blockMap
private LocalLiveness liveness
protected final int entryBCI
private final BytecodeParser parent
private LineNumberTable lnt
private int previousLineNumber
private int currentLineNumber
private ValueNode methodSynchronizedObject
private ValueNode returnValue
private FixedWithNextNode beforeReturnNode
private ValueNode unwindValue
private FixedWithNextNode beforeUnwindNode
private FixedWithNextNode lastInstr
private final boolean explodeLoops
private final boolean mergeExplosions
private final Map<FrameStateBuilder,Integer> mergeExplosionsMap
private Deque<BytecodeParser.ExplodedLoopContext> explodeLoopsContext
private int nextPeelIteration
private boolean controlFlowSplit
private final InvocationPlugins.InvocationPluginReceiver invocationPluginReceiver
private FixedWithNextNode[] firstInstructionArray
private FrameStateBuilder[] entryStateArray
private FixedWithNextNode[][] firstInstructionMatrix
private FrameStateBuilder[][] entryStateMatrix
private CallTargetNode.InvokeKind currentInvokeKind
private JavaType currentInvokeReturnType
protected FrameStateBuilder frameState
protected BciBlockMapping.BciBlock currentBlock
protected final BytecodeStream stream
protected final GraphBuilderConfiguration graphBuilderConfig
protected final ResolvedJavaMethod method
protected final ProfilingInfo profilingInfo
protected final OptimisticOptimizations optimisticOpts
protected final ConstantPool constantPool
protected final MetaAccessProvider metaAccess
private final ConstantReflectionProvider constantReflection
private final StampProvider stampProvider
protected final IntrinsicContext intrinsicContext
private boolean forceInliningEverything
InlineInvokePlugin.InlineInfo lastInlineInfo
protected BytecodeParser(GraphBuilderPhase.Instance graphBuilderInstance, StructuredGraph graph, BytecodeParser parent, ResolvedJavaMethod method, int entryBCI, IntrinsicContext intrinsicContext)
public ValueNode getReturnValue()
public FixedWithNextNode getBeforeReturnNode()
public ValueNode getUnwindValue()
public FixedWithNextNode getBeforeUnwindNode()
protected void buildRootMethod()
protected void build(FixedWithNextNode startInstruction, FrameStateBuilder startFrameState)
private boolean computeKindVerification(FrameStateBuilder startFrameState)
protected void finishPrepare(FixedWithNextNode startInstr)
startInstr
- the start instruction of the graphprotected void cleanupFinalGraph()
protected void reanchorGuardedNodes(BeginNode beginNode)
GuardedNode
s from beginNode
's usages and re-attaches them to an
appropriate preceeding GuardingNode
.private FrameState createStateAfterStartOfReplacementGraph()
intrinsic
that is the parse root (either for root compiling or for post-parse inlining).private void detectLoops(FixedNode startInstruction)
private void insertLoopEnds(FixedNode startInstruction)
private void insertLoopExits(LoopBeginNode loopBegin, IdentityHashMap<LoopBeginNode,List<LoopBeginNode>> innerLoopsMap)
private void addLoopExits(LoopBeginNode loopBegin, LoopBeginNode inner, IdentityHashMap<LoopBeginNode,List<LoopBeginNode>> innerLoopsMap, NodeBitMap visited)
private int iterateBlock(BciBlockMapping.BciBlock[] blocks, BciBlockMapping.BciBlock block)
private int iterateExplodedLoopHeader(BciBlockMapping.BciBlock[] blocks, BciBlockMapping.BciBlock header)
private void addToMergeCache(FrameStateBuilder key, int dimension)
private void peelIteration(BciBlockMapping.BciBlock[] blocks, BciBlockMapping.BciBlock header, BytecodeParser.ExplodedLoopContext context)
protected void handleUnresolvedLoadConstant(JavaType type)
type
- the unresolved type of the constantprotected void handleUnresolvedCheckCast(JavaType type, ValueNode object)
type
- the unresolved type of the type checkobject
- the object value whose type is being checked against type
protected void handleUnresolvedInstanceOf(JavaType type, ValueNode object)
type
- the unresolved type of the type checkobject
- the object value whose type is being checked against type
protected void handleUnresolvedNewInstance(JavaType type)
type
- the type being instantiatedprotected void handleUnresolvedNewObjectArray(JavaType type, ValueNode length)
type
- the type of the array being instantiatedlength
- the length of the arrayprotected void handleUnresolvedNewMultiArray(JavaType type, List<ValueNode> dims)
type
- the type being instantiateddims
- the dimensions for the multi-arrayprotected void handleUnresolvedLoadField(JavaField field, ValueNode receiver)
field
- the unresolved fieldreceiver
- the object containing the field or null
if field
is staticprotected void handleUnresolvedStoreField(JavaField field, ValueNode value, ValueNode receiver)
field
- the unresolved fieldvalue
- the value being stored to the fieldreceiver
- the object containing the field or null
if field
is staticprotected void handleUnresolvedExceptionType(JavaType type)
type
- protected void handleUnresolvedInvoke(JavaMethod javaMethod, CallTargetNode.InvokeKind invokeKind)
javaMethod
- invokeKind
- private DispatchBeginNode handleException(ValueNode exceptionObject, int bci)
protected ValueNode genLoadIndexed(ValueNode array, ValueNode index, Kind kind)
protected void genStoreIndexed(ValueNode array, ValueNode index, Kind kind, ValueNode value)
protected ValueNode genIntegerAdd(ValueNode x, ValueNode y)
protected ValueNode genIntegerSub(ValueNode x, ValueNode y)
protected ValueNode genIntegerMul(ValueNode x, ValueNode y)
protected ValueNode genFloatAdd(ValueNode x, ValueNode y)
protected ValueNode genFloatSub(ValueNode x, ValueNode y)
protected ValueNode genFloatMul(ValueNode x, ValueNode y)
protected ValueNode genFloatDiv(ValueNode x, ValueNode y)
protected ValueNode genFloatRem(ValueNode x, ValueNode y)
protected ValueNode genIntegerDiv(ValueNode x, ValueNode y)
protected ValueNode genIntegerRem(ValueNode x, ValueNode y)
protected ValueNode genNegateOp(ValueNode x)
protected ValueNode genLeftShift(ValueNode x, ValueNode y)
protected ValueNode genRightShift(ValueNode x, ValueNode y)
protected ValueNode genUnsignedRightShift(ValueNode x, ValueNode y)
protected ValueNode genNormalizeCompare(ValueNode x, ValueNode y, boolean isUnorderedLess)
protected ValueNode genFloatConvert(FloatConvert op, ValueNode input)
protected ValueNode genSignExtend(ValueNode input, int bitCount)
protected ValueNode genZeroExtend(ValueNode input, int bitCount)
protected void genGoto()
protected LogicNode genObjectEquals(ValueNode x, ValueNode y)
protected LogicNode genIntegerEquals(ValueNode x, ValueNode y)
protected LogicNode genIntegerLessThan(ValueNode x, ValueNode y)
protected ValueNode genIfNode(LogicNode condition, FixedNode falseSuccessor, FixedNode trueSuccessor, double d)
protected void genThrow()
protected ValueNode createCheckCast(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck, boolean forStoreCheck)
protected ValueNode createInstanceOf(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck)
protected ValueNode genConditional(ValueNode x)
protected NewInstanceNode createNewInstance(ResolvedJavaType type, boolean fillContents)
protected NewArrayNode createNewArray(ResolvedJavaType elementType, ValueNode length, boolean fillContents)
protected NewMultiArrayNode createNewMultiArray(ResolvedJavaType type, List<ValueNode> dimensions)
protected ValueNode genLoadField(ValueNode receiver, ResolvedJavaField field)
protected ValueNode emitExplicitNullCheck(ValueNode receiver)
protected void emitExplicitBoundsCheck(ValueNode index, ValueNode length)
protected ValueNode genArrayLength(ValueNode x)
protected void genStoreField(ValueNode receiver, ResolvedJavaField field, ValueNode value)
private static boolean callTargetIsResolved(JavaMethod target)
target
- protected void genInvokeStatic(JavaMethod target)
protected void genInvokeInterface(JavaMethod target)
protected void genInvokeDynamic(JavaMethod target)
protected void genInvokeVirtual(JavaMethod target)
protected void genInvokeSpecial(JavaMethod target)
public CallTargetNode.InvokeKind getInvokeKind()
GraphBuilderContext
getInvokeKind
in interface GraphBuilderContext
public JavaType getInvokeReturnType()
GraphBuilderContext
getInvokeReturnType
in interface GraphBuilderContext
public void handleReplacedInvoke(CallTargetNode.InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args, boolean inlineEverything)
GraphBuilderContext
handleReplacedInvoke
in interface GraphBuilderContext
invokeKind
- the kind of the replacement invocationtargetMethod
- the target of the replacement invocationargs
- the arguments to the replacement invocationinlineEverything
- specifies if all invocations encountered in the scope of
handling the replaced invoke are to be force inlinedprivate void appendInvoke(CallTargetNode.InvokeKind initialInvokeKind, ResolvedJavaMethod initialTargetMethod, ValueNode[] args)
private boolean tryInvocationPlugin(ValueNode[] args, ResolvedJavaMethod targetMethod, Kind resultType)
private boolean tryNodePluginForInvocation(ValueNode[] args, ResolvedJavaMethod targetMethod)
private boolean tryInline(ValueNode[] args, ResolvedJavaMethod targetMethod, JavaType returnType)
public void intrinsify(ResolvedJavaMethod targetMethod, ResolvedJavaMethod substitute, ValueNode[] args)
GraphBuilderContext
intrinsify
in interface GraphBuilderContext
targetMethod
- the method being intrinsifiedsubstitute
- the intrinsic implementationargs
- the arguments with which to inline the invocationprivate boolean inline(ResolvedJavaMethod targetMethod, ResolvedJavaMethod inlinedMethod, boolean isIntrinsic, ValueNode[] args)
protected void traceWithContext(String format, Object... args)
TTY
with a prefix indicating the current parse context. The prefix
is of the form:
{SPACE * n} {name of method being parsed} "(" {file name} ":" {line number} ")"where
n
is the current inlining depth.format
- a format stringargs
- arguments to the format stringprotected BytecodeParser.BytecodeParserError asParserError(Throwable e)
private void parseAndInlineCallee(ResolvedJavaMethod targetMethod, ValueNode[] args, IntrinsicContext calleeIntrinsicContext)
protected MethodCallTargetNode createMethodCallTarget(CallTargetNode.InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args, JavaType returnType, JavaTypeProfile profile)
protected InvokeNode createInvoke(CallTargetNode callTarget, Kind resultType)
protected InvokeWithExceptionNode createInvokeWithException(CallTargetNode callTarget, Kind resultType)
private void beforeReturn(ValueNode x, Kind kind)
protected void genMonitorEnter(ValueNode x, int bci)
protected void genMonitorExit(ValueNode x, ValueNode escapedReturnValue, int bci)
protected void genJsr(int dest)
protected void genRet(int localIndex)
private ConstantNode getJsrConstant(long bci)
protected void genIntegerSwitch(ValueNode value, ArrayList<BciBlockMapping.BciBlock> actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors)
private static double[] successorProbabilites(int successorCount, int[] keySuccessors, double[] keyProbabilities)
protected ConstantNode appendConstant(JavaConstant constant)
public <T extends ValueNode> T append(T v)
GraphBuilderContext
GraphBuilderContext.add(T)
nor
GraphBuilderContext.addPush(Kind, ValueNode)
can be used.append
in interface GraphBuilderContext
public <T extends ValueNode> T recursiveAppend(T v)
GraphBuilderContext
recursiveAppend
in interface GraphBuilderContext
v
- the node to be added to the graphprivate <T extends ValueNode> void updateLastInstruction(T v)
private BytecodeParser.Target checkLoopExit(FixedNode target, BciBlockMapping.BciBlock targetBlock, FrameStateBuilder state)
private FrameStateBuilder getEntryState(BciBlockMapping.BciBlock block, int dimension)
private FrameStateBuilder getEntryStateMultiDimension(int dimension, int id)
private void setEntryState(BciBlockMapping.BciBlock block, int dimension, FrameStateBuilder entryState)
private void setEntryStateMultiDimension(int dimension, FrameStateBuilder entryState, int id)
private void setFirstInstruction(BciBlockMapping.BciBlock block, int dimension, FixedWithNextNode firstInstruction)
private void setFirstInstructionMultiDimension(int dimension, FixedWithNextNode firstInstruction, int id)
private FixedWithNextNode getFirstInstruction(BciBlockMapping.BciBlock block, int dimension)
private FixedWithNextNode getFirstInstructionMultiDimension(int dimension, int id)
private FixedNode createTarget(double probability, BciBlockMapping.BciBlock block, FrameStateBuilder stateAfter)
private FixedNode createTarget(BciBlockMapping.BciBlock block, FrameStateBuilder state)
private FixedNode createTarget(BciBlockMapping.BciBlock block, FrameStateBuilder state, boolean canReuseInstruction, boolean canReuseState)
private int findOperatingDimension(BciBlockMapping.BciBlock block, FrameStateBuilder state)
private int findOperatingDimensionWithLoopExplosion(BciBlockMapping.BciBlock block, FrameStateBuilder state)
private AbstractBeginNode createBlockTarget(double probability, BciBlockMapping.BciBlock block, FrameStateBuilder stateAfter)
private ValueNode synchronizedObject(FrameStateBuilder state, ResolvedJavaMethod target)
protected void processBlock(BytecodeParser parser, BciBlockMapping.BciBlock block)
private void handleUnwindBlock()
private void handleReturnBlock()
private void setMergeStateAfter(BciBlockMapping.BciBlock block, FixedWithNextNode firstInstruction)
private void createUnwind()
private void synchronizedEpilogue(int bci, ValueNode currentReturnValue, Kind currentReturnValueKind)
private void createExceptionDispatch(BciBlockMapping.ExceptionDispatchBlock block)
private void appendGoto(BciBlockMapping.BciBlock successor)
protected void iterateBytecodesForBlock(BciBlockMapping.BciBlock block)
protected boolean forceLoopPhis()
protected boolean checkLastInstruction()
private LoopBeginNode appendLoopBegin(FixedWithNextNode fixedWithNext)
protected FixedWithNextNode finishInstruction(FixedWithNextNode instr, FrameStateBuilder state)
instr
- The last instruction (= fixed node) which was added.state
- The current frame state.private void genInfoPointNode(InfopointReason reason, ValueNode escapedReturnValue)
private boolean traceState()
private boolean tryGenConditionalForIf(BciBlockMapping.BciBlock trueBlock, BciBlockMapping.BciBlock falseBlock, LogicNode condition, int oldBci, int trueBlockInt, int falseBlockInt)
private void genConditionalForIf(BciBlockMapping.BciBlock trueBlock, LogicNode condition, int oldBci, int trueBlockInt, int falseBlockInt, boolean genReturn)
private LogicNode createLogicNode(Condition cond, ValueNode a, ValueNode b)
private void genConstantTargetIf(BciBlockMapping.BciBlock trueBlock, BciBlockMapping.BciBlock falseBlock, boolean negate, LogicNode condition)
private int checkPositiveIntConstantPushed(BciBlockMapping.BciBlock block)
private boolean gotoOrFallThroughAfterConstant(BciBlockMapping.BciBlock block)
private boolean returnAfterConstant(BciBlockMapping.BciBlock block)
public StampProvider getStampProvider()
getStampProvider
in interface GraphBuilderContext
public MetaAccessProvider getMetaAccess()
getMetaAccess
in interface GraphBuilderContext
public void push(Kind slotKind, ValueNode value)
GraphBuilderContext
value.getKind()
is different from the kind that the bytecode instruction
currently being parsed pushes to the stack.push
in interface GraphBuilderContext
slotKind
- the kind to use when type checking this operationvalue
- the value to push to the stack. The value must already have been
appended.private int getCurrentDimension()
public ConstantReflectionProvider getConstantReflection()
getConstantReflection
in interface GraphBuilderContext
public StructuredGraph getGraph()
getGraph
in interface GraphBuilderContext
public BytecodeParser getParent()
GraphBuilderContext
getParent
in interface GraphBuilderContext
public IntrinsicContext getIntrinsic()
GraphBuilderContext
null
if not
parsing an intrinsic
.getIntrinsic
in interface GraphBuilderContext
public BailoutException bailout(String string)
bailout
in interface GraphBuilderContext
private FrameState createFrameState(int bci, StateSplit forStateSplit)
public void setStateAfter(StateSplit sideEffect)
GraphBuilderContext
setStateAfter
in interface GraphBuilderContext
sideEffect
- a side effect node just appended to the graphprivate BytecodePosition createBytecodePosition()
public void setCurrentFrameState(FrameStateBuilder frameState)
protected final BytecodeStream getStream()
public int bci()
GraphBuilderContext
bci
in interface GraphBuilderContext
public void storeLocal(Kind kind, int index)
private void genLoadConstant(int cpi, int opcode)
private void genLoadIndexed(Kind kind)
private void genStoreIndexed(Kind kind)
private void genArithmeticOp(Kind kind, int opcode)
private void genIntegerDivOp(Kind kind, int opcode)
private void genNegateOp(Kind kind)
private void genShiftOp(Kind kind, int opcode)
private void genLogicOp(Kind kind, int opcode)
private void genCompareOp(Kind kind, boolean isUnorderedLess)
private void genFloatConvert(FloatConvert op, Kind from, Kind to)
private void genSignExtend(Kind from, Kind to)
private void genZeroExtend(Kind from, Kind to)
private void genIncrement()
protected JavaType lookupType(int cpi, int bytecode)
private JavaMethod lookupMethod(int cpi, int opcode)
private JavaField lookupField(int cpi, int opcode)
private Object lookupConstant(int cpi, int opcode)
private void maybeEagerlyResolve(int cpi, int bytecode)
private JavaTypeProfile getProfileForTypeCheck(ResolvedJavaType type)
private void genCheckCast()
private ValueNode appendNullCheck(ValueNode object)
private void genInstanceOf()
void genNewInstance(int cpi)
private static Class<?> arrayTypeCodeToClass(int code)
Bytecodes.NEWARRAY
bytecode.code
- the array type codeprivate void genNewPrimitiveArray(int typeCode)
private void genNewObjectArray(int cpi)
private void genNewMultiArray(int cpi)
private void genGetField(JavaField field)
protected ValueNode emitExplicitExceptions(ValueNode receiver, ValueNode index)
receiver
- the receiver of an object based operationindex
- the index of an array based operation that is to be tested for out of bounds.
This is null for a non-array operation.private void genPutField(JavaField field)
private void genGetStatic(JavaField field)
private void genPutStatic(JavaField field)
private double[] switchProbability(int numberOfCases, int bci)
private static boolean allPositive(double[] a)
private void genSwitch(BytecodeSwitch bs)
protected boolean isNeverExecutedCode(double probability)
protected double branchProbability()
private boolean assertAtIfBytecode()
public final void processBytecode(int bci, int opcode)
private void genArrayLength()
public ResolvedJavaMethod getMethod()
GraphBuilderContext
getMethod
in interface GraphBuilderContext
public FrameStateBuilder getFrameStateBuilder()
protected boolean traceInstruction(int bci, int opcode, boolean blockStart)
private void traceInstructionHelper(int bci, int opcode, boolean blockStart)
public boolean parsingIntrinsic()
GraphBuilderContext
parsingIntrinsic
in interface GraphBuilderContext
public BytecodeParser getNonIntrinsicAncestor()
GraphBuilderContext
getNonIntrinsicAncestor
in interface GraphBuilderContext
private static boolean assertionsEnabled()