27
27
import java .util .concurrent .Semaphore ;
28
28
import java .util .function .Predicate ;
29
29
30
+ import org .graalvm .polyglot .Context ;
31
+ import org .graalvm .polyglot .Engine ;
32
+ import org .graalvm .polyglot .ResourceLimits ;
33
+ import org .junit .Assert ;
34
+ import org .junit .Test ;
35
+
36
+ import com .oracle .truffle .api .TruffleOptions ;
37
+ import com .oracle .truffle .api .instrumentation .test .InstrumentationTestLanguage ;
38
+ import com .oracle .truffle .runtime .OptimizedCallTarget ;
39
+
30
40
import jdk .graal .compiler .graph .Node ;
31
41
import jdk .graal .compiler .graph .NodeClass ;
32
42
import jdk .graal .compiler .nodes .InvokeWithExceptionNode ;
37
47
import jdk .graal .compiler .nodes .java .MethodCallTargetNode ;
38
48
import jdk .graal .compiler .nodes .memory .ReadNode ;
39
49
import jdk .graal .compiler .nodes .memory .WriteNode ;
40
- import org .graalvm .polyglot .Context ;
41
- import org .graalvm .polyglot .Engine ;
42
- import org .graalvm .polyglot .ResourceLimits ;
43
- import org .junit .Assert ;
44
- import org .junit .Test ;
45
-
46
- import com .oracle .truffle .api .TruffleOptions ;
47
- import com .oracle .truffle .api .instrumentation .test .InstrumentationTestLanguage ;
48
- import com .oracle .truffle .runtime .OptimizedCallTarget ;
49
50
50
51
public class ResourceLimitsCompilationTest extends PartialEvaluationTest {
51
52
@@ -64,8 +65,8 @@ public void testStatementLimitSingleContext() {
64
65
/*
65
66
* Verify that the statements fold to a single read/write.
66
67
*/
67
- Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("PolyglotContextImpl.statementCounter" )));
68
- Assert .assertEquals (1 , countNodes (graph , WriteNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("PolyglotContextImpl.statementCounter" )));
68
+ Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("com.oracle.truffle.polyglot. PolyglotContextImpl.statementCounter" )));
69
+ Assert .assertEquals (1 , countNodes (graph , WriteNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("com.oracle.truffle.polyglot. PolyglotContextImpl.statementCounter" )));
69
70
}
70
71
}
71
72
@@ -125,9 +126,9 @@ public void testStatementLimitMultiContextTwoDifferentConfigs() {
125
126
if (!TruffleOptions .AOT ) {
126
127
Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("JavaThread::<JVMCIReservedOop0>" )));
127
128
}
128
- Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("PolyglotContextImpl.statementCounter" )));
129
- Assert .assertEquals (0 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("PolyglotContextImpl.statementLimit" )));
130
- Assert .assertEquals (1 , countNodes (graph , WriteNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("PolyglotContextImpl.statementCounter" )));
129
+ Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("com.oracle.truffle.polyglot. PolyglotContextImpl.statementCounter" )));
130
+ Assert .assertEquals (0 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("com.oracle.truffle.polyglot. PolyglotContextImpl.statementLimit" )));
131
+ Assert .assertEquals (1 , countNodes (graph , WriteNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("com.oracle.truffle.polyglot. PolyglotContextImpl.statementCounter" )));
131
132
}
132
133
}
133
134
}
@@ -145,9 +146,9 @@ private void assertLimitCheckFastPath(Context context) {
145
146
if (!TruffleOptions .AOT ) {
146
147
Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("JavaThread::<JVMCIReservedOop0>" )));
147
148
}
148
- Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("PolyglotContextImpl.statementCounter" )));
149
- Assert .assertEquals (1 , countNodes (graph , WriteNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("PolyglotContextImpl.statementCounter" )));
150
- Assert .assertEquals (0 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("PolyglotContextImpl.statementLimit" )));
149
+ Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("com.oracle.truffle.polyglot. PolyglotContextImpl.statementCounter" )));
150
+ Assert .assertEquals (1 , countNodes (graph , WriteNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("com.oracle.truffle.polyglot. PolyglotContextImpl.statementCounter" )));
151
+ Assert .assertEquals (0 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("com.oracle.truffle.polyglot. PolyglotContextImpl.statementLimit" )));
151
152
}
152
153
153
154
@ Test
@@ -170,8 +171,8 @@ public void testStatementLimitEngineMultiThread() throws InterruptedException {
170
171
* Verify that the statements fold to a single read for the context and a single
171
172
* read/write for the statement counts.
172
173
*/
173
- Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("PolyglotContextImpl.statementCounter" )));
174
- Assert .assertEquals (1 , countNodes (graph , WriteNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("PolyglotContextImpl.statementCounter" )));
174
+ Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("com.oracle.truffle.polyglot. PolyglotContextImpl.statementCounter" )));
175
+ Assert .assertEquals (1 , countNodes (graph , WriteNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("com.oracle.truffle.polyglot. PolyglotContextImpl.statementCounter" )));
175
176
Assert .assertEquals (0 , countNodes (graph , InvokeWithExceptionNode .TYPE ));
176
177
}
177
178
}
0 commit comments