use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class HeapChunk method availableObjectMemory.
/**
* How much space is available for objects in a HeapChunk?
*/
@Uninterruptible(reason = "Called from uninterruptible code.")
public static UnsignedWord availableObjectMemory(Header<?> that) {
final Pointer top = that.getTop();
final Pointer end = that.getEnd();
return end.subtract(top);
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class Deoptimizer method rewriteStackAndJumpToTarget.
/**
* Performs the actual stack rewriting. When this method is called the sp is already at the
* bottom of the deopt target method.
*
* @param newSp Points to the bottom of the deopt target method (but above the return address
* slot).
* @param frame The deopt frame handle.
* @return The epilog of this method restores the return value registers from the returned frame
* handle. The instructions for restoring the return value registers must be generated
* in this method's epilog by a backend-specific FrameContext class.
*/
@DeoptStub(stubType = StubType.ExitStub)
@NeverInline("don't provoke the writeStackPointer devil with a non-trivial method")
@Uninterruptible(reason = "Frame holds Objects in unmanaged storage.")
private static DeoptimizedFrame rewriteStackAndJumpToTarget(Pointer newSp, DeoptimizedFrame frame) {
/*
* The first word of the new stack content is already the return address into the caller of
* deoptimizeInRange(). So when this method returns we are inside the caller of
* deoptimizeInRange().
*/
Pointer bottomSp = newSp.subtract(FrameAccess.returnAddressSize());
frame.getTargetContent().copyToPointer(bottomSp);
if (DeoptimizationCounters.Options.ProfileDeoptimization.getValue()) {
DeoptimizationCounters.counters().timeSpentInDeopt.add(System.nanoTime() - DeoptimizationCounters.startTime.get());
}
return frame;
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class Deoptimizer method deoptStub.
/**
* Performs the second step of deoptimization: the actual rewriting of a deoptimized method's
* frame.
* <p>
* The pointer to the deopt stub code was installed in the return address slot by
* {@link #deoptimizeInRange}. Therefore the stub is "called" when a method wants to return to a
* deoptimized method.
* <p>
* When {@link #deoptStub} is "called", the stack looks like this:
*
* <pre>
* : :
* | |
* | | frame of the
* +--------------------------------+ deoptimized method
* | pointer to DeoptimizedFrame |
* +--------------------------------+--------- no return address between the frames!
* | |
* | | frame of
* | | {@link #deoptStub}
* : ... :
* </pre>
*
* @param frame This is the handle which was created in {@link #deoptimizeInRange}. It is
* fetched from the stack (the slot above the original return address) and passed as
* parameter. The instructions for fetching the frame handle must be generated in
* this method's prolog by a backend-specific FrameContext class. The prolog also
* stores the original return value registers in the {@code frame}.
*/
@DeoptStub(stubType = StubType.EntryStub)
@Uninterruptible(reason = "Frame holds Objects in unmanaged storage.")
public static void deoptStub(DeoptimizedFrame frame) {
DeoptimizationCounters.counters().deoptCount.inc();
if (DeoptimizationCounters.Options.ProfileDeoptimization.getValue()) {
DeoptimizationCounters.startTime.set(System.nanoTime());
}
/* Build the content of the deopt target stack frames. */
frame.buildContent();
/*
* The frame was pinned to keep it from moving during construction. I can unpin it now that
* I am uninterruptible. (And I have to unpin it.)
*/
frame.getPin().close();
recentDeoptimizationEvents.append(frame.getCompletedMessage());
Pointer sp = KnownIntrinsics.readStackPointer();
/* Do the stack rewriting. Return directly to the deopt target. */
final Pointer newSp = sp.add(WordFactory.unsigned(deoptStubFrameSize)).add(WordFactory.unsigned(frame.getSourceTotalFrameSize()).subtract(frame.getTargetContent().getSize()).subtract(FrameAccess.returnAddressSize()));
rewriteStackStub(newSp, frame);
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class RuntimeCodeInfoMemoryWalkerAccessFeature method binarySearch.
/* Copied and adapted from Arrays.binarySearch. */
@Uninterruptible(reason = "called from uninterruptible code")
private static int binarySearch(RuntimeMethodInfo[] a, int fromIndex, int toIndex, CodePointer key) {
int low = fromIndex;
int high = toIndex - 1;
while (low <= high) {
int mid = (low + high) >>> 1;
CodePointer midVal = a[mid].getCodeStart();
if (((UnsignedWord) midVal).belowThan((UnsignedWord) key)) {
low = mid + 1;
} else if (((UnsignedWord) midVal).aboveThan((UnsignedWord) key)) {
high = mid - 1;
} else {
// key found
return mid;
}
}
// key not found.
return -(low + 1);
}
Aggregations