use of jdk.vm.ci.code.InvalidInstalledCodeException 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());
}
use of jdk.vm.ci.code.InvalidInstalledCodeException in project graal by oracle.
the class HotSpotStackIntrospectionTest method test.
private void test(String name) throws InvalidInstalledCodeException {
ResolvedJavaMethod method = getMetaAccess().lookupJavaMethod(getMethod(name));
Function<Void, Void> f = o -> {
stackIntrospection.iterateFrames(null, null, 0, frame -> {
if (frame.getMethod().equals(method)) {
frame.materializeVirtualObjects(true);
}
return null;
});
return null;
};
InstalledCode code = getCode(method);
code.executeVarargs(f);
}
use of jdk.vm.ci.code.InvalidInstalledCodeException in project graal by oracle.
the class CompiledMethodTest method test4.
@Test
public void test4() {
final ResolvedJavaMethod javaMethod = getResolvedJavaMethod("testMethodVirtual");
InstalledCode compiledMethod = getCode(javaMethod);
try {
f1 = "0";
Object result = compiledMethod.executeVarargs(this, "1", "2", "3");
Assert.assertEquals("0 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 CompiledMethodTest method test1.
/**
* Usages of the constant {@code " "} are replaced with the constant {@code "-"} and it is
* verified that executing the compiled code produces a result that the preserves the node
* replacement unless deoptimization occurs (e.g., due to -Xcomp causing profiles to be
* missing).
*/
@Test
public void test1() {
final ResolvedJavaMethod javaMethod = getResolvedJavaMethod("testMethod");
final StructuredGraph graph = parseEager(javaMethod, AllowAssumptions.NO);
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
new DeadCodeEliminationPhase().apply(graph);
for (ConstantNode node : ConstantNode.getConstantNodes(graph)) {
if (node.getStackKind() == JavaKind.Object && " ".equals(getSnippetReflection().asObject(String.class, node.asJavaConstant()))) {
node.replace(graph, ConstantNode.forConstant(getSnippetReflection().forObject("-"), getMetaAccess(), graph));
}
}
InstalledCode compiledMethod = getCode(javaMethod, graph);
try {
Object result = compiledMethod.executeVarargs("1", "2", "3");
if (!"1-2-3".equals(result)) {
// Deoptimization probably occurred
Assert.assertEquals("interpreter", result);
}
} catch (InvalidInstalledCodeException t) {
Assert.fail("method invalidated");
}
}
Aggregations