use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class Barriers method doubleFieldWrite.
/**
* Barrier for writes of doubles 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 doubleFieldWrite(Object ref, double value, Offset offset, int locationMetadata) {
if (NEEDS_DOUBLE_GC_WRITE_BARRIER) {
ObjectReference src = ObjectReference.fromObject(ref);
Selected.Mutator.get().doubleWrite(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 charFieldWrite.
/**
* Barrier for writes of chars 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 charFieldWrite(Object ref, char value, Offset offset, int locationMetadata) {
if (NEEDS_CHAR_GC_WRITE_BARRIER) {
ObjectReference src = ObjectReference.fromObject(ref);
Selected.Mutator.get().charWrite(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 objectStaticWrite.
/**
* Barrier for writes of objects from statics (eg putstatic)
*
* @param value the new value to be stored
* @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 objectStaticWrite(Object value, Offset offset, int locationMetadata) {
if (NEEDS_OBJECT_GC_PUTSTATIC_BARRIER) {
ObjectReference src = ObjectReference.fromObject(Magic.getJTOC());
Selected.Mutator.get().objectReferenceNonHeapWrite(src.toAddress().plus(offset), ObjectReference.fromObject(value), offset.toWord(), Word.fromIntZeroExtend(locationMetadata));
} else if (VM.VerifyAssertions)
VM._assert(VM.NOT_REACHED);
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class DebugUtil method validRef.
@Uninterruptible
public static boolean validRef(ObjectReference ref) {
if (ref.isNull())
return true;
if (!Space.isMappedObject(ref)) {
VM.sysWrite("validRef: REF outside heap, ref = ");
VM.sysWrite(ref);
VM.sysWriteln();
Space.printVMMap();
return false;
}
if (MOVES_OBJECTS) {
/*
TODO: Work out how to check if forwarded
if (Plan.isForwardedOrBeingForwarded(ref)) {
// TODO: actually follow forwarding pointer
// (need to bound recursion when things are broken!!)
return true;
}
*/
}
TIB tib = ObjectModel.getTIB(ref);
Address tibAddr = Magic.objectAsAddress(tib);
if (!Space.isMappedObject(ObjectReference.fromObject(tib))) {
VM.sysWrite("validRef: TIB outside heap, ref = ");
VM.sysWrite(ref);
VM.sysWrite(" tib = ");
VM.sysWrite(tibAddr);
VM.sysWriteln();
ObjectModel.dumpHeader(ref);
return false;
}
if (tibAddr.isZero()) {
VM.sysWrite("validRef: TIB is Zero! ");
VM.sysWrite(ref);
VM.sysWriteln();
ObjectModel.dumpHeader(ref);
return false;
}
if (tib.length() == 0) {
VM.sysWrite("validRef: TIB length zero, ref = ");
VM.sysWrite(ref);
VM.sysWrite(" tib = ");
VM.sysWrite(tibAddr);
VM.sysWriteln();
ObjectModel.dumpHeader(ref);
return false;
}
ObjectReference type = ObjectReference.fromObject(tib.getType());
if (!validType(type)) {
VM.sysWrite("validRef: invalid TYPE, ref = ");
VM.sysWrite(ref);
VM.sysWrite(" tib = ");
VM.sysWrite(Magic.objectAsAddress(tib));
VM.sysWrite(" type = ");
VM.sysWrite(type);
VM.sysWriteln();
ObjectModel.dumpHeader(ref);
return false;
}
return true;
}
Aggregations