use of org.graalvm.compiler.api.replacements.Snippet in project graal by oracle.
the class AllocationSnippets method formatObjectSnippet.
@Snippet
public static Object formatObjectSnippet(Word memory, DynamicHub hub, boolean rememberedSet) {
DynamicHub hubNonNull = (DynamicHub) PiNode.piCastNonNull(hub, SnippetAnchorNode.anchor());
UnsignedWord size = LayoutEncoding.getInstanceSize(hubNonNull.getLayoutEncoding());
return formatObjectImpl(memory, hubNonNull, size, false, true, rememberedSet);
}
use of org.graalvm.compiler.api.replacements.Snippet in project graal by oracle.
the class DefaultJavaLoweringProvider method lowerUnaryMath.
private void lowerUnaryMath(UnaryMathIntrinsicNode math, LoweringTool tool) {
if (tool.getLoweringStage() == LoweringTool.StandardLoweringStage.HIGH_TIER) {
return;
}
ResolvedJavaMethod method = math.graph().method();
if (method != null) {
if (method.getAnnotation(Snippet.class) != null) {
/*
* In the context of the snippet use the LIR lowering instead of the Node lowering.
*/
return;
}
if (method.getName().equalsIgnoreCase(math.getOperation().name()) && tool.getMetaAccess().lookupJavaType(Math.class).equals(method.getDeclaringClass())) {
/*
* A root compilation of the intrinsic method should emit the full assembly
* implementation.
*/
return;
}
}
ForeignCallDescriptor foreignCall = toForeignCall(math.getOperation());
if (foreignCall != null) {
StructuredGraph graph = math.graph();
ForeignCallNode call = math.graph().add(new ForeignCallNode(foreignCalls, foreignCall, math.getValue()));
graph.addAfterFixed(tool.lastFixedNode(), call);
math.replaceAtUsages(call);
}
}
Aggregations