Search in sources :

Example 6 with Word

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);
}
Also used : Word(org.graalvm.compiler.word.Word) MethodSubstitution(org.graalvm.compiler.api.replacements.MethodSubstitution)

Example 7 with Word

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);
}
Also used : Word(org.graalvm.compiler.word.Word) MethodSubstitution(org.graalvm.compiler.api.replacements.MethodSubstitution)

Example 8 with Word

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;
}
Also used : Word(org.graalvm.compiler.word.Word)

Example 9 with Word

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());
            }
        }
    }
}
Also used : Word(org.graalvm.compiler.word.Word) UnsignedWord(org.graalvm.word.UnsignedWord) HotSpotReplacementsUtil.registerAsWord(org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord) Pointer(org.graalvm.word.Pointer) Snippet(org.graalvm.compiler.api.replacements.Snippet)

Example 10 with Word

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);
    }
}
Also used : Word(org.graalvm.compiler.word.Word) UnsignedWord(org.graalvm.word.UnsignedWord) HotSpotReplacementsUtil.registerAsWord(org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord)

Aggregations

Word (org.graalvm.compiler.word.Word)53 HotSpotReplacementsUtil.registerAsWord (org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord)32 Snippet (org.graalvm.compiler.api.replacements.Snippet)22 Pointer (org.graalvm.word.Pointer)12 UnsignedWord (org.graalvm.word.UnsignedWord)7 MethodSubstitution (org.graalvm.compiler.api.replacements.MethodSubstitution)5 KlassPointer (org.graalvm.compiler.hotspot.word.KlassPointer)5 HotSpotReplacementsUtil.tlabIntArrayMarkWord (org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.tlabIntArrayMarkWord)4 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)2 HotSpotReplacementsUtil.loadKlassFromObject (org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.loadKlassFromObject)2 SignedWord (org.graalvm.word.SignedWord)2 Substitute (com.oracle.svm.core.annotate.Substitute)1 SubstrateObjectConstant (com.oracle.svm.core.meta.SubstrateObjectConstant)1 Pwd.passwd (com.oracle.svm.core.posix.headers.Pwd.passwd)1 Pwd.passwdPointer (com.oracle.svm.core.posix.headers.Pwd.passwdPointer)1 PrimitiveConstant (jdk.vm.ci.meta.PrimitiveConstant)1 HotSpotReplacementsUtil.arrayPrototypeMarkWord (org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayPrototypeMarkWord)1 GuardingNode (org.graalvm.compiler.nodes.extended.GuardingNode)1 Isolate (org.graalvm.nativeimage.Isolate)1 PinnedObject (org.graalvm.nativeimage.PinnedObject)1