use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class HeapEntry method toString.
@Override
public String toString() {
String result = String.format("Heap entry: id=%s, ", id, ObjectModel.getString(object));
result += String.format("incoming pointers: %n");
for (ObjectReference ref : getReferrers()) {
result += String.format(" %s%n", ref);
}
return result;
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class ObjectTable method trimToLiveSet.
/**
* After the first pass of the sanity checker, we know exactly which objects are live.
* Use this set to trim the set of valid objects after a full-heap collection.
*
* @param liveSet The known live objects
*/
public void trimToLiveSet(Set<ObjectReference> liveSet) {
int removed = 0;
Iterator<ObjectReference> iterator = objects.keySet().iterator();
while (iterator.hasNext()) {
ObjectReference current = iterator.next();
if (!liveSet.contains(current)) {
Entry entry = objects.get(current);
if (VERBOSE || ObjectModel.isWatched(current)) {
Trace.printf(Item.SANITY, "Object death: %s", entry.formatHistory());
}
entry.kill();
}
removed++;
}
Trace.trace(Item.SANITY, "Trimmed %d dead objects from object table", removed);
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class Traversal method scan.
/**
* Scan an object, calling the appropriate visitor method
* @param object
*/
private void scan(ObjectReference object) {
if (VERBOSE) {
Trace.trace(Item.SANITY, "scanning object %s", ObjectModel.getString(object));
}
for (int i = 0; i < ObjectModel.getRefs(object); i++) {
Address slot = ObjectModel.getRefSlot(object, i);
ObjectReference ref = loadReferenceSlot(slot);
if (!ref.isNull()) {
visitor.visitPointer(object, slot, ref);
traceObject(ref, false);
}
}
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class AllocOp method exec.
@Override
public void exec(Env env) {
StackFrame frame = env.top();
ObjectReference object;
try {
object = env.alloc(getRefCount(frame), getDataCount(frame), getDoubleAlign(frame), site);
} catch (OutOfMemory e) {
throw e;
} catch (Exception e) {
throw new RuntimeException("Error allocating object id:" + ObjectModel.lastObjectId() + " refs:" + getRefCount(frame) + " ints: " + getDataCount(frame) + " align:" + getDoubleAlign(frame) + " site:" + site, e);
}
setResult(frame, new ObjectValue(object));
if (Harness.gcEveryAlloc()) {
env.gc();
}
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class Barriers method booleanFieldWrite.
/**
* Barrier for writes of booleans 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 booleanFieldWrite(Object ref, boolean value, Offset offset, int locationMetadata) {
if (NEEDS_BOOLEAN_GC_WRITE_BARRIER) {
ObjectReference src = ObjectReference.fromObject(ref);
Selected.Mutator.get().booleanWrite(src, src.toAddress().plus(offset), value, offset.toWord(), Word.fromIntZeroExtend(locationMetadata), INSTANCE_FIELD);
} else if (VM.VerifyAssertions)
VM._assert(VM.NOT_REACHED);
}
Aggregations