Mercurial > hg > graal-compiler
changeset 13496:a245e3585ad4
Make invoke node creation overrideable by subclasses
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Fri, 03 Jan 2014 11:50:39 -0800 |
parents | 818d2885db2f |
children | 55987bbeec42 |
files | graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java |
diffstat | 1 files changed, 26 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Fri Jan 03 11:48:36 2014 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Fri Jan 03 11:50:39 2014 -0800 @@ -1203,33 +1203,39 @@ } } MethodCallTargetNode callTarget = currentGraph.add(createMethodCallTarget(invokeKind, targetMethod, args, returnType)); - createInvokeNode(callTarget, resultType); + + // be conservative if information was not recorded (could result in endless recompiles + // otherwise) + if (graphBuilderConfig.omitAllExceptionEdges() || (optimisticOpts.useExceptionProbability() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE)) { + createInvoke(callTarget, resultType); + } else { + assert bci() == currentBlock.endBci; + frameState.clearNonLiveLocals(currentBlock.localsLiveOut); + + InvokeWithExceptionNode invoke = createInvokeWithException(callTarget, resultType); + + Block nextBlock = currentBlock.successors.get(0); + invoke.setNext(createTarget(nextBlock, frameState)); + } } protected MethodCallTargetNode createMethodCallTarget(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args, JavaType returnType) { return new MethodCallTargetNode(invokeKind, targetMethod, args, returnType); } - protected Invoke createInvokeNode(CallTargetNode callTarget, Kind resultType) { - // be conservative if information was not recorded (could result in endless recompiles - // otherwise) - if (graphBuilderConfig.omitAllExceptionEdges() || (optimisticOpts.useExceptionProbability() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE)) { - InvokeNode invoke = new InvokeNode(callTarget, bci()); - frameState.pushReturn(resultType, append(invoke)); - return invoke; - } else { - assert bci() == currentBlock.endBci; - frameState.clearNonLiveLocals(currentBlock.localsLiveOut); + protected InvokeNode createInvoke(CallTargetNode callTarget, Kind resultType) { + InvokeNode invoke = append(new InvokeNode(callTarget, bci())); + frameState.pushReturn(resultType, invoke); + return invoke; + } - DispatchBeginNode exceptionEdge = handleException(null, bci()); - InvokeWithExceptionNode invoke = append(new InvokeWithExceptionNode(callTarget, exceptionEdge, bci())); - frameState.pushReturn(resultType, invoke); - Block nextBlock = currentBlock.successors.get(0); - - invoke.setNext(createTarget(nextBlock, frameState)); - invoke.setStateAfter(frameState.create(nextBlock.startBci)); - return invoke; - } + protected InvokeWithExceptionNode createInvokeWithException(CallTargetNode callTarget, Kind resultType) { + DispatchBeginNode exceptionEdge = handleException(null, bci()); + InvokeWithExceptionNode invoke = append(new InvokeWithExceptionNode(callTarget, exceptionEdge, bci())); + frameState.pushReturn(resultType, invoke); + Block nextBlock = currentBlock.successors.get(0); + invoke.setStateAfter(frameState.create(nextBlock.startBci)); + return invoke; } private void genReturn(ValueNode x) {