use of org.graalvm.word.Pointer 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;
}
use of org.graalvm.word.Pointer in project graal by oracle.
the class InstalledCodeBuilder method allocateOSMemory.
/**
* A tracing wrapper around getOSInterface().allocateVirtualMemory.
*/
protected Pointer allocateOSMemory(final UnsignedWord size, final boolean executable) {
final Log trace = Log.noopLog();
trace.string("[SubstrateInstalledCode.allocateAlignedMemory:");
trace.string(" size: ").unsigned(size);
trace.string(" executable: ").bool(executable);
final Pointer result = ConfigurationValues.getOSInterface().allocateVirtualMemory(size, executable);
trace.string(" returns: ").hex(result);
trace.string("]").newline();
return result;
}
use of org.graalvm.word.Pointer in project graal by oracle.
the class PosixAMD64VaListSnippets method vaArgDoubleSnippet.
@Snippet
protected static double vaArgDoubleSnippet(Pointer vaList) {
int fpOffset = vaList.readInt(FP_OFFSET_LOCATION);
if (fpOffset < MAX_FP_OFFSET) {
Pointer regSaveArea = vaList.readWord(REG_SAVE_AREA_LOCATION);
double v = regSaveArea.readDouble(fpOffset);
// 16-byte XMM register
vaList.writeInt(FP_OFFSET_LOCATION, fpOffset + 16);
return v;
} else {
Pointer overflowArgArea = vaList.readWord(OVERFLOW_ARG_AREA_LOCATION);
double v = overflowArgArea.readDouble(0);
vaList.writeWord(OVERFLOW_ARG_AREA_LOCATION, overflowArgArea.add(OVERFLOW_ARG_AREA_ALIGNMENT));
return v;
}
}
use of org.graalvm.word.Pointer in project graal by oracle.
the class ExceptionStateNode method unwindSnippet.
@Snippet
protected static void unwindSnippet(Throwable exception) {
Pointer callerSP = readCallerStackPointer();
CodePointer callerIP = readReturnAddress();
runtimeCall(UNWIND_EXCEPTION, exception, callerSP, callerIP);
throw unreachable();
}
use of org.graalvm.word.Pointer in project graal by oracle.
the class PointerUtils method absoluteDifference.
/**
* Return the distance between two Pointers.
*
* @param pointer1 A first Pointer.
* @param pointer2 A second Pointer.
* @return The distance in bytes between the two Pointers.
*/
public static UnsignedWord absoluteDifference(PointerBase pointer1, PointerBase pointer2) {
Pointer p1 = (Pointer) pointer1;
Pointer p2 = (Pointer) pointer2;
final UnsignedWord result;
if (p1.aboveOrEqual(p2)) {
result = p1.subtract(p2);
} else {
result = p2.subtract(p1);
}
return result;
}
Aggregations