Search in sources :

Example 1 with Log

use of com.oracle.svm.core.log.Log in project graal by oracle.

the class SnippetRuntime method deoptimize.

/**
 * Foreign call: {@link #DEOPTIMIZE}.
 */
@SubstrateForeignCallTarget
private static void deoptimize(long actionAndReason, SpeculationReason speculation) {
    Pointer sp = KnownIntrinsics.readCallerStackPointer();
    DeoptimizationAction action = Deoptimizer.decodeDeoptAction(actionAndReason);
    if (Deoptimizer.Options.TraceDeoptimization.getValue()) {
        Log log = Log.log().string("[Deoptimization initiated").newline();
        CodePointer ip = KnownIntrinsics.readReturnAddress();
        SubstrateInstalledCode installedCode = CodeInfoTable.lookupInstalledCode(ip);
        if (installedCode != null) {
            log.string("    name: ").string(installedCode.getName()).newline();
        }
        log.string("    sp: ").hex(sp).string("  ip: ").hex(ip).newline();
        DeoptimizationReason reason = Deoptimizer.decodeDeoptReason(actionAndReason);
        log.string("    reason: ").string(reason.toString()).string("  action: ").string(action.toString()).newline();
        int debugId = Deoptimizer.decodeDebugId(actionAndReason);
        log.string("    debugId: ").signed(debugId).string("  speculation: ").string(Objects.toString(speculation)).newline();
        CodeInfoQueryResult info = CodeInfoTable.lookupCodeInfoQueryResult(ip);
        if (info != null) {
            NodeSourcePosition sourcePosition = DeoptimizationSourcePositionDecoder.decode(debugId, info);
            if (sourcePosition != null) {
                log.string("    stack trace that triggered deoptimization:").newline();
                NodeSourcePosition cur = sourcePosition;
                while (cur != null) {
                    log.string("        at ");
                    if (cur.getMethod() != null) {
                        StackTraceElement element = cur.getMethod().asStackTraceElement(cur.getBCI());
                        if (element.getFileName() != null && element.getLineNumber() >= 0) {
                            log.string(element.toString());
                        } else {
                            log.string(cur.getMethod().format("%H.%n(%p)")).string(" bci ").signed(cur.getBCI());
                        }
                    } else {
                        log.string("[unknown method]");
                    }
                    log.newline();
                    cur = cur.getCaller();
                }
            }
        }
    }
    if (action.doesInvalidateCompilation()) {
        Deoptimizer.invalidateMethodOfFrame(sp, speculation);
    } else {
        Deoptimizer.deoptimizeFrame(sp, false, speculation);
    }
    if (Deoptimizer.Options.TraceDeoptimization.getValue()) {
        Log.log().string("]").newline();
    }
}
Also used : Log(com.oracle.svm.core.log.Log) SubstrateInstalledCode(com.oracle.svm.core.deopt.SubstrateInstalledCode) CodePointer(org.graalvm.nativeimage.c.function.CodePointer) Pointer(org.graalvm.word.Pointer) CodeInfoQueryResult(com.oracle.svm.core.code.CodeInfoQueryResult) DeoptimizationAction(jdk.vm.ci.meta.DeoptimizationAction) CodePointer(org.graalvm.nativeimage.c.function.CodePointer) DeoptimizationReason(jdk.vm.ci.meta.DeoptimizationReason) NodeSourcePosition(org.graalvm.compiler.graph.NodeSourcePosition)

Example 2 with Log

use of com.oracle.svm.core.log.Log in project graal by oracle.

the class VMThreadCounterOperation method operate.

@Override
public void operate() {
    final Log trace = Log.noopLog().string("[ThreadListOperation.operate:").string("  queuingVMThread: ").hex(getQueuingVMThread()).string("  currentVMThread: ").hex(CEntryPointContext.getCurrentIsolateThread()).flush();
    list.clear();
    for (IsolateThread isolateThread = VMThreads.firstThread(); VMThreads.isNonNullThread(isolateThread); isolateThread = VMThreads.nextThread(isolateThread)) {
        final Thread thread = JavaThreads.singleton().fromVMThread(isolateThread);
        if (thread != null) {
            list.add(thread);
        }
    }
    trace.string("]").newline().flush();
}
Also used : IsolateThread(org.graalvm.nativeimage.IsolateThread) Log(com.oracle.svm.core.log.Log) IsolateThread(org.graalvm.nativeimage.IsolateThread)

