# HG changeset patch # User hannesw # Date 1374746172 -7200 # Node ID 62d400be5b4410b182a740dd7eafed3fe3561402 # Parent 30230d3febb8e5bb6097645fc6a696e7b57ada92 8021244: Inconsistent stackmap with splitter threshold set very low Reviewed-by: sundar, lagergren diff -r 30230d3febb8 -r 62d400be5b44 nashorn/src/jdk/nashorn/internal/codegen/Lower.java --- a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java Thu Jul 25 14:05:03 2013 +0530 +++ b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java Thu Jul 25 11:56:12 2013 +0200 @@ -88,8 +88,6 @@ /** * Constructor. - * - * @param compiler the compiler */ Lower() { super(new BlockLexicalContext() { @@ -307,8 +305,8 @@ final IdentNode exception = new IdentNode(token, finish, lc.getCurrentFunction().uniqueName("catch_all")); - final Block catchBody = new Block(token, finish, new ThrowNode(lineNumber, token, finish, new IdentNode(exception), ThrowNode.IS_SYNTHETIC_RETHROW)). - setIsTerminal(lc, true); //ends with throw, so terminal + final Block catchBody = new Block(token, finish, new ThrowNode(lineNumber, token, finish, new IdentNode(exception), ThrowNode.IS_SYNTHETIC_RETHROW)); + assert catchBody.isTerminal(); //ends with throw, so terminal final CatchNode catchAllNode = new CatchNode(lineNumber, token, finish, new IdentNode(exception), null, catchBody, CatchNode.IS_SYNTHETIC_RETHROW); final Block catchAllBlock = new Block(token, finish, catchAllNode); @@ -330,13 +328,12 @@ /** * Splice finally code into all endpoints of a trynode * @param tryNode the try node - * @param list of rethrowing throw nodes from synthetic catch blocks + * @param rethrows list of rethrowing throw nodes from synthetic catch blocks * @param finallyBody the code in the original finally block * @return new try node after splicing finally code (same if nop) */ private Node spliceFinally(final TryNode tryNode, final List rethrows, final Block finallyBody) { assert tryNode.getFinallyBody() == null; - final int finish = tryNode.getFinish(); final TryNode newTryNode = (TryNode)tryNode.accept(new NodeVisitor(new LexicalContext()) { final List insideTry = new ArrayList<>(); @@ -404,7 +401,7 @@ if (!isTerminal(newStatements)) { newStatements.add(endpoint); } - return BlockStatement.createReplacement(endpoint, finish, newStatements); + return BlockStatement.createReplacement(endpoint, tryNode.getFinish(), newStatements); } return endpoint; } @@ -466,7 +463,7 @@ if (tryNode.getCatchBlocks().isEmpty()) { newTryNode = tryNode.setFinallyBody(null); } else { - Block outerBody = new Block(tryNode.getToken(), tryNode.getFinish(), new ArrayList(Arrays.asList(tryNode.setFinallyBody(null)))); + Block outerBody = new Block(tryNode.getToken(), tryNode.getFinish(), tryNode.setFinallyBody(null)); newTryNode = tryNode.setBody(outerBody).setCatchBlocks(null); } diff -r 30230d3febb8 -r 62d400be5b44 nashorn/src/jdk/nashorn/internal/ir/Block.java --- a/nashorn/src/jdk/nashorn/internal/ir/Block.java Thu Jul 25 14:05:03 2013 +0530 +++ b/nashorn/src/jdk/nashorn/internal/ir/Block.java Thu Jul 25 11:56:12 2013 +0200 @@ -93,7 +93,8 @@ this.symbols = new LinkedHashMap<>(); this.entryLabel = new Label("block_entry"); this.breakLabel = new Label("block_break"); - this.flags = 0; + final int len = statements.length; + this.flags = (len > 0 && statements[len - 1].hasTerminalFlags()) ? IS_TERMINAL : 0; } /**