Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLExpressionNode.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 | ccb97347d874 |
children | c0455554d45b |
comparison
equal
deleted
inserted
replaced
18989:acd822f17ef5 | 18990:d1c1cd2530d7 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2012, 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. |
24 | 24 |
25 import java.math.*; | 25 import java.math.*; |
26 | 26 |
27 import com.oracle.truffle.api.dsl.*; | 27 import com.oracle.truffle.api.dsl.*; |
28 import com.oracle.truffle.api.frame.*; | 28 import com.oracle.truffle.api.frame.*; |
29 import com.oracle.truffle.api.instrument.*; | 29 import com.oracle.truffle.api.instrument.ProbeNode.WrapperNode; |
30 import com.oracle.truffle.api.nodes.*; | 30 import com.oracle.truffle.api.nodes.*; |
31 import com.oracle.truffle.api.source.*; | 31 import com.oracle.truffle.api.source.*; |
32 import com.oracle.truffle.sl.nodes.instrument.*; | 32 import com.oracle.truffle.sl.nodes.instrument.*; |
33 import com.oracle.truffle.sl.runtime.*; | 33 import com.oracle.truffle.sl.runtime.*; |
34 | 34 |
89 public SLNull executeNull(VirtualFrame frame) throws UnexpectedResultException { | 89 public SLNull executeNull(VirtualFrame frame) throws UnexpectedResultException { |
90 return SLTypesGen.expectSLNull(executeGeneric(frame)); | 90 return SLTypesGen.expectSLNull(executeGeneric(frame)); |
91 } | 91 } |
92 | 92 |
93 @Override | 93 @Override |
94 public Probe probe() { | 94 public boolean isInstrumentable() { |
95 Node parent = getParent(); | 95 return true; |
96 | |
97 if (parent == null) { | |
98 throw new IllegalStateException("Cannot call probe() a node without a parent."); | |
99 } | |
100 | |
101 if (parent instanceof SLExpressionWrapperNode) { | |
102 return ((SLExpressionWrapperNode) parent).getProbe(); | |
103 } | |
104 | |
105 // Create a new wrapper/probe with this node as its child. | |
106 final SLExpressionWrapperNode wrapper = new SLExpressionWrapperNode(this); | |
107 | |
108 // Connect it to a Probe | |
109 final Probe probe = ProbeNode.insertProbe(wrapper); | |
110 | |
111 // Replace this node in the AST with the wrapper | |
112 this.replace(wrapper); | |
113 | |
114 return probe; | |
115 } | 96 } |
116 | 97 |
117 @Override | 98 @Override |
118 public void probeLite(TruffleEventReceiver eventReceiver) { | 99 public WrapperNode createWrapperNode() { |
119 Node parent = getParent(); | 100 return new SLExpressionWrapperNode(this); |
101 } | |
120 | 102 |
121 if (parent == null) { | |
122 throw new IllegalStateException("Cannot call probeLite() on a node without a parent."); | |
123 } | |
124 | |
125 if (parent instanceof SLExpressionWrapperNode) { | |
126 throw new IllegalStateException("Cannot call probeLite() on a node that already has a wrapper."); | |
127 } | |
128 final SLExpressionWrapperNode wrapper = new SLExpressionWrapperNode(this); | |
129 ProbeNode.insertProbeLite(wrapper, eventReceiver); | |
130 | |
131 this.replace(wrapper); | |
132 } | |
133 } | 103 } |