54
54
import jdk .vm .ci .meta .ResolvedJavaType ;
55
55
56
56
/**
57
- * Represents a TruffleAST constructed from Truffle nodes using constant reflection. Note this AST
57
+ * Represents a Truffle AST constructed from Truffle nodes using constant reflection. Note this AST
58
58
* is currently only constructed for AST dumping to IGV.
59
59
*
60
60
* @see TruffleDebugHandlersFactory for details on dumping
61
61
*/
62
- final class TruffleAST implements JavaMethodContext {
62
+ final class TruffleDebugAST implements JavaMethodContext {
63
63
64
64
static final ASTDumpStructure AST_DUMP_STRUCTURE = new ASTDumpStructure ();
65
65
66
66
private final ASTNode root ;
67
- private final List <TruffleAST .ASTBlock > blocks = new ArrayList <>();
67
+ private final List <TruffleDebugAST .ASTBlock > blocks = new ArrayList <>();
68
68
private final List <ASTNode > nodes = new ArrayList <>();
69
69
private final TruffleCompilationTask task ;
70
70
private final TruffleCompilable compilable ;
71
71
private final PartialEvaluator partialEvaluator ;
72
72
private final CallTree callTree ;
73
73
private int currentId = 0 ;
74
74
75
- private TruffleAST (PartialEvaluator partialEvaluator , TruffleCompilationTask task , TruffleCompilable compilable , CallTree callTree ) {
75
+ private TruffleDebugAST (PartialEvaluator partialEvaluator , TruffleCompilationTask task , TruffleCompilable compilable , CallTree callTree ) {
76
76
this .partialEvaluator = partialEvaluator ;
77
77
this .compilable = compilable ;
78
78
this .callTree = callTree ;
@@ -83,8 +83,8 @@ private TruffleAST(PartialEvaluator partialEvaluator, TruffleCompilationTask tas
83
83
buildTree (rootNode , root , root .block );
84
84
}
85
85
86
- static TruffleAST create (PartialEvaluator config , TruffleCompilationTask task , TruffleCompilable compilable , CallTree callTree ) {
87
- return new TruffleAST (config , task , compilable , callTree );
86
+ static TruffleDebugAST create (PartialEvaluator config , TruffleCompilationTask task , TruffleCompilable compilable , CallTree callTree ) {
87
+ return new TruffleDebugAST (config , task , compilable , callTree );
88
88
}
89
89
90
90
private JavaConstant readRootNode (TruffleCompilable c ) {
@@ -100,8 +100,8 @@ public JavaMethod asJavaMethod() {
100
100
return new TruffleDebugJavaMethod (task , compilable );
101
101
}
102
102
103
- private ASTNode makeASTNode (ASTNode parent , TruffleAST .ASTBlock blockParent , JavaConstant node ) {
104
- TruffleAST .ASTBlock block = null ;
103
+ private ASTNode makeASTNode (ASTNode parent , TruffleDebugAST .ASTBlock blockParent , JavaConstant node ) {
104
+ TruffleDebugAST .ASTBlock block = null ;
105
105
if (blockParent == null ) {
106
106
block = makeASTBlock (null , callTree != null ? callTree .getRoot () : null );
107
107
} else {
@@ -131,7 +131,7 @@ private void makeInlinedAST(ASTNode parent, JavaConstant node, final ASTNode ast
131
131
}
132
132
}
133
133
if (found != null && found .getState () == CallNode .State .Inlined ) {
134
- TruffleAST .ASTBlock block = makeASTBlock (parent .block , found );
134
+ TruffleDebugAST .ASTBlock block = makeASTBlock (parent .block , found );
135
135
TruffleCompilable ast = block .callNode .getDirectCallTarget ();
136
136
buildTree (readRootNode (ast ), astNode , block );
137
137
@@ -149,16 +149,16 @@ private static void injectRootName(ASTNode rootNode, TruffleCompilable ast) {
149
149
rootNode .properties .put ("rootName" , rootName );
150
150
}
151
151
152
- private TruffleAST .ASTBlock makeASTBlock (TruffleAST .ASTBlock parentBlock , CallNode callNode ) {
153
- final TruffleAST .ASTBlock astBlock = new ASTBlock (blocks .size (), callNode );
152
+ private TruffleDebugAST .ASTBlock makeASTBlock (TruffleDebugAST .ASTBlock parentBlock , CallNode callNode ) {
153
+ final TruffleDebugAST .ASTBlock astBlock = new ASTBlock (blocks .size (), callNode );
154
154
blocks .add (astBlock );
155
155
if (parentBlock != null ) {
156
156
parentBlock .successors .add (astBlock );
157
157
}
158
158
return astBlock ;
159
159
}
160
160
161
- private void buildTree (JavaConstant parent , ASTNode astParent , TruffleAST .ASTBlock blockParent ) {
161
+ private void buildTree (JavaConstant parent , ASTNode astParent , TruffleDebugAST .ASTBlock blockParent ) {
162
162
if (astParent == null ) {
163
163
return ;
164
164
}
@@ -197,7 +197,7 @@ private ConstantReflectionProvider constantReflection() {
197
197
return partialEvaluator .config .lastTier ().providers ().getConstantReflection ();
198
198
}
199
199
200
- private ASTNode addNode (ASTNode parent , TruffleAST .ASTBlock blockParent , JavaConstant node , String edgeLabel ) {
200
+ private ASTNode addNode (ASTNode parent , TruffleDebugAST .ASTBlock blockParent , JavaConstant node , String edgeLabel ) {
201
201
if (node .isNull ()) {
202
202
return null ;
203
203
}
@@ -221,7 +221,7 @@ private static final class ASTNodeClass {
221
221
222
222
private static class ASTBlock {
223
223
private final int id ;
224
- private final List <TruffleAST .ASTBlock > successors = new ArrayList <>();
224
+ private final List <TruffleDebugAST .ASTBlock > successors = new ArrayList <>();
225
225
private final List <ASTNode > nodes = new ArrayList <>();
226
226
private final CallNode callNode ;
227
227
@@ -292,20 +292,20 @@ private static String dropNodeSuffix(String className) {
292
292
293
293
}
294
294
295
- static final class ASTDumpStructure implements GraphStructure <TruffleAST , ASTNode , ASTNodeClass , List <ASTEdge >>, GraphBlocks <TruffleAST , ASTBlock , ASTNode > {
295
+ static final class ASTDumpStructure implements GraphStructure <TruffleDebugAST , ASTNode , ASTNodeClass , List <ASTEdge >>, GraphBlocks <TruffleDebugAST , ASTBlock , ASTNode > {
296
296
297
297
@ Override
298
- public TruffleAST graph (TruffleAST currentGraph , Object obj ) {
299
- return obj instanceof TruffleAST ? (TruffleAST ) obj : null ;
298
+ public TruffleDebugAST graph (TruffleDebugAST currentGraph , Object obj ) {
299
+ return obj instanceof TruffleDebugAST ? (TruffleDebugAST ) obj : null ;
300
300
}
301
301
302
302
@ Override
303
- public Iterable <? extends ASTNode > nodes (TruffleAST graph ) {
303
+ public Iterable <? extends ASTNode > nodes (TruffleDebugAST graph ) {
304
304
return graph .nodes ;
305
305
}
306
306
307
307
@ Override
308
- public int nodesCount (TruffleAST graph ) {
308
+ public int nodesCount (TruffleDebugAST graph ) {
309
309
return graph .nodes .size ();
310
310
}
311
311
@@ -320,7 +320,7 @@ public boolean nodeHasPredecessor(ASTNode node) {
320
320
}
321
321
322
322
@ Override
323
- public void nodeProperties (TruffleAST graph , ASTNode node , Map <String , ? super Object > properties ) {
323
+ public void nodeProperties (TruffleDebugAST graph , ASTNode node , Map <String , ? super Object > properties ) {
324
324
properties .putAll (node .properties );
325
325
}
326
326
@@ -380,12 +380,12 @@ public Object edgeType(List<ASTEdge> port, int index) {
380
380
}
381
381
382
382
@ Override
383
- public Collection <? extends ASTNode > edgeNodes (TruffleAST graph , ASTNode node , List <ASTEdge > port , int index ) {
383
+ public Collection <? extends ASTNode > edgeNodes (TruffleDebugAST graph , ASTNode node , List <ASTEdge > port , int index ) {
384
384
return List .of (port .get (index ).node );
385
385
}
386
386
387
387
@ Override
388
- public Collection <? extends ASTBlock > blocks (TruffleAST graph ) {
388
+ public Collection <? extends ASTBlock > blocks (TruffleDebugAST graph ) {
389
389
return graph .blocks ;
390
390
}
391
391
@@ -395,7 +395,7 @@ public int blockId(ASTBlock block) {
395
395
}
396
396
397
397
@ Override
398
- public Collection <? extends ASTNode > blockNodes (TruffleAST info , ASTBlock block ) {
398
+ public Collection <? extends ASTNode > blockNodes (TruffleDebugAST info , ASTBlock block ) {
399
399
return block .nodes ;
400
400
}
401
401
0 commit comments