44
44
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
45
45
import com .oracle .truffle .api .RootCallTarget ;
46
46
import com .oracle .truffle .api .Truffle ;
47
- import com .oracle .truffle .api .TruffleContext ;
48
47
import com .oracle .truffle .api .TruffleLogger ;
49
48
import com .oracle .truffle .api .debug .Breakpoint ;
50
49
import com .oracle .truffle .api .debug .DebugStackFrame ;
58
57
import com .oracle .truffle .api .debug .SuspensionFilter ;
59
58
import com .oracle .truffle .api .frame .Frame ;
60
59
import com .oracle .truffle .api .frame .FrameInstance ;
61
- import com .oracle .truffle .api .instrumentation .ContextsListener ;
62
- import com .oracle .truffle .api .nodes .LanguageInfo ;
63
60
import com .oracle .truffle .api .nodes .Node ;
64
61
import com .oracle .truffle .api .nodes .RootNode ;
65
62
import com .oracle .truffle .espresso .jdwp .api .CallFrame ;
71
68
import com .oracle .truffle .espresso .jdwp .api .MethodVersionRef ;
72
69
import com .oracle .truffle .espresso .jdwp .api .VMEventListener ;
73
70
74
- public final class DebuggerController implements ContextsListener {
71
+ public final class DebuggerController {
75
72
76
73
private static final StepConfig STEP_CONFIG = StepConfig .newBuilder ().suspendAnchors (SourceElement .ROOT , SuspendAnchor .AFTER ).build ();
77
74
@@ -91,15 +88,14 @@ public final class DebuggerController implements ContextsListener {
91
88
private volatile HandshakeController hsController = null ;
92
89
private final Lock resetting = new ReentrantLock ();
93
90
private volatile boolean isClosing ;
94
- private JDWPOptions options ;
95
- private DebuggerSession debuggerSession ;
96
- private Ids <Object > ids ;
97
- private Debugger debugger ;
91
+ private final JDWPOptions options ;
92
+ private final DebuggerSession debuggerSession ;
93
+ private final Ids <Object > ids ;
94
+ private final Debugger debugger ;
98
95
private final GCPrevention gcPrevention ;
99
96
private final ThreadSuspension threadSuspension ;
100
97
private final EventFilters eventFilters ;
101
- private VMEventListener eventListener ;
102
- private TruffleContext truffleContext ;
98
+ private final VMEventListener eventListener ;
103
99
private Object initialThread ;
104
100
private final TruffleLogger jdwpLogger ;
105
101
private DebuggerConnection connection ;
@@ -110,14 +106,11 @@ public final class DebuggerController implements ContextsListener {
110
106
// itself, it must check this field and exit the context if set.
111
107
private volatile Throwable lateStartupError ;
112
108
113
- public DebuggerController (TruffleLogger logger ) {
109
+ public DebuggerController (TruffleLogger logger , Debugger debug , JDWPOptions jdwpOptions , JDWPContext jdwpContext , Object thread , VMEventListener vmEventListener ) {
114
110
this .gcPrevention = new GCPrevention ();
115
111
this .threadSuspension = new ThreadSuspension ();
116
112
this .eventFilters = new EventFilters ();
117
113
this .jdwpLogger = logger ;
118
- }
119
-
120
- public void initialize (Debugger debug , JDWPOptions jdwpOptions , JDWPContext jdwpContext , Object thread , VMEventListener vmEventListener ) {
121
114
this .debugger = debug ;
122
115
this .options = jdwpOptions ;
123
116
this .context = jdwpContext ;
@@ -154,9 +147,7 @@ public void init(JDWPContext jdwpContext) {
154
147
155
148
public void reInitialize () {
156
149
// create a new DebuggerController instance
157
- DebuggerController newController = new DebuggerController (jdwpLogger );
158
- newController .truffleContext = truffleContext ;
159
- newController .initialize (debugger , options , context , initialThread , eventListener );
150
+ DebuggerController newController = new DebuggerController (jdwpLogger , debugger , options , context , initialThread , eventListener );
160
151
context .replaceController (newController );
161
152
assert newController .setupState != null ;
162
153
@@ -683,23 +674,7 @@ public VMEventListener getEventListener() {
683
674
return eventListener ;
684
675
}
685
676
686
- public Object enterTruffleContext () {
687
- assert truffleContext != null ;
688
- return truffleContext .enter (null );
689
- }
690
-
691
- public void leaveTruffleContext (Object previous ) {
692
- assert truffleContext != null ;
693
- truffleContext .leave (null , previous );
694
- }
695
-
696
- @ Override
697
- public void onLanguageContextInitialized (TruffleContext con , @ SuppressWarnings ("unused" ) LanguageInfo language ) {
698
- if (!"java" .equals (language .getId ())) {
699
- return ;
700
- }
701
- truffleContext = con ;
702
-
677
+ public void onLanguageContextInitialized () {
703
678
// With the Espresso context initialized, we can now complete the JDWP setup and establish
704
679
// the connection.
705
680
assert setupState != null ;
@@ -1282,29 +1257,4 @@ public void severe(String message, Throwable error) {
1282
1257
jdwpLogger .log (Level .SEVERE , message , error );
1283
1258
}
1284
1259
1285
- @ Override
1286
- public void onContextCreated (@ SuppressWarnings ("unused" ) TruffleContext con ) {
1287
-
1288
- }
1289
-
1290
- @ Override
1291
- public void onLanguageContextCreated (@ SuppressWarnings ("unused" ) TruffleContext con , @ SuppressWarnings ("unused" ) LanguageInfo language ) {
1292
-
1293
- }
1294
-
1295
- @ Override
1296
- public void onLanguageContextFinalized (@ SuppressWarnings ("unused" ) TruffleContext con , @ SuppressWarnings ("unused" ) LanguageInfo language ) {
1297
-
1298
- }
1299
-
1300
- @ Override
1301
- public void onLanguageContextDisposed (@ SuppressWarnings ("unused" ) TruffleContext con , @ SuppressWarnings ("unused" ) LanguageInfo language ) {
1302
-
1303
- }
1304
-
1305
- @ Override
1306
- public void onContextClosed (@ SuppressWarnings ("unused" ) TruffleContext con ) {
1307
-
1308
- }
1309
-
1310
1260
}
0 commit comments