use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class HotSpotGraphBuilderPlugins method registerThreadPlugins.
private static void registerThreadPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess, WordTypes wordTypes, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) {
Registration r = new Registration(plugins, Thread.class, bytecodeProvider);
r.register0("currentThread", new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
CurrentJavaThreadNode thread = b.add(new CurrentJavaThreadNode(wordTypes.getWordKind()));
ValueNode offset = b.add(ConstantNode.forLong(config.threadObjectOffset));
AddressNode address = b.add(new OffsetAddressNode(thread, offset));
// JavaThread::_threadObj is never compressed
ObjectStamp stamp = StampFactory.objectNonNull(TypeReference.create(b.getAssumptions(), metaAccess.lookupJavaType(Thread.class)));
b.addPush(JavaKind.Object, new ReadNode(address, JAVA_THREAD_THREAD_OBJECT_LOCATION, stamp, BarrierType.NONE));
return true;
}
});
r.registerMethodSubstitution(ThreadSubstitutions.class, "isInterrupted", Receiver.class, boolean.class);
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class AMD64AddressLoweringTest method convertBaseAndIndexToDisplacement.
@Test
public void convertBaseAndIndexToDisplacement() {
ValueNode base = graph.unique(const64(1000));
ValueNode index = graph.unique(const64(10));
AddressNode result = lowering.lower(base, index);
assertAddress(result, null, null, Scale.Times1, 1010);
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class AMD64AddressLoweringTest method convertBaseAndShiftedIndexToDisplacement.
@Test
public void convertBaseAndShiftedIndexToDisplacement() {
ValueNode base = graph.addOrUniqueWithInputs(const64(1000));
ValueNode index = graph.addOrUniqueWithInputs(new LeftShiftNode(const64(10), const32(1)));
AddressNode result = lowering.lower(base, index);
assertAddress(result, null, null, Scale.Times2, 1020);
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class AMD64AddressLoweringTest method convertBaseAndNegatedShiftedIndexToDisplacement.
@Test
public void convertBaseAndNegatedShiftedIndexToDisplacement() {
ValueNode base = graph.addOrUniqueWithInputs(const64(1000));
ValueNode index = graph.addOrUniqueWithInputs(new NegateNode(new LeftShiftNode(const64(10), const32(2))));
AddressNode result = lowering.lower(base, index);
assertAddress(result, null, null, Scale.Times4, 960);
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class AMD64AddressLoweringTest method convertBaseToDisplacement.
@Test
public void convertBaseToDisplacement() {
ValueNode constantAddress = graph.addOrUniqueWithInputs(const64(1000));
AddressNode result = lowering.lower(constantAddress, null);
assertAddress(result, null, null, Scale.Times1, 1000);
}
Aggregations