Search in sources :

Example 6 with MethodSubstitution

use of org.graalvm.compiler.api.replacements.MethodSubstitution in project graal by oracle.

the class SHA5Substitutions 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.sha5ImplCompressStub(bufAddr, stateAddr);
}
Also used : Word(org.graalvm.compiler.word.Word) MethodSubstitution(org.graalvm.compiler.api.replacements.MethodSubstitution)

Example 7 with MethodSubstitution

use of org.graalvm.compiler.api.replacements.MethodSubstitution in project graal by oracle.

the class ThreadSubstitutions method isInterrupted.

/**
 * hidden in 9.
 */
@MethodSubstitution(isStatic = false, optional = true)
public static boolean isInterrupted(final Thread thisObject, boolean clearInterrupted) {
    Word javaThread = CurrentJavaThreadNode.get();
    Object thread = javaThread.readObject(threadObjectOffset(INJECTED_VMCONFIG), JAVA_THREAD_THREAD_OBJECT_LOCATION);
    if (thisObject == thread) {
        Word osThread = javaThread.readWord(osThreadOffset(INJECTED_VMCONFIG), JAVA_THREAD_OSTHREAD_LOCATION);
        boolean interrupted = osThread.readInt(osThreadInterruptedOffset(INJECTED_VMCONFIG), any()) != 0;
        if (!interrupted || !clearInterrupted) {
            return interrupted;
        }
    }
    return threadIsInterruptedStub(THREAD_IS_INTERRUPTED, thisObject, clearInterrupted);
}
Also used : Word(org.graalvm.compiler.word.Word) MethodSubstitution(org.graalvm.compiler.api.replacements.MethodSubstitution)

Example 8 with MethodSubstitution

use of org.graalvm.compiler.api.replacements.MethodSubstitution in project graal by oracle.

the class CRC32Substitutions method update.

/**
 * Removed in 9.
 */
@MethodSubstitution(optional = true)
static int update(int crc, int b) {
    final Pointer crcTableRawAddress = WordFactory.pointer(GraalHotSpotVMConfigNode.crcTableAddress());
    int c = ~crc;
    int index = (b ^ c) & 0xFF;
    int offset = index << 2;
    int result = crcTableRawAddress.readInt(offset);
    result = result ^ (c >>> 8);
    return ~result;
}
Also used : Pointer(org.graalvm.word.Pointer) MethodSubstitution(org.graalvm.compiler.api.replacements.MethodSubstitution)

Aggregations

MethodSubstitution (org.graalvm.compiler.api.replacements.MethodSubstitution)8 Word (org.graalvm.compiler.word.Word)5 Pointer (org.graalvm.word.Pointer)2 KlassPointer (org.graalvm.compiler.hotspot.word.KlassPointer)1