use of org.graalvm.compiler.hotspot.replacements.ObjectCloneNode in project graal by oracle.
the class HotSpotGraphBuilderPlugins method registerObjectPlugins.
private static void registerObjectPlugins(InvocationPlugins plugins, OptionValues options, BytecodeProvider bytecodeProvider) {
Registration r = new Registration(plugins, Object.class, bytecodeProvider);
if (!GeneratePIC.getValue(options)) {
// FIXME: clone() requires speculation and requires a fix in here (to check that
// b.getAssumptions() != null), and in ReplacementImpl.getSubstitution() where there is
// an instantiation of IntrinsicGraphBuilder using a constructor that sets
// AllowAssumptions to YES automatically. The former has to inherit the assumptions
// settings from the root compile instead. So, for now, I'm disabling it for
// GeneratePIC.
r.register1("clone", Receiver.class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
ValueNode object = receiver.get();
b.addPush(JavaKind.Object, new ObjectCloneNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnStamp(b.getAssumptions()), object));
return true;
}
@Override
public boolean inlineOnly() {
return true;
}
});
}
r.registerMethodSubstitution(ObjectSubstitutions.class, "hashCode", Receiver.class);
}
Aggregations