Search in sources :

Example 31 with Uninterruptible

use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.

the class InstalledCodeBuilder method writeObjectConstantsToCode.

@Uninterruptible(reason = "Operates on raw pointers to objects")
private void writeObjectConstantsToCode(ObjectConstantsHolder objectConstants) {
    boolean compressed = ReferenceAccess.singleton().haveCompressedReferences();
    Pointer constantsStart = code.add(constantsOffset);
    for (int i = 0; i < objectConstants.count; i++) {
        Pointer address = constantsStart.add(objectConstants.offsets[i]);
        ReferenceAccess.singleton().writeObjectAt(address, objectConstants.values[i], compressed);
    }
    /* From now on the constantsWalker will operate on the constants area. */
    constantsWalker.pointerMapValid = true;
}
Also used : CodePointer(org.graalvm.nativeimage.c.function.CodePointer) Pointer(org.graalvm.word.Pointer) Infopoint(jdk.vm.ci.code.site.Infopoint) Uninterruptible(com.oracle.svm.core.annotate.Uninterruptible)

Example 32 with Uninterruptible

use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.

the class PosixCEntryPointSnippets method enterIsolateMT.

@Uninterruptible(reason = "Thread state not set up yet")
@SubstrateForeignCallTarget
private static int enterIsolateMT(Isolate isolate) {
    int sanityError = PosixIsolates.checkSanity(isolate);
    if (sanityError != Errors.NO_ERROR) {
        return sanityError;
    }
    if (UseHeapBaseRegister.getValue()) {
        setHeapBase(PosixIsolates.getHeapBase(isolate));
    }
    if (!PosixVMThreads.isInitialized()) {
        return Errors.UNINITIALIZED_ISOLATE;
    }
    IsolateThread thread = PosixVMThreads.VMThreadTL.get();
    if (VMThreads.isNullThread(thread)) {
        return Errors.UNATTACHED_THREAD;
    }
    writeCurrentVMThread(thread);
    return Errors.NO_ERROR;
}
Also used : IsolateThread(org.graalvm.nativeimage.IsolateThread) Safepoint(com.oracle.svm.core.thread.Safepoint) SubstrateForeignCallTarget(com.oracle.svm.core.snippets.SubstrateForeignCallTarget) Uninterruptible(com.oracle.svm.core.annotate.Uninterruptible)

Example 33 with Uninterruptible

use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.

the class MethodSafepointInsertionPhase method run.

@Override
protected void run(StructuredGraph graph) {
    if (graph.method().getAnnotation(Uninterruptible.class) != null) {
        /*
             * If a method is annotated with {@link Uninterruptible}, then I do not want a test for
             * a safepoint at the return.
             */
        return;
    }
    if (graph.method().getAnnotation(CFunction.class) != null) {
        /*
             * If a method transfers from Java to C, then the return transition (if any) contains
             * the safepoint test and one is not needed at the return of the transferring method.
             */
        return;
    }
    if (((SharedMethod) graph.method()).isEntryPoint()) {
        /*
             * If a method is transferring from C to Java, then no safepoint test is needed at the
             * return of the transferring method.
             */
        return;
    }
    for (ReturnNode returnNode : graph.getNodes(ReturnNode.TYPE)) {
        SafepointNode safepointNode = graph.add(new SafepointNode());
        graph.addBeforeFixed(returnNode, safepointNode);
    }
}
Also used : ReturnNode(org.graalvm.compiler.nodes.ReturnNode) Uninterruptible(com.oracle.svm.core.annotate.Uninterruptible) SafepointNode(org.graalvm.compiler.nodes.SafepointNode) CFunction(org.graalvm.nativeimage.c.function.CFunction) SharedMethod(com.oracle.svm.core.meta.SharedMethod)

Example 34 with Uninterruptible

use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.

the class PosixOSInterface method writeBytes0Uninterruptibly.

@Uninterruptible(reason = "byte[] accessed without pinning")
private boolean writeBytes0Uninterruptibly(FileDescriptor descriptor, byte[] bytes, UnsignedWord length, UnsignedWord offsetOfArrayElement) {
    final Pointer addressOfObject = Word.objectToUntrackedPointer(bytes);
    final CCharPointer bytePointer = (CCharPointer) addressOfObject.add(offsetOfArrayElement);
    return writeBytesUninterruptibly(descriptor, bytePointer, length);
}
Also used : Pointer(org.graalvm.word.Pointer) CCharPointer(org.graalvm.nativeimage.c.type.CCharPointer) CCharPointer(org.graalvm.nativeimage.c.type.CCharPointer) Uninterruptible(com.oracle.svm.core.annotate.Uninterruptible)

Example 35 with Uninterruptible

use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.

the class PosixOSInterface method writeBytesUninterruptibly.

@Override
@Uninterruptible(reason = "Bytes might be from an Object.")
public boolean writeBytesUninterruptibly(FileDescriptor descriptor, CCharPointer bytes, UnsignedWord length) {
    CCharPointer curBuf = bytes;
    UnsignedWord curLen = length;
    while (curLen.notEqual(0)) {
        int fd = Util_java_io_FileDescriptor.getFD(descriptor);
        if (fd == -1) {
            return false;
        }
        SignedWord n = UnistdNoTransitions.write(fd, curBuf, curLen);
        if (n.equal(-1)) {
            return false;
        }
        curBuf = curBuf.addressOf(n);
        curLen = curLen.subtract((UnsignedWord) n);
    }
    return true;
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord) SignedWord(org.graalvm.word.SignedWord) CCharPointer(org.graalvm.nativeimage.c.type.CCharPointer) Uninterruptible(com.oracle.svm.core.annotate.Uninterruptible)

Aggregations

Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)54 Pointer (org.graalvm.word.Pointer)15 UnsignedWord (org.graalvm.word.UnsignedWord)9 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)7 SubstrateForeignCallTarget (com.oracle.svm.core.snippets.SubstrateForeignCallTarget)5 IsolateThread (org.graalvm.nativeimage.IsolateThread)5 AlignedHeader (com.oracle.svm.core.genscavenge.AlignedHeapChunk.AlignedHeader)4 Safepoint (com.oracle.svm.core.thread.Safepoint)4 HostedMethod (com.oracle.svm.hosted.meta.HostedMethod)4 CodePointer (org.graalvm.nativeimage.c.function.CodePointer)4 CCharPointer (org.graalvm.nativeimage.c.type.CCharPointer)4 RestrictHeapAccess (com.oracle.svm.core.annotate.RestrictHeapAccess)3 Substitute (com.oracle.svm.core.annotate.Substitute)3 Log (com.oracle.svm.core.log.Log)3 Time.timespec (com.oracle.svm.core.posix.headers.Time.timespec)3 Time.timeval (com.oracle.svm.core.posix.headers.Time.timeval)3 Time.timezone (com.oracle.svm.core.posix.headers.Time.timezone)3 DebugContext (org.graalvm.compiler.debug.DebugContext)3 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)3 CIntPointer (org.graalvm.nativeimage.c.type.CIntPointer)3