use of org.graalvm.compiler.word.Word in project graal by oracle.
the class SHA2Substitutions method implCompress0.
@MethodSubstitution(isStatic = false)
static void implCompress0(Object receiver, byte[] buf, int ofs) {
Object realReceiver = PiNode.piCastNonNull(receiver, shaClass);
Object state = RawLoadNode.load(realReceiver, stateOffset, JavaKind.Object, LocationIdentity.any());
Word bufAddr = WordFactory.unsigned(ComputeObjectAddressNode.get(buf, getArrayBaseOffset(JavaKind.Byte) + ofs));
Word stateAddr = WordFactory.unsigned(ComputeObjectAddressNode.get(state, getArrayBaseOffset(JavaKind.Int)));
HotSpotBackend.sha2ImplCompressStub(bufAddr, stateAddr);
}
use of org.graalvm.compiler.word.Word in project graal by oracle.
the class SHASubstitutions method implCompress0.
@MethodSubstitution(isStatic = false)
static void implCompress0(Object receiver, byte[] buf, int ofs) {
Object realReceiver = PiNode.piCastNonNull(receiver, shaClass);
Object state = RawLoadNode.load(realReceiver, stateOffset, JavaKind.Object, LocationIdentity.any());
Word bufAddr = WordFactory.unsigned(ComputeObjectAddressNode.get(buf, getArrayBaseOffset(JavaKind.Byte) + ofs));
Word stateAddr = WordFactory.unsigned(ComputeObjectAddressNode.get(state, getArrayBaseOffset(JavaKind.Int)));
HotSpotBackend.shaImplCompressStub(bufAddr, stateAddr);
}
use of org.graalvm.compiler.word.Word in project graal by oracle.
the class TypeCheckSnippetUtils method checkSelfAndSupers.
private static boolean checkSelfAndSupers(KlassPointer t, KlassPointer s, Counters counters) {
// if (T == S) return true
if (s.equal(t)) {
counters.equalsSecondary.inc();
return true;
}
// if (S.scan_s_s_array(T)) { S.cache = T; return true; }
Word secondarySupers = s.readWord(secondarySupersOffset(INJECTED_VMCONFIG), SECONDARY_SUPERS_LOCATION);
int length = secondarySupers.readInt(metaspaceArrayLengthOffset(INJECTED_VMCONFIG), METASPACE_ARRAY_LENGTH_LOCATION);
for (int i = 0; i < length; i++) {
if (probability(NOT_LIKELY_PROBABILITY, t.equal(loadSecondarySupersElement(secondarySupers, i)))) {
s.writeKlassPointer(secondarySuperCacheOffset(INJECTED_VMCONFIG), t, SECONDARY_SUPER_CACHE_LOCATION);
counters.secondariesHit.inc();
return true;
}
}
counters.secondariesMiss.inc();
return false;
}
use of org.graalvm.compiler.word.Word in project graal by oracle.
the class WriteBarrierSnippets method g1PreWriteBarrier.
@Snippet
public static void g1PreWriteBarrier(Address address, Object object, Object expectedObject, @ConstantParameter boolean doLoad, @ConstantParameter boolean nullCheck, @ConstantParameter Register threadRegister, @ConstantParameter boolean trace, @ConstantParameter Counters counters) {
if (nullCheck) {
NullCheckNode.nullCheck(address);
}
Word thread = registerAsWord(threadRegister);
verifyOop(object);
Object fixedExpectedObject = FixedValueAnchorNode.getObject(expectedObject);
Word field = Word.fromAddress(address);
Pointer previousOop = Word.objectToTrackedPointer(fixedExpectedObject);
byte markingValue = thread.readByte(g1SATBQueueMarkingOffset(INJECTED_VMCONFIG));
int gcCycle = 0;
if (trace) {
Pointer gcTotalCollectionsAddress = WordFactory.pointer(HotSpotReplacementsUtil.gcTotalCollectionsAddress(INJECTED_VMCONFIG));
gcCycle = (int) gcTotalCollectionsAddress.readLong(0);
log(trace, "[%d] G1-Pre Thread %p Object %p\n", gcCycle, thread.rawValue(), Word.objectToTrackedPointer(object).rawValue());
log(trace, "[%d] G1-Pre Thread %p Expected Object %p\n", gcCycle, thread.rawValue(), Word.objectToTrackedPointer(fixedExpectedObject).rawValue());
log(trace, "[%d] G1-Pre Thread %p Field %p\n", gcCycle, thread.rawValue(), field.rawValue());
log(trace, "[%d] G1-Pre Thread %p Marking %d\n", gcCycle, thread.rawValue(), markingValue);
log(trace, "[%d] G1-Pre Thread %p DoLoad %d\n", gcCycle, thread.rawValue(), doLoad ? 1L : 0L);
}
counters.g1AttemptedPreWriteBarrierCounter.inc();
// If the concurrent marker is enabled, the barrier is issued.
if (probability(NOT_FREQUENT_PROBABILITY, markingValue != (byte) 0)) {
// The load is always issued except the cases of CAS and referent field.
if (probability(LIKELY_PROBABILITY, doLoad)) {
previousOop = Word.objectToTrackedPointer(field.readObject(0, BarrierType.NONE));
if (trace) {
log(trace, "[%d] G1-Pre Thread %p Previous Object %p\n ", gcCycle, thread.rawValue(), previousOop.rawValue());
verifyOop(previousOop.toObject());
}
}
counters.g1EffectivePreWriteBarrierCounter.inc();
// If the previous value is null the barrier should not be issued.
if (probability(FREQUENT_PROBABILITY, previousOop.notEqual(0))) {
counters.g1ExecutedPreWriteBarrierCounter.inc();
// If the thread-local SATB buffer is full issue a native call which will
// initialize a new one and add the entry.
Word indexAddress = thread.add(g1SATBQueueIndexOffset(INJECTED_VMCONFIG));
Word indexValue = indexAddress.readWord(0);
if (probability(FREQUENT_PROBABILITY, indexValue.notEqual(0))) {
Word bufferAddress = thread.readWord(g1SATBQueueBufferOffset(INJECTED_VMCONFIG));
Word nextIndex = indexValue.subtract(wordSize());
Word logAddress = bufferAddress.add(nextIndex);
// Log the object to be marked as well as update the SATB's buffer next index.
logAddress.writeWord(0, previousOop, GC_LOG_LOCATION);
indexAddress.writeWord(0, nextIndex, GC_INDEX_LOCATION);
} else {
g1PreBarrierStub(G1WBPRECALL, previousOop.toObject());
}
}
}
}
use of org.graalvm.compiler.word.Word in project graal by oracle.
the class WriteBarrierSnippets method serialWriteBarrier.
private static void serialWriteBarrier(Pointer ptr, Counters counters) {
counters.serialWriteBarrierCounter.inc();
final long startAddress = GraalHotSpotVMConfigNode.cardTableAddress();
Word base = (Word) ptr.unsignedShiftRight(cardTableShift(INJECTED_VMCONFIG));
if (((int) startAddress) == startAddress && GraalHotSpotVMConfigNode.isCardTableAddressConstant()) {
base.writeByte((int) startAddress, (byte) 0, GC_CARD_LOCATION);
} else {
base.writeByte(WordFactory.unsigned(startAddress), (byte) 0, GC_CARD_LOCATION);
}
}
Aggregations