use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class CompileQueue method canBeUsedForInlining.
protected boolean canBeUsedForInlining(Invoke invoke) {
HostedMethod caller = (HostedMethod) invoke.asNode().graph().method();
HostedMethod callee = (HostedMethod) invoke.callTarget().targetMethod();
if (canDeoptForTesting(caller) && Modifier.isNative(callee.getModifiers())) {
/*
* We must not deoptimize in the stubs for native functions, since they don't have a
* valid bytecode state.
*/
return false;
}
if (canDeoptForTesting(caller) && universe.getMethodsWithStackValues().contains(callee.wrapped)) {
/*
* We must not inline a method that has stack values and can be deoptimized.
*/
return false;
}
if (caller.compilationInfo.isDeoptTarget()) {
if (caller.compilationInfo.isDeoptEntry(invoke.bci(), true, false)) {
/*
* The call can be on the stack for a deoptimization, so we need an actual
* non-inlined invoke to deoptimize too.
*
* We could lift this restriction by providing an explicit deopt entry point (with
* the correct exception handling edges) in addition to the inlined method.
*/
return false;
}
if (CompilationInfoSupport.singleton().isDeoptInliningExclude(callee)) {
/*
* The graphs for runtime compilation have an intrinisic for the callee, which might
* alter the behavior. Be safe and do not inline, otherwise we might optimize too
* aggressively.
*
* For example, the Truffle method CompilerDirectives.inCompiledCode is
* intrinisified to return a constant with the opposite value than returned by the
* method we would inline here, i.e., we would constant-fold away the compiled-code
* only code (which is the code we need deoptimization entry points for).
*/
return false;
}
}
if (callee.getAnnotation(Specialize.class) != null) {
return false;
}
if (callerAnnotatedWith(invoke, Specialize.class) && callee.getAnnotation(DeoptTest.class) != null) {
return false;
}
Uninterruptible calleeUninterruptible = callee.getAnnotation(Uninterruptible.class);
if (calleeUninterruptible != null && !calleeUninterruptible.mayBeInlined() && caller.getAnnotation(Uninterruptible.class) == null) {
return false;
}
if (!mustNotAllocateCallee(caller) && mustNotAllocate(callee)) {
return false;
}
if (isNotExecuted(caller) || isNotExecuted(callee)) {
return false;
}
if (!callee.canBeInlined()) {
return false;
}
return invoke.useForInlining();
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class VMErrorSubstitutions method shutdown.
@Uninterruptible(reason = "Allow use in uninterruptible code.", calleeMustBe = false)
static void shutdown(String msg) {
Log log = Log.log();
log.autoflush(true);
log.string("VMError.shouldNotReachHere: ").string(msg).newline();
doShutdown(log);
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class VMErrorSubstitutions method shutdown.
@Uninterruptible(reason = "Allow use in uninterruptible code.", calleeMustBe = false)
static void shutdown() {
Log log = Log.log();
log.autoflush(true);
log.string("VMError.shouldNotReachHere").newline();
doShutdown(log);
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class ArraycopySnippets method objectCopyBackwardsUninterruptibly.
@Uninterruptible(reason = "Only the first writeObject has a write-barrier.")
private static void objectCopyBackwardsUninterruptibly(Object fromArray, UnsignedWord fromOffset, Object toArray, UnsignedWord toOffset, UnsignedWord elementSize, UnsignedWord size) {
// Loop-peel the first iteration so I can use BarrieredAccess
// to put a write barrier on the destination.
// TODO: I am explicitly not making the first read have a read barrier.
UnsignedWord remaining = size;
if (remaining.aboveThan(0)) {
remaining = remaining.subtract(elementSize);
BarrieredAccess.writeObject(toArray, toOffset.add(remaining), ObjectAccess.readObject(fromArray, fromOffset.add(remaining)));
while (remaining.aboveThan(0)) {
remaining = remaining.subtract(elementSize);
ObjectAccess.writeObject(toArray, toOffset.add(remaining), ObjectAccess.readObject(fromArray, fromOffset.add(remaining)));
}
}
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class ArraycopySnippets method objectCopyForwardUninterruptibly.
@Uninterruptible(reason = "Only the first writeObject has a write-barrier.")
private static void objectCopyForwardUninterruptibly(Object fromArray, UnsignedWord fromOffset, Object toArray, UnsignedWord toOffset, UnsignedWord elementSize, UnsignedWord size) {
UnsignedWord copied = WordFactory.zero();
// TODO: I am explicitly not making the first read have a read barrier.
if (copied.belowThan(size)) {
BarrieredAccess.writeObject(toArray, toOffset.add(copied), ObjectAccess.readObject(fromArray, fromOffset.add(copied)));
copied = copied.add(elementSize);
while (copied.belowThan(size)) {
ObjectAccess.writeObject(toArray, toOffset.add(copied), ObjectAccess.readObject(fromArray, fromOffset.add(copied)));
copied = copied.add(elementSize);
}
}
}
Aggregations