Mercurial > hg > truffle
comparison graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java @ 19521:9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 20 Feb 2015 13:58:56 +0100 |
parents | 387d7192e18f |
children | a9aa368f9068 |
comparison
equal
deleted
inserted
replaced
19516:108fbab4e0e8 | 19521:9c4168877444 |
---|---|
1036 append(createInfoPointNode(InfopointReason.METHOD_END)); | 1036 append(createInfoPointNode(InfopointReason.METHOD_END)); |
1037 } | 1037 } |
1038 | 1038 |
1039 synchronizedEpilogue(BytecodeFrame.AFTER_BCI, x); | 1039 synchronizedEpilogue(BytecodeFrame.AFTER_BCI, x); |
1040 if (frameState.lockDepth() != 0) { | 1040 if (frameState.lockDepth() != 0) { |
1041 throw new BailoutException("unbalanced monitors"); | 1041 throw bailout("unbalanced monitors"); |
1042 } | 1042 } |
1043 } | 1043 } |
1044 | 1044 |
1045 @Override | 1045 @Override |
1046 protected MonitorEnterNode genMonitorEnter(ValueNode x) { | 1046 protected MonitorEnterNode genMonitorEnter(ValueNode x) { |
1053 @Override | 1053 @Override |
1054 protected MonitorExitNode genMonitorExit(ValueNode x, ValueNode escapedReturnValue) { | 1054 protected MonitorExitNode genMonitorExit(ValueNode x, ValueNode escapedReturnValue) { |
1055 MonitorIdNode monitorId = frameState.peekMonitorId(); | 1055 MonitorIdNode monitorId = frameState.peekMonitorId(); |
1056 ValueNode lockedObject = frameState.popLock(); | 1056 ValueNode lockedObject = frameState.popLock(); |
1057 if (GraphUtil.originalValue(lockedObject) != GraphUtil.originalValue(x)) { | 1057 if (GraphUtil.originalValue(lockedObject) != GraphUtil.originalValue(x)) { |
1058 throw new BailoutException("unbalanced monitors: mismatch at monitorexit, %s != %s", GraphUtil.originalValue(x), GraphUtil.originalValue(lockedObject)); | 1058 throw bailout(String.format("unbalanced monitors: mismatch at monitorexit, %s != %s", GraphUtil.originalValue(x), GraphUtil.originalValue(lockedObject))); |
1059 } | 1059 } |
1060 MonitorExitNode monitorExit = append(new MonitorExitNode(x, monitorId, escapedReturnValue)); | 1060 MonitorExitNode monitorExit = append(new MonitorExitNode(x, monitorId, escapedReturnValue)); |
1061 return monitorExit; | 1061 return monitorExit; |
1062 } | 1062 } |
1063 | 1063 |
1375 return result; | 1375 return result; |
1376 } | 1376 } |
1377 | 1377 |
1378 // We already saw this block before, so we have to merge states. | 1378 // We already saw this block before, so we have to merge states. |
1379 if (!((HIRFrameStateBuilder) getEntryState(block, operatingDimension)).isCompatibleWith(state)) { | 1379 if (!((HIRFrameStateBuilder) getEntryState(block, operatingDimension)).isCompatibleWith(state)) { |
1380 throw new BailoutException("stacks do not match; bytecodes would not verify"); | 1380 throw bailout("stacks do not match; bytecodes would not verify"); |
1381 } | 1381 } |
1382 | 1382 |
1383 if (getFirstInstruction(block, operatingDimension) instanceof LoopBeginNode) { | 1383 if (getFirstInstruction(block, operatingDimension) instanceof LoopBeginNode) { |
1384 assert this.explodeLoops || (block.isLoopHeader && currentBlock.getId() >= block.getId()) : "must be backward branch"; | 1384 assert this.explodeLoops || (block.isLoopHeader && currentBlock.getId() >= block.getId()) : "must be backward branch"; |
1385 /* | 1385 /* |
1459 if (nextPeelIteration > MaximumLoopExplosionCount.getValue()) { | 1459 if (nextPeelIteration > MaximumLoopExplosionCount.getValue()) { |
1460 String message = "too many loop explosion interations - does the explosion not terminate for method " + method + "?"; | 1460 String message = "too many loop explosion interations - does the explosion not terminate for method " + method + "?"; |
1461 if (FailedLoopExplosionIsFatal.getValue()) { | 1461 if (FailedLoopExplosionIsFatal.getValue()) { |
1462 throw new RuntimeException(message); | 1462 throw new RuntimeException(message); |
1463 } else { | 1463 } else { |
1464 throw new BailoutException(message); | 1464 throw bailout(message); |
1465 } | 1465 } |
1466 } | 1466 } |
1467 } | 1467 } |
1468 | 1468 |
1469 // Operate on the target dimension. | 1469 // Operate on the target dimension. |
1960 | 1960 |
1961 @Override | 1961 @Override |
1962 public String toString() { | 1962 public String toString() { |
1963 return method.format("%H.%n(%p)@") + bci(); | 1963 return method.format("%H.%n(%p)@") + bci(); |
1964 } | 1964 } |
1965 | |
1966 public BailoutException bailout(String string) { | |
1967 FrameState currentFrameState = this.frameState.create(bci()); | |
1968 StackTraceElement[] elements = GraphUtil.approxSourceStackTraceElement(currentFrameState); | |
1969 BailoutException bailout = new BailoutException(string); | |
1970 throw GraphUtil.createBailoutException(string, bailout, elements); | |
1971 } | |
1965 } | 1972 } |
1966 } | 1973 } |
1967 | 1974 |
1968 static String nSpaces(int n) { | 1975 static String nSpaces(int n) { |
1969 return n == 0 ? "" : format("%" + n + "s", ""); | 1976 return n == 0 ? "" : format("%" + n + "s", ""); |