Mercurial > hg > truffle
comparison graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java @ 20854:3081a57f95fd
converted @MethodSubstitutions for java.lang.Math to MethodSubstitutionPlugins
moved support for AMD64 specific Math intrinsics into AMD64 specific name spaces
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 08 Apr 2015 22:09:05 +0200 |
parents | a74c785068e0 |
children | c9a8c62c60fc |
comparison
equal
deleted
inserted
replaced
20853:a74c785068e0 | 20854:3081a57f95fd |
---|---|
299 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) { | 299 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) { |
300 b.push(Kind.Double, b.recursiveAppend(new SqrtNode(value).canonical(null, value))); | 300 b.push(Kind.Double, b.recursiveAppend(new SqrtNode(value).canonical(null, value))); |
301 return true; | 301 return true; |
302 } | 302 } |
303 }); | 303 }); |
304 r.register2("pow", Double.TYPE, Double.TYPE, new InvocationPlugin() { | |
305 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) { | |
306 ValueNode folded = MathPowNode.tryFold(x, y); | |
307 if (folded != null) { | |
308 b.addPush(Kind.Double, folded); | |
309 } else { | |
310 b.addPush(Kind.Double, new MathPowNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnType(), x, y)); | |
311 } | |
312 return true; | |
313 } | |
314 }); | |
315 } | 304 } |
316 | 305 |
317 public static class UnsignedMathPlugin implements InvocationPlugin { | 306 public static class UnsignedMathPlugin implements InvocationPlugin { |
318 private final Condition condition; | 307 private final Condition condition; |
319 | 308 |