Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/StandardSyntaxTag.java @ 19490:745ecef4c9cd
Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Wed, 18 Feb 2015 18:07:48 -0800 |
parents | e3c95cbbb50c |
children | 1cde96b96673 |
rev | line source |
---|---|
15605
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
1 /* |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
4 * |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
10 * |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
15 * accompanied this code). |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
16 * |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
20 * |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
23 * questions. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
24 */ |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.instrument; |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
26 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
27 /** |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15605
diff
changeset
|
28 * A somewhat language-agnostic set of user-sensible syntactic categories, suitable for conventional |
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15605
diff
changeset
|
29 * imperative languages, and is being developed incrementally. |
15605
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
30 * <p> |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
31 * The need for alternative sets of tags is likely to arise, perhaps for other families of languages |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
32 * (for example for mostly expression-oriented languages) or even for specific languages. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
33 * <p> |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
34 * <strong>Disclaimer:</strong> experimental interface under development. |
18485
e3c95cbbb50c
Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16576
diff
changeset
|
35 * |
15605
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
36 * @see Probe |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
37 */ |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15605
diff
changeset
|
38 public enum StandardSyntaxTag implements SyntaxTag { |
15605
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
39 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
40 /** |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
41 * Marker for a variable assignment. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
42 */ |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
43 ASSIGNMENT("assignment", "a variable assignment"), |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
44 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
45 /** |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
46 * Marker for a call site. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
47 */ |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
48 CALL("call", "a method/procedure call site"), |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
49 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
50 /** |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
51 * Marker for a location where a guest language exception is about to be thrown. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
52 */ |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
53 THROW("throw", "creator of an exception"), |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
54 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
55 /** |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
56 * Marker for a location where ordinary "stepping" should halt. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
57 */ |
16576
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
58 STATEMENT("statement", "basic unit of the language, suitable for \"stepping\" in a debugger"), |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
59 |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
60 /** |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
61 * Marker for the start of the body of a method. |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
62 */ |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
63 START_METHOD("start-method", "start of the body of a method"), |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
64 |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
65 /** |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
66 * Marker for the start of the body of a loop. |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
67 */ |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
68 START_LOOP("start-loop", "start of the body of a loop"), |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
69 |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
70 /** |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
71 * Marker that is attached to some arbitrary locations that appear often-enough in an AST so |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
72 * that a location with this tag is regularly executed. Could be the start of method and loop |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
73 * bodies. May be used to implement some kind of safepoint functionality. |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
74 */ |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
75 PERIODIC("periodic", "arbitrary locations that appear often-enough in an AST so that a location with this tag is regularly executed"); |
15605
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
76 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
77 private final String name; |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
78 private final String description; |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
79 |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15605
diff
changeset
|
80 private StandardSyntaxTag(String name, String description) { |
15605
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
81 this.name = name; |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
82 this.description = description; |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
83 } |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
84 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
85 public String getName() { |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
86 return name; |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
87 } |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
88 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
89 public String getDescription() { |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
90 return description; |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
91 } |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
92 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
93 } |