use of org.graalvm.compiler.core.common.CompressEncoding in project graal by oracle.
the class SubstrateAMD64AddressLowering method improveUncompression.
@Override
protected final boolean improveUncompression(AMD64AddressNode addr, CompressionNode compression, ValueNode other) {
assert SubstrateOptions.UseHeapBaseRegister.getValue();
CompressEncoding encoding = compression.getEncoding();
Scale scale = Scale.fromShift(encoding.getShift());
if (scale == null) {
return false;
}
long encodingBase = encoding.getBase();
ValueNode base = other;
if (heapBaseRegister != null && encodingBase == heapBase) {
if (other != null) {
return false;
}
base = compression.graph().unique(new HeapBaseNode(heapBaseRegister));
} else if (encodingBase != 0) {
if (!updateDisplacement(addr, encodingBase, false)) {
return false;
}
}
addr.setBase(base);
addr.setScale(scale);
addr.setIndex(compression.getValue());
return true;
}
use of org.graalvm.compiler.core.common.CompressEncoding in project graal by oracle.
the class SPARCHotSpotLIRGenerator method emitNullCheck.
@Override
public void emitNullCheck(Value address, LIRFrameState state) {
PlatformKind kind = address.getPlatformKind();
if (kind == WORD) {
CompressEncoding encoding = config.getOopEncoding();
Value uncompressed = emitUncompress(address, encoding, false);
append(new NullCheckOp(asAddressValue(uncompressed), state));
} else {
super.emitNullCheck(address, state);
}
}
use of org.graalvm.compiler.core.common.CompressEncoding in project graal by oracle.
the class NativeImageHeap method writeReference.
void writeReference(RelocatableBuffer buffer, int index, Object target, Object reason) {
assert !(target instanceof WordBase) : "word values are not references";
mustBeAligned(index);
if (target != null) {
ObjectInfo targetInfo = objects.get(target);
verifyTargetDidNotChange(target, reason, targetInfo);
if (useHeapBase()) {
CompressEncoding compressEncoding = ImageSingletons.lookup(CompressEncoding.class);
int shift = compressEncoding.getShift();
writePointer(buffer, index, targetInfo.getOffsetInSection() >>> shift);
} else {
buffer.addDirectRelocationWithoutAddend(index, objectSize(), target);
}
}
}
use of org.graalvm.compiler.core.common.CompressEncoding in project graal by oracle.
the class DataPatchTest method registerInvocationPlugins.
@Override
protected void registerInvocationPlugins(InvocationPlugins invocationPlugins) {
Registration r = new Registration(invocationPlugins, DataPatchTest.class);
r.register1("compressUncompress", Object.class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg) {
CompressEncoding encoding = runtime().getVMConfig().getOopEncoding();
ValueNode compressed = b.add(HotSpotCompressionNode.compress(arg, encoding));
ValueNode proxy = b.add(new OpaqueNode(compressed));
b.addPush(JavaKind.Object, HotSpotCompressionNode.uncompress(proxy, encoding));
return true;
}
});
super.registerInvocationPlugins(invocationPlugins);
}
use of org.graalvm.compiler.core.common.CompressEncoding in project graal by oracle.
the class AMD64HotSpotLIRGenerator method emitNullCheck.
@Override
public void emitNullCheck(Value address, LIRFrameState state) {
if (address.getValueKind().getPlatformKind() == getLIRKindTool().getNarrowOopKind().getPlatformKind()) {
CompressEncoding encoding = config.getOopEncoding();
Value uncompressed;
if (encoding.getShift() <= 3) {
LIRKind wordKind = LIRKind.unknownReference(target().arch.getWordKind());
uncompressed = new AMD64AddressValue(wordKind, getProviders().getRegisters().getHeapBaseRegister().asValue(wordKind), asAllocatable(address), Scale.fromInt(1 << encoding.getShift()), 0);
} else {
uncompressed = emitUncompress(address, encoding, false);
}
append(new AMD64Move.NullCheckOp(asAddressValue(uncompressed), state));
return;
}
super.emitNullCheck(address, state);
}
Aggregations