use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class Math_pow method run11.
@Test
public void run11() {
OptionValues options = getInitialOptions();
ResolvedJavaMethod method = getResolvedJavaMethod("test");
Object receiver = null;
long testIteration = 0;
for (long l = Long.MIN_VALUE; ; l += STEP) {
double x = Double.longBitsToDouble(l);
double y = x;
testOne(options, method, receiver, testIteration, l, x, y);
y = l < 0 ? Double.longBitsToDouble(Long.MAX_VALUE + l) : Double.longBitsToDouble(Long.MAX_VALUE - l);
testOne(options, method, receiver, testIteration, l, x, y);
if (Long.MAX_VALUE - STEP < l) {
break;
}
testIteration++;
}
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class Math_sqrt method run7.
@Test
public void run7() {
OptionValues options = getInitialOptions();
ResolvedJavaMethod method = getResolvedJavaMethod("test");
testManyValues(options, method);
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class JTTTest method runTest.
protected void runTest(OptionValues options, Set<DeoptimizationReason> shouldNotDeopt, boolean bind, boolean noProfile, String name, Object... args) {
ResolvedJavaMethod method = getResolvedJavaMethod(name);
Object receiver = method.isStatic() ? null : this;
Result expect = executeExpected(method, receiver, args);
if (noProfile) {
method.reprofile();
}
testAgainstExpected(options, method, expect, shouldNotDeopt, receiver, args);
if (args.length > 0 && bind) {
if (noProfile) {
method.reprofile();
}
this.argsToBind = args;
testAgainstExpected(options, method, expect, shouldNotDeopt, receiver, args);
this.argsToBind = null;
}
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class SubstrateReplacements method getSnippet.
@Override
public StructuredGraph getSnippet(ResolvedJavaMethod method, ResolvedJavaMethod recursiveEntry, Object[] args, boolean trackNodeSourcePosition, NodeSourcePosition replaceePosition) {
Integer startOffset = snippetStartOffsets.get(method);
if (startOffset == null) {
throw VMError.shouldNotReachHere("snippet not found: " + method.format("%H.%n(%p)"));
}
ParameterPlugin parameterPlugin = null;
if (args != null) {
parameterPlugin = new ConstantBindingParameterPlugin(args, providers.getMetaAccess(), snippetReflection);
}
EncodedGraph encodedGraph = new EncodedGraph(snippetEncoding, startOffset, snippetObjects, snippetNodeClasses, null, null, null, false, trackNodeSourcePosition);
try (DebugContext debug = openDebugContext("SVMSnippet_", method)) {
StructuredGraph result = new StructuredGraph.Builder(options, debug).method(method).trackNodeSourcePosition(trackNodeSourcePosition).build();
PEGraphDecoder graphDecoder = new PEGraphDecoder(ConfigurationValues.getTarget().arch, result, providers.getMetaAccess(), providers.getConstantReflection(), providers.getConstantFieldProvider(), providers.getStampProvider(), null, snippetInvocationPlugins, new InlineInvokePlugin[0], parameterPlugin, null, null, null) {
@Override
protected EncodedGraph lookupEncodedGraph(ResolvedJavaMethod lookupMethod, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean track) {
if (lookupMethod.equals(method)) {
assert !track || encodedGraph.trackNodeSourcePosition();
return encodedGraph;
} else {
throw VMError.shouldNotReachHere(method.format("%H.%n(%p)"));
}
}
};
graphDecoder.decode(method, trackNodeSourcePosition);
assert result.verify();
return result;
}
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class SubstrateReplacements method registerSnippet.
/**
* Compiles the snippet and stores the graph.
*/
@Platforms(Platform.HOSTED_ONLY.class)
@Override
public void registerSnippet(ResolvedJavaMethod method, boolean trackNodeSourcePosition) {
assert method.getAnnotation(Snippet.class) != null : "Snippet must be annotated with @" + Snippet.class.getSimpleName();
assert method.hasBytecodes() : "Snippet must not be abstract or native";
assert builder.graphs.get(method) == null : "snippet registered twice: " + method.getName();
try (DebugContext debug = openDebugContext("Snippet_", method)) {
StructuredGraph graph = makeGraph(debug, defaultBytecodeProvider, method, null, null, trackNodeSourcePosition, null);
// Check if all methods which should be inlined are really inlined.
for (MethodCallTargetNode callTarget : graph.getNodes(MethodCallTargetNode.TYPE)) {
ResolvedJavaMethod callee = callTarget.targetMethod();
if (!builder.delayedInvocationPluginMethods.contains(callee)) {
throw shouldNotReachHere("method " + callee.getName() + " not inlined in snippet " + method.getName() + " (maybe not final?)");
}
}
builder.graphs.put(method, graph);
}
}
Aggregations