2727import java .util .concurrent .Semaphore ;
2828import java .util .function .Predicate ;
2929
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+
3040import jdk .graal .compiler .graph .Node ;
3141import jdk .graal .compiler .graph .NodeClass ;
3242import jdk .graal .compiler .nodes .InvokeWithExceptionNode ;
3747import jdk .graal .compiler .nodes .java .MethodCallTargetNode ;
3848import jdk .graal .compiler .nodes .memory .ReadNode ;
3949import 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 ;
4950
5051public class ResourceLimitsCompilationTest extends PartialEvaluationTest {
5152
@@ -64,8 +65,8 @@ public void testStatementLimitSingleContext() {
6465 /*
6566 * Verify that the statements fold to a single read/write.
6667 */
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" )));
6970 }
7071 }
7172
@@ -125,9 +126,9 @@ public void testStatementLimitMultiContextTwoDifferentConfigs() {
125126 if (!TruffleOptions .AOT ) {
126127 Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("JavaThread::<JVMCIReservedOop0>" )));
127128 }
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" )));
131132 }
132133 }
133134 }
@@ -145,9 +146,9 @@ private void assertLimitCheckFastPath(Context context) {
145146 if (!TruffleOptions .AOT ) {
146147 Assert .assertEquals (1 , countNodes (graph , ReadNode .TYPE , (n ) -> n .getLocationIdentity ().toString ().equals ("JavaThread::<JVMCIReservedOop0>" )));
147148 }
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" )));
151152 }
152153
153154 @ Test
@@ -170,8 +171,8 @@ public void testStatementLimitEngineMultiThread() throws InterruptedException {
170171 * Verify that the statements fold to a single read for the context and a single
171172 * read/write for the statement counts.
172173 */
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" )));
175176 Assert .assertEquals (0 , countNodes (graph , InvokeWithExceptionNode .TYPE ));
176177 }
177178 }
0 commit comments