use of jdk.vm.ci.code.InvalidInstalledCodeException in project graal by oracle.
the class AssemblerTest method runTest.
protected Object runTest(String methodName, CodeGenTest test, Object... args) {
Method method = getMethod(methodName);
InstalledCode code = assembleMethod(method, test);
try {
return code.executeVarargs(args);
} catch (InvalidInstalledCodeException e) {
throw new RuntimeException(e);
}
}
use of jdk.vm.ci.code.InvalidInstalledCodeException in project graal by oracle.
the class CompiledMethodTest method test3.
@Test
public void test3() {
final ResolvedJavaMethod javaMethod = getResolvedJavaMethod("testMethod");
InstalledCode compiledMethod = getCode(javaMethod);
try {
Object result = compiledMethod.executeVarargs("1", "2", "3");
Assert.assertEquals("1 2 3", result);
} catch (InvalidInstalledCodeException t) {
Assert.fail("method invalidated");
}
}
use of jdk.vm.ci.code.InvalidInstalledCodeException in project graal by oracle.
the class MarkUnsafeAccessTest method testCompiled.
@Test
public void testCompiled() throws IOException {
ResolvedJavaMethod getMethod = asResolvedJavaMethod(getMethod(ByteBuffer.class, "get", new Class<?>[] {}));
ResolvedJavaType mbbClass = getMetaAccess().lookupJavaType(MappedByteBuffer.class);
ResolvedJavaMethod getMethodImpl = mbbClass.findUniqueConcreteMethod(getMethod).getResult();
Assert.assertNotNull(getMethodImpl);
StructuredGraph graph = parseForCompile(getMethodImpl);
HighTierContext highContext = getDefaultHighTierContext();
new CanonicalizerPhase().apply(graph, highContext);
new InliningPhase(new InlineEverythingPolicy(), new CanonicalizerPhase()).apply(graph, highContext);
InstalledCode compiledCode = getCode(getMethodImpl, graph);
testMappedByteBuffer(mbb -> {
try {
return (byte) compiledCode.executeVarargs(mbb);
} catch (InvalidInstalledCodeException e) {
Assert.fail();
return 0;
}
});
}
use of jdk.vm.ci.code.InvalidInstalledCodeException in project graal by oracle.
the class HotSpotNmethodTest method testInstallCodeInvalidation.
@Test
public void testInstallCodeInvalidation() {
final ResolvedJavaMethod testJavaMethod = getResolvedJavaMethod("foo");
final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo", AllowAssumptions.YES));
Assert.assertTrue(nmethod.isValid());
Object result;
try {
result = nmethod.executeVarargs(null, "b", "c");
assertDeepEquals(43, result);
} catch (InvalidInstalledCodeException e) {
Assert.fail("Code was invalidated");
}
Assert.assertTrue(nmethod.isValid());
nmethod.invalidate();
Assert.assertFalse(nmethod.isValid());
try {
result = nmethod.executeVarargs(null, null, null);
Assert.fail("Code was not invalidated");
} catch (InvalidInstalledCodeException e) {
}
Assert.assertFalse(nmethod.isValid());
}
use of jdk.vm.ci.code.InvalidInstalledCodeException in project graal by oracle.
the class HotSpotNmethodTest method testInstalledCodeCalledFromCompiledCode.
@Test
public void testInstalledCodeCalledFromCompiledCode() {
final ResolvedJavaMethod testJavaMethod = getResolvedJavaMethod("foo");
final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo", AllowAssumptions.YES));
Assert.assertTrue(nmethod.isValid());
try {
for (int i = 0; i < ITERATION_COUNT; ++i) {
nmethod.executeVarargs(null, "b", "c");
}
} catch (InvalidInstalledCodeException e) {
Assert.fail("Code was invalidated");
}
}
Aggregations