@@ -72,22 +72,21 @@ final class GraphManager {
72
72
this .useSize = TruffleCompilerOptions .InliningUseSize .getValue (rootContext .compilerOptions );
73
73
}
74
74
75
+ TruffleTierContext rootContext () {
76
+ return rootContext ;
77
+ }
78
+
75
79
@ SuppressWarnings ("try" )
76
80
Entry pe (TruffleCompilable truffleAST ) {
77
81
Entry entry = irCache .get (truffleAST );
78
82
if (entry == null ) {
79
83
// the guest scope represents the guest language method of truffle
80
84
try (AutoCloseable guestScope = rootContext .debug .scope ("Truffle" , new TruffleDebugJavaMethod (rootContext .task , truffleAST ))) {
81
- final PEAgnosticInlineInvokePlugin plugin = newPlugin ();
82
85
final TruffleTierContext context = rootContext .createInlineContext (truffleAST );
83
86
try (Scope hostScope = context .debug .scope ("CreateGraph" , context .graph );
84
87
Indent indent = context .debug .logAndIndent ("evaluate %s" , context .graph );) {
85
- partialEvaluator .doGraphPE (context , plugin , graphCacheForInlining );
86
- context .graph .getAssumptions ().record (new TruffleAssumption (context .getNodeRewritingAssumption (partialEvaluator .getProviders ())));
87
- StructuredGraph graphAfterPE = copyGraphForDebugDump (context );
88
- postPartialEvaluationSuite .apply (context .graph , context );
89
- entry = new Entry (context .graph , plugin , graphAfterPE , useSize ? NodeCostUtil .computeGraphSize (context .graph ) : -1 );
90
- context .debug .dump (DebugContext .INFO_LEVEL , context .graph , "After PE Tier" );
88
+ TruffleAssumption nodeRewritingAssumption = new TruffleAssumption (context .getNodeRewritingAssumption (partialEvaluator .getProviders ()));
89
+ entry = pe (context , nodeRewritingAssumption , DebugContext .INFO_LEVEL );
91
90
} catch (Throwable e ) {
92
91
throw context .debug .handle (e );
93
92
}
@@ -99,21 +98,20 @@ Entry pe(TruffleCompilable truffleAST) {
99
98
return entry ;
100
99
}
101
100
102
- private PEAgnosticInlineInvokePlugin newPlugin () {
103
- return new PEAgnosticInlineInvokePlugin (partialEvaluator );
104
- }
105
-
106
- TruffleTierContext rootContext () {
107
- return rootContext ;
101
+ Entry peRoot () {
102
+ return pe (rootContext , null , DebugContext .BASIC_LEVEL );
108
103
}
109
104
110
- Entry peRoot () {
111
- final PEAgnosticInlineInvokePlugin plugin = newPlugin ();
112
- partialEvaluator .doGraphPE (rootContext , plugin , graphCacheForInlining );
113
- StructuredGraph graphAfterPE = copyGraphForDebugDump (rootContext );
114
- postPartialEvaluationSuite .apply (rootContext .graph , rootContext );
115
- rootContext .debug .dump (DebugContext .BASIC_LEVEL , rootContext .graph , "After PE Tier" );
116
- return new Entry (rootContext .graph , plugin , graphAfterPE , useSize ? NodeCostUtil .computeGraphSize (rootContext .graph ) : -1 );
105
+ private Entry pe (TruffleTierContext context , TruffleAssumption nodeRewritingAssumption , int dumpLevel ) {
106
+ final PEAgnosticInlineInvokePlugin plugin = new PEAgnosticInlineInvokePlugin (partialEvaluator );
107
+ partialEvaluator .doGraphPE (context , plugin , graphCacheForInlining );
108
+ if (nodeRewritingAssumption != null ) {
109
+ context .graph .getAssumptions ().record (nodeRewritingAssumption );
110
+ }
111
+ final StructuredGraph graphAfterPE = copyGraphForDebugDump (context );
112
+ postPartialEvaluationSuite .apply (context .graph , context );
113
+ context .debug .dump (dumpLevel , context .graph , "After PE Tier" );
114
+ return new Entry (context .graph , plugin , graphAfterPE , useSize ? NodeCostUtil .computeGraphSize (context .graph ) : -1 );
117
115
}
118
116
119
117
UnmodifiableEconomicMap <Node , Node > doInline (Invoke invoke , StructuredGraph ir , TruffleCompilable truffleAST , InliningUtil .InlineeReturnAction returnAction ) {
0 commit comments