Example 3 with Log

use of com.oracle.svm.core.log.Log in project graal by oracle.

the class VMOperationControlFeature method acquireLock.

/**
 * Acquire the mutex.
 */
private void acquireLock() {
    final Log trace = SubstrateOptions.TraceVMOperations.getValue() ? Log.log() : Log.noopLog();
    trace.string("[VMOperationControl.acquireLock:").newline();
    getLock().lock();
    setLockOwner();
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 4 with Log

use of com.oracle.svm.core.log.Log in project graal by oracle.

the class VMOperationControlFeature method releaseLock.

private void releaseLock() {
    final Log trace = SubstrateOptions.TraceVMOperations.getValue() ? Log.log() : Log.noopLog();
    trace.string("[VMOperationControl.releaseLock: ").newline();
    final VMMutex lock = getLock();
    lock.assertIsLocked("VMOperationControl.releaseLock but not locked.");
    unsetLockOwner();
    lock.unlock();
    trace.string("  isOwner: ").bool(isLockOwner()).string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log) VMMutex(com.oracle.svm.core.locks.VMMutex)

Example 5 with Log

use of com.oracle.svm.core.log.Log in project graal by oracle.

the class VMOperationControlFeature method drain.

protected void drain() {
    final Log trace = SubstrateOptions.TraceVMOperations.getValue() ? Log.log() : Log.noopLog();
    Safepoint.Master master = Safepoint.Master.singleton();
    trace.string("[VMOperationControl.drain:").string("  MASTER.isFrozen: ").bool(master.isFrozen()).newline();
    final String drainReason = getReason();
    // Drain the non-safepoint queues.
    nonBlockingNonSafepointOperations.drain();
    blockingNonSafepointOperations.drain();
    /* Bring the system to a safepoint and then drain the safepoint queues. */
    final boolean nonEmptySafepointQueues = ((!nonBlockingSafepointOperations.isEmpty()) || (!blockingSafepointOperations.isEmpty()));
    /*
         * If I am already at a safepoint, e.g., for a nested operation, do not try to bring the
         * system to a safepoint.
         */
    boolean startedSafepoint = false;
    if (!master.isFrozen() && nonEmptySafepointQueues) {
        startedSafepoint = true;
        master.freeze(drainReason);
    }
    try {
        nonBlockingSafepointOperations.drain();
        blockingSafepointOperations.drain();
    } finally {
        if (startedSafepoint) {
            master.thaw(drainReason);
        }
    }
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Aggregations

Log (com.oracle.svm.core.log.Log)130 Pointer (org.graalvm.word.Pointer)30 UnsignedWord (org.graalvm.word.UnsignedWord)30 IsolateThread (org.graalvm.nativeimage.IsolateThread)4 CodePointer (org.graalvm.nativeimage.c.function.CodePointer)4 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)3 CollectionWatcher (com.oracle.svm.core.heap.CollectionWatcher)3 DiscoverableReference (com.oracle.svm.core.heap.DiscoverableReference)3 XOptions (com.oracle.svm.core.option.XOptions)3 AlwaysInline (com.oracle.svm.core.annotate.AlwaysInline)2 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)2 KnownIntrinsics.readCallerStackPointer (com.oracle.svm.core.snippets.KnownIntrinsics.readCallerStackPointer)2 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)2 RestrictHeapAccess (com.oracle.svm.core.annotate.RestrictHeapAccess)1 CodeInfoQueryResult (com.oracle.svm.core.code.CodeInfoQueryResult)1 SubstrateInstalledCode (com.oracle.svm.core.deopt.SubstrateInstalledCode)1 AlignedHeader (com.oracle.svm.core.genscavenge.AlignedHeapChunk.AlignedHeader)1 UnalignedHeader (com.oracle.svm.core.genscavenge.UnalignedHeapChunk.UnalignedHeader)1 AllocationFreeList (com.oracle.svm.core.heap.AllocationFreeList)1 NoAllocationVerifier (com.oracle.svm.core.heap.NoAllocationVerifier)1