diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/InstrumentationNode.java @ 15779:8c34e2cc4add

Truffle/Instrumentation: significant reorganization of the instrumentation framework's implementation and connection to the runtime ExecutionContext, with some new features, including a Tag-based "trap" mechanisms.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Mon, 19 May 2014 17:14:36 -0700
parents bb9473723904
children 14ac87c56a27
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/InstrumentationNode.java	Tue May 13 18:31:18 2014 -0700
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/InstrumentationNode.java	Mon May 19 17:14:36 2014 -0700
@@ -39,7 +39,7 @@
  */
 public abstract class InstrumentationNode extends Node implements ExecutionEvents {
 
-    public interface ProbeCallback {
+    interface ProbeCallback {
         void newTagAdded(ProbeImpl probe, PhylumTag tag);
     }
 
@@ -49,7 +49,7 @@
      *
      * @return a new probe
      */
-    public static ProbeImpl createProbe(SourceSection sourceSection, ProbeCallback probeCallback) {
+    static ProbeImpl createProbe(SourceSection sourceSection, ProbeCallback probeCallback) {
         return new ProbeImpl(sourceSection, probeCallback);
     }
 
@@ -64,7 +64,7 @@
     /**
      * @return the instance of {@link Probe} to which this instrument is attached.
      */
-    public Probe getProbe() {
+    protected Probe getProbe() {
         final InstrumentationNode parent = (InstrumentationNode) getParent();
         return parent == null ? null : parent.getProbe();
     }
@@ -199,7 +199,7 @@
      * May be categorized by one or more {@linkplain PhylumTag tags}, signifying information useful
      * for instrumentation about its AST location(s).
      */
-    public static final class ProbeImpl extends InstrumentationNode implements Probe {
+    static final class ProbeImpl extends InstrumentationNode implements Probe {
 
         private final ProbeCallback probeCallback;
 
@@ -259,7 +259,7 @@
         }
 
         @Override
-        public Probe getProbe() {
+        protected Probe getProbe() {
             return this;
         }
 
@@ -271,14 +271,14 @@
         }
 
         @SlowPath
-        public void setTrap(PhylumTrap trap) {
+        void setTrap(PhylumTrap trap) {
             assert trap == null || isTaggedAs(trap.getTag());
             probeUnchanged.invalidate();
             this.trap = trap;
             probeUnchanged = Truffle.getRuntime().createAssumption();
         }
 
-        public void notifyEnter(Node astNode, VirtualFrame frame) {
+        public void enter(Node astNode, VirtualFrame frame) {
             if (trap != null || next != null) {
                 if (!probeUnchanged.isValid()) {
                     CompilerDirectives.transferToInterpreter();
@@ -292,7 +292,7 @@
             }
         }
 
-        public void notifyLeave(Node astNode, VirtualFrame frame) {
+        public void leave(Node astNode, VirtualFrame frame) {
             if (next != null) {
                 if (!probeUnchanged.isValid()) {
                     CompilerDirectives.transferToInterpreter();
@@ -301,16 +301,7 @@
             }
         }
 
-        public void notifyLeave(Node astNode, VirtualFrame frame, boolean result) {
-            if (next != null) {
-                if (!probeUnchanged.isValid()) {
-                    CompilerDirectives.transferToInterpreter();
-                }
-                next.internalLeave(astNode, frame, result);
-            }
-        }
-
-        public void notifyLeave(Node astNode, VirtualFrame frame, byte result) {
+        public void leave(Node astNode, VirtualFrame frame, boolean result) {
             if (next != null) {
                 if (!probeUnchanged.isValid()) {
                     CompilerDirectives.transferToInterpreter();
@@ -319,16 +310,7 @@
             }
         }
 
-        public void notifyLeave(Node astNode, VirtualFrame frame, short result) {
-            if (next != null) {
-                if (!probeUnchanged.isValid()) {
-                    CompilerDirectives.transferToInterpreter();
-                }
-                next.internalLeave(astNode, frame, result);
-            }
-        }
-
-        public void notifyLeave(Node astNode, VirtualFrame frame, int result) {
+        public void leave(Node astNode, VirtualFrame frame, byte result) {
             if (next != null) {
                 if (!probeUnchanged.isValid()) {
                     CompilerDirectives.transferToInterpreter();
@@ -337,7 +319,7 @@
             }
         }
 
-        public void notifyLeave(Node astNode, VirtualFrame frame, long result) {
+        public void leave(Node astNode, VirtualFrame frame, short result) {
             if (next != null) {
                 if (!probeUnchanged.isValid()) {
                     CompilerDirectives.transferToInterpreter();
@@ -346,16 +328,7 @@
             }
         }
 
-        public void notifyLeave(Node astNode, VirtualFrame frame, char result) {
-            if (next != null) {
-                if (!probeUnchanged.isValid()) {
-                    CompilerDirectives.transferToInterpreter();
-                }
-                next.internalLeave(astNode, frame, result);
-            }
-        }
-
-        public void notifyLeave(Node astNode, VirtualFrame frame, float result) {
+        public void leave(Node astNode, VirtualFrame frame, int result) {
             if (next != null) {
                 if (!probeUnchanged.isValid()) {
                     CompilerDirectives.transferToInterpreter();
@@ -364,7 +337,16 @@
             }
         }
 
-        public void notifyLeave(Node astNode, VirtualFrame frame, double result) {
+        public void leave(Node astNode, VirtualFrame frame, long result) {
+            if (next != null) {
+                if (!probeUnchanged.isValid()) {
+                    CompilerDirectives.transferToInterpreter();
+                }
+                next.internalLeave(astNode, frame, result);
+            }
+        }
+
+        public void leave(Node astNode, VirtualFrame frame, char result) {
             if (next != null) {
                 if (!probeUnchanged.isValid()) {
                     CompilerDirectives.transferToInterpreter();
@@ -373,7 +355,7 @@
             }
         }
 
-        public void notifyLeave(Node astNode, VirtualFrame frame, Object result) {
+        public void leave(Node astNode, VirtualFrame frame, float result) {
             if (next != null) {
                 if (!probeUnchanged.isValid()) {
                     CompilerDirectives.transferToInterpreter();
@@ -382,7 +364,25 @@
             }
         }
 
-        public void notifyLeaveExceptional(Node astNode, VirtualFrame frame, Exception e) {
+        public void leave(Node astNode, VirtualFrame frame, double result) {
+            if (next != null) {
+                if (!probeUnchanged.isValid()) {
+                    CompilerDirectives.transferToInterpreter();
+                }
+                next.internalLeave(astNode, frame, result);
+            }
+        }
+
+        public void leave(Node astNode, VirtualFrame frame, Object result) {
+            if (next != null) {
+                if (!probeUnchanged.isValid()) {
+                    CompilerDirectives.transferToInterpreter();
+                }
+                next.internalLeave(astNode, frame, result);
+            }
+        }
+
+        public void leaveExceptional(Node astNode, VirtualFrame frame, Exception e) {
             if (next != null) {
                 if (!probeUnchanged.isValid()) {
                     CompilerDirectives.transferToInterpreter();
@@ -391,50 +391,6 @@
             }
         }
 
-        public void enter(Node astNode, VirtualFrame frame) {
-        }
-
-        public void leave(Node astNode, VirtualFrame frame) {
-        }
-
-        public void leave(Node astNode, VirtualFrame frame, boolean result) {
-            leave(astNode, frame, (Object) result);
-        }
-
-        public void leave(Node astNode, VirtualFrame frame, byte result) {
-            leave(astNode, frame, (Object) result);
-        }
-
-        public void leave(Node astNode, VirtualFrame frame, short result) {
-            leave(astNode, frame, (Object) result);
-        }
-
-        public void leave(Node astNode, VirtualFrame frame, int result) {
-            leave(astNode, frame, (Object) result);
-        }
-
-        public void leave(Node astNode, VirtualFrame frame, long result) {
-            leave(astNode, frame, (Object) result);
-        }
-
-        public void leave(Node astNode, VirtualFrame frame, char result) {
-            leave(astNode, frame, (Object) result);
-        }
-
-        public void leave(Node astNode, VirtualFrame frame, float result) {
-            leave(astNode, frame, (Object) result);
-        }
-
-        public void leave(Node astNode, VirtualFrame frame, double result) {
-            leave(astNode, frame, (Object) result);
-        }
-
-        public void leave(Node astNode, VirtualFrame frame, Object result) {
-        }
-
-        public void leaveExceptional(Node astNode, VirtualFrame frame, Exception e) {
-        }
-
     }
 
 }