Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLStandardASTProber.java @ 18990:d1c1cd2530d7
Truffle/Instrumentation: clean up and repair some old unit tests
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Tue, 27 Jan 2015 20:28:43 -0800 |
parents | e3c95cbbb50c |
children | 6f1afa58a9b8 |
comparison
equal
deleted
inserted
replaced
18989:acd822f17ef5 | 18990:d1c1cd2530d7 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
42 * Instruments and tags all relevant {@link SLStatementNode}s and {@link SLExpressionNode}s. | 42 * Instruments and tags all relevant {@link SLStatementNode}s and {@link SLExpressionNode}s. |
43 * Currently, only SLStatementNodes that are not SLExpressionNodes are tagged as statements. | 43 * Currently, only SLStatementNodes that are not SLExpressionNodes are tagged as statements. |
44 */ | 44 */ |
45 public boolean visit(Node node) { | 45 public boolean visit(Node node) { |
46 | 46 |
47 if (node instanceof SLStatementNode) { | 47 if (node.isInstrumentable()) { |
48 | 48 |
49 // We have to distinguish between SLExpressionNode and SLStatementNode since some of the | 49 if (node instanceof SLStatementNode) { |
50 // generated factories have methods that require SLExpressionNodes as parameters. Since | |
51 // SLExpressionNodes are a subclass of SLStatementNode, we check if something is an | |
52 // SLExpressionNode first. | |
53 if (node instanceof SLExpressionNode && node.getParent() != null) { | |
54 SLExpressionNode expressionNode = (SLExpressionNode) node; | |
55 if (expressionNode.getSourceSection() != null) { | |
56 Probe probe = expressionNode.probe(); | |
57 | 50 |
58 if (node instanceof SLWriteLocalVariableNode) { | 51 // Distinguish between SLExpressionNode and SLStatementNode since some of the |
52 // generated factory methods that require SLExpressionNodes as parameters. | |
53 // Since | |
54 // SLExpressionNodes are a subclass of SLStatementNode, check if something is an | |
55 // SLExpressionNode first. | |
56 if (node instanceof SLExpressionNode && node.getParent() != null) { | |
57 SLExpressionNode expressionNode = (SLExpressionNode) node; | |
58 if (expressionNode.getSourceSection() != null) { | |
59 Probe probe = expressionNode.probe(); | |
60 | |
61 if (node instanceof SLWriteLocalVariableNode) { | |
62 probe.tagAs(STATEMENT, null); | |
63 probe.tagAs(ASSIGNMENT, null); | |
64 } | |
65 } | |
66 } else if (node instanceof SLStatementNode && node.getParent() != null) { | |
67 | |
68 SLStatementNode statementNode = (SLStatementNode) node; | |
69 if (statementNode.getSourceSection() != null) { | |
70 Probe probe = statementNode.probe(); | |
59 probe.tagAs(STATEMENT, null); | 71 probe.tagAs(STATEMENT, null); |
60 probe.tagAs(ASSIGNMENT, null); | |
61 } | |
62 } | |
63 } else if (node instanceof SLStatementNode && node.getParent() != null) { | |
64 | 72 |
65 SLStatementNode statementNode = (SLStatementNode) node; | 73 if (node instanceof SLWhileNode) { |
66 if (statementNode.getSourceSection() != null) { | 74 probe.tagAs(START_LOOP, null); |
67 Probe probe = statementNode.probe(); | 75 } |
68 probe.tagAs(STATEMENT, null); | |
69 | |
70 if (node instanceof SLWhileNode) { | |
71 probe.tagAs(START_LOOP, null); | |
72 } | 76 } |
73 } | 77 } |
74 } | 78 } |
75 } | 79 } |
76 return true; | 80 return true; |