use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class BootImageWriter method getWordValue.
private static Word getWordValue(Object addr, String msg, boolean warn) {
if (addr == null)
return Word.zero();
Word value = Word.zero();
if (addr instanceof Address) {
value = ((Address) addr).toWord();
} else if (addr instanceof ObjectReference) {
value = ((ObjectReference) addr).toAddress().toWord();
} else if (addr instanceof Word) {
value = (Word) addr;
} else if (addr instanceof Extent) {
value = ((Extent) addr).toWord();
} else if (addr instanceof Offset) {
value = ((Offset) addr).toWord();
} else {
say("Unhandled supposed address value: " + addr);
say(msg);
fail("incomplete boot image support");
}
if (warn)
check(value, msg);
return value;
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class Barriers method byteFieldWrite.
/**
* Barrier for writes of bytes into fields of instances (i.e. putfield).
*
* @param ref the object which is the subject of the putfield
* @param value the new value for the field
* @param offset the offset of the field to be modified
* @param locationMetadata an int that encodes the source location being modified
*/
@Inline
@Entrypoint
public static void byteFieldWrite(Object ref, byte value, Offset offset, int locationMetadata) {
if (NEEDS_BYTE_GC_WRITE_BARRIER) {
ObjectReference src = ObjectReference.fromObject(ref);
Selected.Mutator.get().byteWrite(src, src.toAddress().plus(offset), value, offset.toWord(), Word.fromIntZeroExtend(locationMetadata), INSTANCE_FIELD);
} else if (VM.VerifyAssertions)
VM._assert(VM.NOT_REACHED);
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class Barriers method floatArrayRead.
/**
* Barrier for loads of floats from fields of arrays (i.e. faload).
*
* @param ref the array containing the reference.
* @param index the index into the array were the reference resides.
* @return the value read from the array
*/
@Inline
@Entrypoint
public static float floatArrayRead(float[] ref, int index) {
if (NEEDS_FLOAT_GC_READ_BARRIER) {
ObjectReference array = ObjectReference.fromObject(ref);
Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_FLOAT);
return Selected.Mutator.get().floatRead(array, array.toAddress().plus(offset), offset.toWord(), Word.zero(), ARRAY_ELEMENT);
} else if (VM.VerifyAssertions)
VM._assert(VM.NOT_REACHED);
return 0;
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class Barriers method floatArrayWrite.
/**
* Barrier for writes of floats into arrays (i.e. fastore).
*
* @param ref the array which is the subject of the astore
* @param index the index into the array where the new reference
* resides. The index is the "natural" index into the array, for
* example a[index].
* @param value the value to be stored.
*/
@Inline
@Entrypoint
public static void floatArrayWrite(float[] ref, int index, float value) {
if (NEEDS_FLOAT_GC_WRITE_BARRIER) {
ObjectReference array = ObjectReference.fromObject(ref);
Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_FLOAT);
Selected.Mutator.get().floatWrite(array, array.toAddress().plus(offset), value, offset.toWord(), Word.zero(), ARRAY_ELEMENT);
} else if (VM.VerifyAssertions)
VM._assert(VM.NOT_REACHED);
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class Barriers method objectArrayWrite.
/**
* Barrier for writes of objects into arrays (i.e. aastore).
*
* @param ref the array which is the subject of the astore
* @param index the index into the array where the new reference
* resides. The index is the "natural" index into the array, for
* example a[index].
* @param value the value to be stored.
*/
@Inline
@Entrypoint
public static void objectArrayWrite(Object[] ref, int index, Object value) {
if (NEEDS_OBJECT_GC_WRITE_BARRIER) {
ObjectReference array = ObjectReference.fromObject(ref);
Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_ADDRESS);
Selected.Mutator.get().objectReferenceWrite(array, array.toAddress().plus(offset), ObjectReference.fromObject(value), offset.toWord(), Word.zero(), ARRAY_ELEMENT);
} else if (VM.VerifyAssertions)
VM._assert(VM.NOT_REACHED);
}
Aggregations