# HG changeset patch # User Michael Van De Vanter # Date 1422560756 28800 # Node ID 6f1afa58a9b8aec0d69cc6589554bf8e9468341c # Parent c7e57dffc5adb848bd21a566773e740662af1a54 Truffle/SL: clean up SL instrumentation code diff -r c7e57dffc5ad -r 6f1afa58a9b8 graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLStandardASTProber.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLStandardASTProber.java Thu Jan 29 11:44:14 2015 -0800 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLStandardASTProber.java Thu Jan 29 11:45:56 2015 -0800 @@ -44,36 +44,22 @@ */ public boolean visit(Node node) { - if (node.isInstrumentable()) { - - if (node instanceof SLStatementNode) { - - // Distinguish between SLExpressionNode and SLStatementNode since some of the - // generated factory methods that require SLExpressionNodes as parameters. - // Since - // SLExpressionNodes are a subclass of SLStatementNode, check if something is an - // SLExpressionNode first. - if (node instanceof SLExpressionNode && node.getParent() != null) { - SLExpressionNode expressionNode = (SLExpressionNode) node; - if (expressionNode.getSourceSection() != null) { - Probe probe = expressionNode.probe(); + if (node instanceof SLStatementNode && node.getParent() != null && node.getSourceSection() != null) { + // All SL nodes are instrumentable, but treat expressions specially - if (node instanceof SLWriteLocalVariableNode) { - probe.tagAs(STATEMENT, null); - probe.tagAs(ASSIGNMENT, null); - } - } - } else if (node instanceof SLStatementNode && node.getParent() != null) { - - SLStatementNode statementNode = (SLStatementNode) node; - if (statementNode.getSourceSection() != null) { - Probe probe = statementNode.probe(); - probe.tagAs(STATEMENT, null); - - if (node instanceof SLWhileNode) { - probe.tagAs(START_LOOP, null); - } - } + if (node instanceof SLExpressionNode) { + SLExpressionNode expressionNode = (SLExpressionNode) node; + Probe probe = expressionNode.probe(); + if (node instanceof SLWriteLocalVariableNode) { + probe.tagAs(STATEMENT, null); + probe.tagAs(ASSIGNMENT, null); + } + } else { + SLStatementNode statementNode = (SLStatementNode) node; + Probe probe = statementNode.probe(); + probe.tagAs(STATEMENT, null); + if (node instanceof SLWhileNode) { + probe.tagAs(START_LOOP, null); } } }