use of jdk.vm.ci.hotspot.HotSpotNmethod 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.hotspot.HotSpotNmethod 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");
}
}
use of jdk.vm.ci.hotspot.HotSpotNmethod in project graal by oracle.
the class HotSpotNmethodTest method testInstallCodeInvalidationWhileRunning.
@Test
public void testInstallCodeInvalidationWhileRunning() {
final ResolvedJavaMethod testJavaMethod = getResolvedJavaMethod("foo");
final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo", AllowAssumptions.YES));
Object result;
try {
result = nmethod.executeVarargs(nmethod, null, null);
assertDeepEquals(43, result);
} catch (InvalidInstalledCodeException e) {
Assert.fail("Code was invalidated");
}
Assert.assertFalse(nmethod.isValid());
}
Aggregations