comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ExecutionEvents.java @ 15279:0c6d8a08e31b

Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Sun, 20 Apr 2014 20:37:27 -0700
parents
children 1051d6e4b61b
comparison
equal deleted inserted replaced
14862:0e713dba33bb 15279:0c6d8a08e31b
1 /*
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package com.oracle.truffle.api.instrument;
26
27 import com.oracle.truffle.api.frame.*;
28 import com.oracle.truffle.api.nodes.*;
29
30 /**
31 * Normal events during program execution at Truffle AST nodes that are reported via a {@link Probe}
32 * associated with the node, and made available to the probe's attached {@link Instrument}s.
33 * <p>
34 * <strong>Disclaimer:</strong> experimental interface under development.
35 */
36 public interface ExecutionEvents {
37
38 /**
39 * Notifies that an AST node's execute method has just been entered. Callers should assure that
40 * a matching call to {@link #leave(Node, VirtualFrame, Object)} always follows.
41 *
42 * @param astNode The AST node on which the execute method is being called
43 * @param frame The frame being passed to the execute method
44 */
45 void enter(Node astNode, VirtualFrame frame);
46
47 /**
48 * Notifies that an AST Node's void-valued execute method is about to exit.
49 * <p>
50 * Callers should assure (via {@code try/finally}) that a matching call to this method always
51 * follows a call to {@link #enter(Node, VirtualFrame)}.
52 *
53 * @param astNode The AST node on which the execute method is being called
54 * @param frame The frame that was passed to the execute method
55 */
56 void leave(Node astNode, VirtualFrame frame);
57
58 /**
59 * Notifies that an AST Node's boolean-valued execute method is about to exit.
60 * <p>
61 * Callers should assure (via {@code try/finally}) that a matching call to this method always
62 * follows a call to {@link #enter(Node, VirtualFrame)}.
63 *
64 * @param astNode The AST node on which the execute method is being called
65 * @param frame The frame that was passed to the execute method
66 * @param result The result of the call to the execute method.
67 */
68 void leave(Node astNode, VirtualFrame frame, boolean result);
69
70 /**
71 * Notifies that an AST Node's byte-valued execute method is about to exit.
72 * <p>
73 * Callers should assure (via {@code try/finally}) that a matching call to this method always
74 * follows a call to {@link #enter(Node, VirtualFrame)}.
75 *
76 * @param astNode The AST node on which the execute method is being called
77 * @param frame The frame that was passed to the execute method
78 * @param result The result of the call to the execute method.
79 */
80 void leave(Node astNode, VirtualFrame frame, byte result);
81
82 /**
83 * Notifies that an AST Node's short-valued execute method is about to exit.
84 * <p>
85 * Callers should assure (via {@code try/finally}) that a matching call to this method always
86 * follows a call to {@link #enter(Node, VirtualFrame)}.
87 *
88 * @param astNode The AST node on which the execute method is being called
89 * @param frame The frame that was passed to the execute method
90 * @param result The result of the call to the execute method.
91 */
92 void leave(Node astNode, VirtualFrame frame, short result);
93
94 /**
95 * Notifies that an AST Node's integer-valued execute method is about to exit.
96 * <p>
97 * Callers should assure (via {@code try/finally}) that a matching call to this method always
98 * follows a call to {@link #enter(Node, VirtualFrame)}.
99 *
100 * @param astNode The AST node on which the execute method is being called
101 * @param frame The frame that was passed to the execute method
102 * @param result The result of the call to the execute method.
103 */
104 void leave(Node astNode, VirtualFrame frame, int result);
105
106 /**
107 * Notifies that an AST Node's long-valued execute method is about to exit.
108 * <p>
109 * Callers should assure (via {@code try/finally}) that a matching call to this method always
110 * follows a call to {@link #enter(Node, VirtualFrame)}.
111 *
112 * @param astNode The AST node on which the execute method is being called
113 * @param frame The frame that was passed to the execute method
114 * @param result The result of the call to the execute method.
115 */
116 void leave(Node astNode, VirtualFrame frame, long result);
117
118 /**
119 * Notifies that an AST Node's float-valued execute method is about to exit.
120 * <p>
121 * Callers should assure (via {@code try/finally}) that a matching call to this method always
122 * follows a call to {@link #enter(Node, VirtualFrame)}.
123 *
124 * @param astNode The AST node on which the execute method is being called
125 * @param frame The frame that was passed to the execute method
126 * @param result The result of the call to the execute method.
127 */
128 void leave(Node astNode, VirtualFrame frame, float result);
129
130 /**
131 * Notifies that an AST Node's double-valued execute method is about to exit.
132 * <p>
133 * Callers should assure (via {@code try/finally}) that a matching call to this method always
134 * follows a call to {@link #enter(Node, VirtualFrame)}.
135 *
136 * @param astNode The AST node on which the execute method is being called
137 * @param frame The frame that was passed to the execute method
138 * @param result The result of the call to the execute method.
139 */
140 void leave(Node astNode, VirtualFrame frame, double result);
141
142 /**
143 * Notifies that an AST Node's char-valued execute method is about to exit.
144 * <p>
145 * Callers should assure (via {@code try/finally}) that a matching call to this method always
146 * follows a call to {@link #enter(Node, VirtualFrame)}.
147 *
148 * @param astNode The AST node on which the execute method is being called
149 * @param frame The frame that was passed to the execute method
150 * @param result The result of the call to the execute method.
151 */
152 void leave(Node astNode, VirtualFrame frame, char result);
153
154 /**
155 * Notifies that an AST Node's object-valued execute method is about to exit.
156 * <p>
157 * Callers should assure (via {@code try/finally}) that a matching call to this method always
158 * follows a call to {@link #enter(Node, VirtualFrame)}.
159 *
160 * @param astNode The AST node on which the execute method is being called
161 * @param frame The frame that was passed to the execute method
162 * @param result The result of the call to the execute method.
163 */
164 void leave(Node astNode, VirtualFrame frame, Object result);
165
166 /**
167 * Notifies that an AST Node's execute method is about to leave under exceptional conditions,
168 * returning no value.
169 * <p>
170 * Callers should assure (via {@code try/finally}) that a matching call to this method always
171 * follows a call to {@link #enter(Node, VirtualFrame)}.
172 *
173 * @param astNode The AST node on which the execute method is being called
174 * @param frame The frame that was passed to the execute method
175 * @param e the exception associated with the unusual return
176 */
177 void leaveExceptional(Node astNode, VirtualFrame frame, Exception e);
178
179 }