Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/StandardSyntaxTag.java @ 16576:a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
author | Chris Seaton <chris.seaton@oracle.com> |
---|---|
date | Tue, 22 Jul 2014 12:44:55 +0100 |
parents | 50d79ad439f1 |
children | e3c95cbbb50c |
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. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
35 * |
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 * @see Wrapper |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
38 */ |
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
|
39 public enum StandardSyntaxTag implements SyntaxTag { |
15605
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 /** |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
42 * Marker for a variable assignment. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
43 */ |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
44 ASSIGNMENT("assignment", "a variable assignment"), |
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 /** |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
47 * Marker for a call site. |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
48 */ |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
49 CALL("call", "a method/procedure call site"), |
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 /** |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
52 * 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
|
53 */ |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
54 THROW("throw", "creator of an exception"), |
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 /** |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
57 * 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
|
58 */ |
16576
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
59 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
|
60 |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
61 /** |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
62 * 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
|
63 */ |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
64 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
|
65 |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
66 /** |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
67 * 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
|
68 */ |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
69 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
|
70 |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
71 /** |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
72 * 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
|
73 * 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
|
74 * 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
|
75 */ |
a01fe4b301a8
Truffle/Instrument: new syntax tags for periodically appearing locations.
Chris Seaton <chris.seaton@oracle.com>
parents:
16391
diff
changeset
|
76 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
|
77 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
78 private final String name; |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
79 private final String description; |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
80 |
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
|
81 private StandardSyntaxTag(String name, String description) { |
15605
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
82 this.name = name; |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
83 this.description = description; |
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 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
86 public String getName() { |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
87 return name; |
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 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
90 public String getDescription() { |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
91 return description; |
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 |
bb9473723904
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
94 } |