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();
}
}
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();
}
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();
}
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();
}
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();
}
Aggregations