public static ReadRegisterFloatingNode forHeapBase() { return new ReadRegisterFloatingNode(SubstrateRegisterConfig::getHeapBaseRegister); }
@Override public void generate(NodeLIRBuilderTool gen) { VMError.guarantee(usages().filter(FrameState.class).isEmpty(), "When used in a FrameState, need a ReadRegisterFixedNode and not a ReadRegisterFloatingNode"); LIRGeneratorTool tool = gen.getLIRGeneratorTool(); SubstrateRegisterConfig registerConfig = (SubstrateRegisterConfig) tool.getRegisterConfig(); LIRKind lirKind = tool.getLIRKind(FrameAccess.getWordStamp()); RegisterValue value = registerSupplier.apply(registerConfig).asValue(lirKind); gen.setResult(this, value); } }
private static ValueNode currentThread(GraphBuilderContext b, boolean usedForAddress) { /* * A floating node to access the VMThread is more efficient: it allows value numbering of * multiple accesses, and it does not copy the VMThread from the fixed register into a * virtual register. But for deoptimization target methods, we must not do value numbering * because the VMThread is not part of the FrameState and therefore not restored during * deoptimization. And when computing the address of a VMThreadLocal, we must not have the * VMThread in a fixed register because the it can end up in a FrameState (and a FrameState * must not directly reference a fixed register). */ boolean isDeoptTarget = b.getMethod() instanceof SharedMethod && ((SharedMethod) b.getMethod()).isDeoptTarget(); if (isDeoptTarget || usedForAddress) { return b.add(ReadRegisterFixedNode.forIsolateThread()); } else { return b.add(ReadRegisterFloatingNode.forIsolateThread()); } }
public static ReadRegisterFloatingNode forIsolateThread() { return new ReadRegisterFloatingNode(SubstrateRegisterConfig::getThreadRegister); }