Mercurial > hg > truffle
comparison graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/PEGraphDecoder.java @ 21502:553445b73d99
Bugfix for Graph Decoder: ensure that guard dependencies to block begins are correctly re-wired during decoding
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Tue, 26 May 2015 16:19:16 -0700 |
parents | cd35fec33774 |
children | 31fc2fce38f3 |
comparison
equal
deleted
inserted
replaced
21501:ce585b0ac3e2 | 21502:553445b73d99 |
---|---|
388 if (invocationPlugin.execute(graphBuilderContext, targetMethod, invocationPluginReceiver.init(targetMethod, arguments), arguments)) { | 388 if (invocationPlugin.execute(graphBuilderContext, targetMethod, invocationPluginReceiver.init(targetMethod, arguments), arguments)) { |
389 | 389 |
390 if (graphBuilderContext.lastInstr != null) { | 390 if (graphBuilderContext.lastInstr != null) { |
391 registerNode(loopScope, invokeData.invokeOrderId, graphBuilderContext.pushedNode, true, true); | 391 registerNode(loopScope, invokeData.invokeOrderId, graphBuilderContext.pushedNode, true, true); |
392 invoke.asNode().replaceAtUsages(graphBuilderContext.pushedNode); | 392 invoke.asNode().replaceAtUsages(graphBuilderContext.pushedNode); |
393 graphBuilderContext.lastInstr.setNext(nodeAfterInvoke(methodScope, loopScope, invokeData)); | 393 graphBuilderContext.lastInstr.setNext(nodeAfterInvoke(methodScope, loopScope, invokeData, AbstractBeginNode.prevBegin(graphBuilderContext.lastInstr))); |
394 } else { | 394 } else { |
395 assert graphBuilderContext.pushedNode == null : "Why push a node when the invoke does not return anyway?"; | 395 assert graphBuilderContext.pushedNode == null : "Why push a node when the invoke does not return anyway?"; |
396 invoke.asNode().replaceAtUsages(null); | 396 invoke.asNode().replaceAtUsages(null); |
397 } | 397 } |
398 | 398 |
467 assert invoke.next() == null; | 467 assert invoke.next() == null; |
468 | 468 |
469 ValueNode returnValue; | 469 ValueNode returnValue; |
470 List<ReturnNode> returnNodes = inlineScope.returnNodes; | 470 List<ReturnNode> returnNodes = inlineScope.returnNodes; |
471 if (!returnNodes.isEmpty()) { | 471 if (!returnNodes.isEmpty()) { |
472 FixedNode n; | |
473 n = nodeAfterInvoke(methodScope, loopScope, invokeData); | |
474 if (returnNodes.size() == 1) { | 472 if (returnNodes.size() == 1) { |
475 ReturnNode returnNode = returnNodes.get(0); | 473 ReturnNode returnNode = returnNodes.get(0); |
476 returnValue = returnNode.result(); | 474 returnValue = returnNode.result(); |
475 FixedNode n = nodeAfterInvoke(methodScope, loopScope, invokeData, AbstractBeginNode.prevBegin(returnNode)); | |
477 returnNode.replaceAndDelete(n); | 476 returnNode.replaceAndDelete(n); |
478 } else { | 477 } else { |
479 AbstractMergeNode merge = methodScope.graph.add(new MergeNode()); | 478 AbstractMergeNode merge = methodScope.graph.add(new MergeNode()); |
480 merge.setStateAfter((FrameState) ensureNodeCreated(methodScope, loopScope, invokeData.stateAfterOrderId)); | 479 merge.setStateAfter((FrameState) ensureNodeCreated(methodScope, loopScope, invokeData.stateAfterOrderId)); |
481 returnValue = InliningUtil.mergeReturns(merge, returnNodes, null); | 480 returnValue = InliningUtil.mergeReturns(merge, returnNodes, null); |
481 FixedNode n = nodeAfterInvoke(methodScope, loopScope, invokeData, merge); | |
482 merge.setNext(n); | 482 merge.setNext(n); |
483 } | 483 } |
484 } else { | 484 } else { |
485 returnValue = null; | 485 returnValue = null; |
486 } | 486 } |
506 Debug.dump(methodScope.graph, "Inline finished: " + inlineMethod.getDeclaringClass().getUnqualifiedName() + "." + inlineMethod.getName()); | 506 Debug.dump(methodScope.graph, "Inline finished: " + inlineMethod.getDeclaringClass().getUnqualifiedName() + "." + inlineMethod.getName()); |
507 } | 507 } |
508 return true; | 508 return true; |
509 } | 509 } |
510 | 510 |
511 public FixedNode nodeAfterInvoke(PEMethodScope methodScope, LoopScope loopScope, InvokeData invokeData) { | 511 public FixedNode nodeAfterInvoke(PEMethodScope methodScope, LoopScope loopScope, InvokeData invokeData, AbstractBeginNode lastBlock) { |
512 assert lastBlock.isAlive(); | |
512 FixedNode n; | 513 FixedNode n; |
513 if (invokeData.invoke instanceof InvokeWithExceptionNode) { | 514 if (invokeData.invoke instanceof InvokeWithExceptionNode) { |
515 registerNode(loopScope, invokeData.nextOrderId, lastBlock, false, false); | |
514 n = makeStubNode(methodScope, loopScope, invokeData.nextNextOrderId); | 516 n = makeStubNode(methodScope, loopScope, invokeData.nextNextOrderId); |
515 } else { | 517 } else { |
516 n = makeStubNode(methodScope, loopScope, invokeData.nextOrderId); | 518 n = makeStubNode(methodScope, loopScope, invokeData.nextOrderId); |
517 } | 519 } |
518 return n; | 520 return n; |