diff truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Debugger.java @ 22066:78c3d3d8d86e

Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Thu, 06 Aug 2015 08:31:49 +0200
parents 95d5d6a93968
children c2cb9f1c8688
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Debugger.java	Wed Aug 05 10:19:41 2015 -0700
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Debugger.java	Thu Aug 06 08:31:49 2015 +0200
@@ -117,8 +117,8 @@
             }
         };
 
-        this.lineBreaks = new LineBreakpointFactory(this, breakpointCallback, warningLog);
-        this.tagBreaks = new TagBreakpointFactory(this, breakpointCallback, warningLog);
+        this.lineBreaks = new LineBreakpointFactory(breakpointCallback, warningLog);
+        this.tagBreaks = new TagBreakpointFactory(breakpointCallback, warningLog);
     }
 
     TruffleVM vm() {
@@ -266,10 +266,18 @@
      * @throws IOException if the factory cannot be created, for example if the expression is badly
      *             formed.
      */
-    AdvancedInstrumentRootFactory createAdvancedInstrumentRootFactory(Probe probe, String expr, AdvancedInstrumentResultListener resultListener) throws IOException {
+    @SuppressWarnings("rawtypes")
+    static AdvancedInstrumentRootFactory createAdvancedInstrumentRootFactory(Probe probe, String expr, AdvancedInstrumentResultListener resultListener) throws IOException {
         try {
             Class<? extends TruffleLanguage> langugageClass = ACCESSOR.findLanguage(probe);
-            TruffleLanguage l = ACCESSOR.findLanguage(vm, langugageClass);
+            TruffleLanguage<?> l;
+            try {
+                l = langugageClass.newInstance();
+            } catch (InstantiationException ex) {
+                throw new IllegalStateException(ex);
+            } catch (IllegalAccessException ex) {
+                throw new IllegalStateException(ex);
+            }
             DebugSupportProvider dsp = ACCESSOR.getDebugSupport(l);
             return dsp.createAdvancedInstrumentRootFactory(expr, resultListener);
         } catch (DebugSupportException ex) {
@@ -789,6 +797,7 @@
         debugContext = debugContext.predecessor;
     }
 
+    @SuppressWarnings("rawtypes")
     private static final class AccessorDebug extends Accessor {
         @Override
         protected Closeable executionStart(TruffleVM vm, Debugger[] fillIn, Source s) {
@@ -813,12 +822,12 @@
         }
 
         @Override
-        protected TruffleLanguage findLanguage(TruffleVM vm, Class<? extends TruffleLanguage> languageClass) {
+        protected TruffleLanguage.Env findLanguage(TruffleVM vm, Class<? extends TruffleLanguage> languageClass) {
             return super.findLanguage(vm, languageClass);
         }
 
         @Override
-        protected DebugSupportProvider getDebugSupport(TruffleLanguage l) {
+        protected DebugSupportProvider getDebugSupport(TruffleLanguage<?> l) {
             return super.getDebugSupport(l);
         }