From: <ste...@us...> - 2009-09-16 18:07:45
|
Revision: 15780 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15780&view=rev Author: steveb-oss Date: 2009-09-16 12:13:01 +0000 (Wed, 16 Sep 2009) Log Message: ----------- Another step towards RVM-845 Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/PlanConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTraceConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSConstraints.java rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/Barriers.java rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/MemoryManager.java Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -24,16 +24,15 @@ /** * Perform the actual write of the write barrier. * - * @param ref The object that has the reference field + * @param objref The object that has the reference field * @param target The value that the slot will be updated to * @param offset The offset from the ref * @param location The index of the FieldReference * @param mode The context in which the write is occurring */ @Inline - public final void referenceWrite(ObjectReference ref, ObjectReference target, - Word offset, Word location, int mode) { - Magic.setObjectAtOffset(ref.toObject(), offset.toOffset(), target.toObject(), location.toInt()); + public final void referenceWrite(ObjectReference objref, ObjectReference target, Word offset, Word location, int mode) { + Magic.setObjectAtOffset(objref.toObject(), offset.toOffset(), target.toObject(), location.toInt()); } /** @@ -46,16 +45,50 @@ * @param ref The object that has the reference field */ @Inline - public final void referenceWrite(Address slot, ObjectReference target, - Word unusedA, Word unusedB) { + public final void referenceWrite(Address slot, ObjectReference target, Word unusedA, Word unusedB) { slot.store(target); } /** + * Perform the actual read of the read barrier. + * + * @param objref The object that has the reference field + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + * @return the read value + */ + @Inline + public final ObjectReference referenceRead(ObjectReference objref, Word offset, Word location, int mode) { + return ObjectReference.fromObject(Magic.getObjectAtOffset(objref.toObject(), offset.toOffset(), location.toInt())); + } + + /** + * Sets an element of an object array without invoking any write + * barrier. This method is called by the Map class to ensure + * potentially-allocation-triggering write barriers do not occur in + * allocation slow path code. + * + * @param dst the destination array + * @param index the index of the element to set + * @param value the new value for the element + */ + @UninterruptibleNoWarn + public final void referenceArrayStoreNoGCBarrier(Object[] dst, int index, Object value) { + if (org.jikesrvm.VM.runningVM) { + Address base = ObjectReference.fromObject(dst).toAddress(); + Address slot = base.plus(Offset.fromIntZeroExtend(index << LOG_BYTES_IN_ADDRESS)); + VM.activePlan.global().storeObjectReference(slot, ObjectReference.fromObject(value)); + } else { + dst[index] = value; + } + } + + /** * Atomically write a reference field of an object or array and return * the old value of the reference field. * - * @param ref The object that has the reference field + * @param objref The object that has the reference field * @param target The value that the slot will be updated to * @param offset The offset from the ref * @param unused Unused @@ -63,9 +96,8 @@ * @return The value that was replaced by the write. */ @Inline - public final ObjectReference referenceAtomicWrite(ObjectReference ref, ObjectReference target, - Word offset, Word unused, int mode) { - Object obj = ref.toObject(); + public final ObjectReference referenceAtomicWrite(ObjectReference objref, ObjectReference target, Word offset, Word unused, int mode) { + Object obj = objref.toObject(); Object newObject = target.toObject(); Object oldObject; do { @@ -77,7 +109,7 @@ /** * Attempt an atomic compare and exchange in a write barrier sequence. * - * @param ref The object that has the reference field + * @param objref The object that has the reference field * @param old The old reference to be swapped out * @param target The value that the slot will be updated to * @param offset The offset from the ref @@ -86,32 +118,16 @@ * @return True if the compare and swap was successful */ @Inline - public final boolean referenceTryCompareAndSwap(ObjectReference ref, ObjectReference old, ObjectReference target, - Word offset, Word unused, int mode) { + public final boolean referenceTryCompareAndSwap(ObjectReference objref, ObjectReference old, ObjectReference target, Word offset, Word unused, int mode) { Object oldValue; do { - oldValue = Magic.prepareObject(ref, offset.toOffset()); + oldValue = Magic.prepareObject(objref, offset.toOffset()); if (oldValue != old) return false; - } while (!Magic.attemptObject(ref, offset.toOffset(), oldValue, target)); + } while (!Magic.attemptObject(objref, offset.toOffset(), oldValue, target)); return true; } /** - * Perform the actual read of the read barrier. - * - * @param ref The object that has the reference field - * @param offset The offset from the ref - * @param location The index of the FieldReference - * @param mode The context in which the write is occurring - * @return the read value - */ - @Inline - public final ObjectReference referenceRead(ObjectReference ref, - Word offset, Word location, int mode) { - return ObjectReference.fromObject(Magic.getObjectAtOffset(ref.toObject(), offset.toOffset(), location.toInt())); - } - - /** * Perform the actual write of the write barrier, writing the value as a raw word. * * @param ref The object that has the reference field @@ -183,24 +199,4 @@ return Magic.getWordAtOffset(ref.toObject(), offset.toOffset(), location.toInt()); } - /** - * Sets an element of an object array without invoking any write - * barrier. This method is called by the Map class to ensure - * potentially-allocation-triggering write barriers do not occur in - * allocation slow path code. - * - * @param dst the destination array - * @param index the index of the element to set - * @param value the new value for the element - */ - @UninterruptibleNoWarn - public final void referenceArrayStoreNoGCBarrier(Object[] dst, int index, Object value) { - if (org.jikesrvm.VM.runningVM) { - Address base = ObjectReference.fromObject(dst).toAddress(); - Address slot = base.plus(Offset.fromIntZeroExtend(index << LOG_BYTES_IN_ADDRESS)); - VM.activePlan.global().storeObjectReference(slot, ObjectReference.fromObject(value)); - } else { - dst[index] = value; - } - } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -302,7 +302,7 @@ check(index < limit, "Index "+index+" out of bounds "+limit); Address referenceSlot = ObjectModel.getRefSlot(object, index); - if (ActivePlan.constraints.needsWriteBarrier()) { + if (ActivePlan.constraints.needsReferenceWriteBarrier()) { context.referenceWrite(object, referenceSlot, value, referenceSlot.toWord(), null, Plan.ARRAY_ELEMENT); if (gcEveryWB) { gc(); @@ -346,7 +346,7 @@ Address referenceSlot = ObjectModel.getRefSlot(object, index); ObjectReference result; - if (ActivePlan.constraints.needsReadBarrier()) { + if (ActivePlan.constraints.needsReferenceReadBarrier()) { result = context.referenceRead(object, referenceSlot, null, null, Plan.INSTANCE_FIELD); } else { result = referenceSlot.loadObjectReference(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/PlanConstraints.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/PlanConstraints.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/PlanConstraints.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -22,21 +22,21 @@ * issues with ordering of static initialization. */ @Uninterruptible public abstract class PlanConstraints { - /** @return True if this Plan requires write barriers. */ - public boolean needsWriteBarrier() { return false; } + /** @return True of this Plan requires read barriers on java.lang.reference types. */ + public boolean needsJavaLangReferenceReadBarrier() { return false; } + /** @return True if this Plan requires write barriers on reference types. */ + public boolean needsReferenceWriteBarrier() { return false; } + /** @return True of this Plan requires read barriers on reference types. */ - public boolean needsJavaLangReferenceReadBarrier() { return false; } + public boolean needsReferenceReadBarrier() { return false; } - /** @return True of this Plan requires read barriers. */ - public boolean needsReadBarrier() { return false; } + /** @return True if this Plan requires static write barriers on reference types. */ + public boolean needsReferenceStaticWriteBarrier() { return false;} - /** @return True if this Plan requires static write barriers. */ - public boolean needsStaticWriteBarrier() { return false;} + /** @return True if this Plan requires static read barriers on reference types. */ + public boolean needsReferenceStaticReadBarrier() { return false; } - /** @return True if this Plan requires static read barriers. */ - public boolean needsStaticReadBarrier() { return false; } - /** @return True if this Plan requires linear scanning. */ public boolean needsLinearScan() { return org.mmtk.utility.Constants.SUPPORT_CARD_SCANNING;} Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenConstraints.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenConstraints.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenConstraints.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -46,11 +46,11 @@ /** @return True if this plan requires a write barrier */ @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsReferenceWriteBarrier() { return true; } /** @return True if this plan requires a static barrier */ @Override - public boolean needsStaticWriteBarrier() { return Gen.USE_STATIC_WRITE_BARRIER; } + public boolean needsReferenceStaticWriteBarrier() { return Gen.USE_STATIC_WRITE_BARRIER; } /** @return The specialized scan methods required */ @Override Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedConstraints.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedConstraints.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedConstraints.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -24,11 +24,11 @@ @Uninterruptible public class PoisonedConstraints extends MSConstraints { @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsReferenceWriteBarrier() { return true; } @Override - public boolean needsReadBarrier() { return true; } + public boolean needsReferenceReadBarrier() { return true; } @Override - public boolean needsStaticWriteBarrier() { return false; } + public boolean needsReferenceStaticWriteBarrier() { return false; } @Override - public boolean needsStaticReadBarrier() { return false; } + public boolean needsReferenceStaticReadBarrier() { return false; } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseConstraints.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseConstraints.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseConstraints.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -30,7 +30,7 @@ @Override public int gcHeaderWords() { return RCHeader.GC_HEADER_WORDS_REQUIRED; } @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsReferenceWriteBarrier() { return true; } @Override public int maxNonLOSDefaultAllocBytes() { return MAX_FREELIST_OBJECT_BYTES; } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTraceConstraints.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTraceConstraints.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTraceConstraints.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -22,7 +22,7 @@ @Uninterruptible public class GCTraceConstraints extends SSConstraints { @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsReferenceWriteBarrier() { return true; } @Override public boolean generateGCTrace() { return true; } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixConstraints.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixConstraints.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixConstraints.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -32,7 +32,7 @@ /** @return True if this plan requires a write barrier */ @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsReferenceWriteBarrier() { return true; } /** @return True if this Plan requires a header bit for object logging */ @Override Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSConstraints.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSConstraints.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSConstraints.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -32,7 +32,7 @@ /** @return True if this plan requires a write barrier */ @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsReferenceWriteBarrier() { return true; } /** @return True if this Plan requires a header bit for object logging */ @Override Modified: rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/Barriers.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/Barriers.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/Barriers.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -44,23 +44,24 @@ } /** True if the garbage collector requires write barriers on reference putfield, arraystore or modifycheck */ - private static final boolean NEEDS_REFERENCE_GC_WRITE_BARRIER = Selected.Constraints.get().needsWriteBarrier(); + private static final boolean NEEDS_REFERENCE_GC_WRITE_BARRIER = Selected.Constraints.get().needsReferenceWriteBarrier(); /** True if the VM requires write barriers on reference putfield */ public static final boolean NEEDS_REFERENCE_PUTFIELD_BARRIER = NEEDS_REFERENCE_GC_WRITE_BARRIER; /** True if the VM requires write barriers on reference arraystore */ public static final boolean NEEDS_REFERENCE_ASTORE_BARRIER = NEEDS_REFERENCE_GC_WRITE_BARRIER; /** True if the garbage collector requires read barriers on reference getfield or arrayload */ - private static final boolean NEEDS_REFERENCE_GC_READ_BARRIER = Selected.Constraints.get().needsReadBarrier(); + private static final boolean NEEDS_REFERENCE_GC_READ_BARRIER = Selected.Constraints.get().needsReferenceReadBarrier(); /** True if the VM requires read barriers on reference getfield */ public static final boolean NEEDS_REFERENCE_GETFIELD_BARRIER = NEEDS_REFERENCE_GC_READ_BARRIER; /** True if the VM requires read barriers on reference arrayload */ public static final boolean NEEDS_REFERENCE_ALOAD_BARRIER = NEEDS_REFERENCE_GC_READ_BARRIER; + /** True if the selected plan requires write barriers on reference putstatic */ - private static final boolean NEEDS_REFERENCE_GC_PUTSTATIC_BARRIER = Selected.Constraints.get().needsStaticWriteBarrier(); + private static final boolean NEEDS_REFERENCE_GC_PUTSTATIC_BARRIER = Selected.Constraints.get().needsReferenceStaticWriteBarrier(); /** True if the selected plan requires write barriers on reference putstatic */ public static final boolean NEEDS_REFERENCE_PUTSTATIC_BARRIER = NEEDS_REFERENCE_GC_PUTSTATIC_BARRIER; /** True if the selected plan requires read barriers on reference getstatic */ - private static final boolean NEEDS_REFERENCE_GC_GETSTATIC_BARRIER = Selected.Constraints.get().needsStaticReadBarrier(); + private static final boolean NEEDS_REFERENCE_GC_GETSTATIC_BARRIER = Selected.Constraints.get().needsReferenceStaticReadBarrier(); /** True if the selected plan requires read barriers on reference getstatic */ public static final boolean NEEDS_REFERENCE_GETSTATIC_BARRIER = NEEDS_REFERENCE_GC_GETSTATIC_BARRIER; @@ -114,47 +115,49 @@ } /** - * Barrier for writes of references to non-heap locations (eg statics) + * Barrier for loads of references from fields of instances (ie getfield). * - * @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 + * @param ref the object which is the subject of the getfield + * @param offset the offset of the field to be read + * @param locationMetadata an int that encodes the source location being read + * @return The value read from the field. */ @Inline @Entrypoint - public static void referenceNonHeapWrite(Object value, Offset offset, int locationMetadata) { - if (NEEDS_REFERENCE_GC_PUTSTATIC_BARRIER) { - ObjectReference src = ObjectReference.fromObject(Magic.getJTOC()); - Selected.Mutator.get().referenceNonHeapWrite(src.toAddress().plus(offset), - ObjectReference.fromObject(value), + public static Object referenceFieldRead(Object ref, Offset offset, int locationMetadata) { + if (NEEDS_REFERENCE_GC_READ_BARRIER) { + ObjectReference src = ObjectReference.fromObject(ref); + return Selected.Mutator.get().referenceRead(src, + src.toAddress().plus(offset), offset.toWord(), - Word.fromIntZeroExtend(locationMetadata)); + Word.fromIntZeroExtend(locationMetadata), + INSTANCE_FIELD).toObject(); } else if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return null; } /** - * Barrier for conditional compare and exchange of reference fields. + * Barrier for loads of references from fields of arrays (ie aload). * - * @param ref the object which is the subject of the compare and exchanges - * @param offset the offset of the field to be modified - * @param old the old value to swap out - * @param value the new value for the field + * @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 - public static boolean referenceTryCompareAndSwap(Object ref, Offset offset, Object old, Object value) { - if (NEEDS_REFERENCE_GC_WRITE_BARRIER || NEEDS_REFERENCE_GC_READ_BARRIER) { - ObjectReference src = ObjectReference.fromObject(ref); - return Selected.Mutator.get().referenceTryCompareAndSwap(src, - src.toAddress().plus(offset), - ObjectReference.fromObject(old), - ObjectReference.fromObject(value), + @Entrypoint + public static Object referenceArrayRead(Object ref, int index) { + if (NEEDS_REFERENCE_GC_READ_BARRIER) { + ObjectReference array = ObjectReference.fromObject(ref); + Offset offset = Offset.fromIntZeroExtend(index << MemoryManagerConstants.LOG_BYTES_IN_ADDRESS); + return Selected.Mutator.get().referenceRead(array, + array.toAddress().plus(offset), offset.toWord(), - Word.zero(), // do not have location metadata - INSTANCE_FIELD); + Word.zero(), // don't know metadata + ARRAY_ELEMENT).toObject(); } else if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); - return false; + return null; } /** @@ -186,70 +189,68 @@ } /** - * Barrier for loads of references from fields of instances (ie getfield). + * Barrier for loads of references from non-heap locations (ie getstatic) * - * @param ref the object which is the subject of the getfield - * @param offset the offset of the field to be read + * @param offset the offset of the field to be modified * @param locationMetadata an int that encodes the source location being read - * @return The value read from the field. + * @return the value read from the field */ @Inline @Entrypoint - public static Object referenceFieldRead(Object ref, Offset offset, int locationMetadata) { - if (NEEDS_REFERENCE_GC_READ_BARRIER) { - ObjectReference src = ObjectReference.fromObject(ref); - return Selected.Mutator.get().referenceRead(src, + public static Object referenceNonHeapRead(Offset offset, int locationMetadata) { + if (NEEDS_REFERENCE_GC_GETSTATIC_BARRIER) { + ObjectReference src = ObjectReference.fromObject(Magic.getJTOC()); + return Selected.Mutator.get().referenceNonHeapRead( src.toAddress().plus(offset), offset.toWord(), - Word.fromIntZeroExtend(locationMetadata), - INSTANCE_FIELD).toObject(); + Word.fromIntZeroExtend(locationMetadata)).toObject(); } else if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); return null; } + /** - * Barrier for loads of references from fields of arrays (ie aload). + * Barrier for writes of references to non-heap locations (eg statics) * - * @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 + * @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 Object referenceArrayRead(Object ref, int index) { - if (NEEDS_REFERENCE_GC_READ_BARRIER) { - ObjectReference array = ObjectReference.fromObject(ref); - Offset offset = Offset.fromIntZeroExtend(index << MemoryManagerConstants.LOG_BYTES_IN_ADDRESS); - return Selected.Mutator.get().referenceRead(array, - array.toAddress().plus(offset), + public static void referenceNonHeapWrite(Object value, Offset offset, int locationMetadata) { + if (NEEDS_REFERENCE_GC_PUTSTATIC_BARRIER) { + ObjectReference src = ObjectReference.fromObject(Magic.getJTOC()); + Selected.Mutator.get().referenceNonHeapWrite(src.toAddress().plus(offset), + ObjectReference.fromObject(value), offset.toWord(), - Word.zero(), // don't know metadata - ARRAY_ELEMENT).toObject(); + Word.fromIntZeroExtend(locationMetadata)); } else if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); - return null; } /** - * Barrier for loads of references from non-heap locations (ie getstatic) + * Barrier for conditional compare and exchange of reference fields. * + * @param ref the object which is the subject of the compare and exchanges * @param offset the offset of the field to be modified - * @param locationMetadata an int that encodes the source location being read - * @return the value read from the field + * @param old the old value to swap out + * @param value the new value for the field */ @Inline - @Entrypoint - public static Object referenceNonHeapRead(Offset offset, int locationMetadata) { - if (NEEDS_REFERENCE_GC_GETSTATIC_BARRIER) { - ObjectReference src = ObjectReference.fromObject(Magic.getJTOC()); - return Selected.Mutator.get().referenceNonHeapRead( + public static boolean referenceTryCompareAndSwap(Object ref, Offset offset, Object old, Object value) { + if (NEEDS_REFERENCE_GC_WRITE_BARRIER || NEEDS_REFERENCE_GC_READ_BARRIER) { + ObjectReference src = ObjectReference.fromObject(ref); + return Selected.Mutator.get().referenceTryCompareAndSwap(src, src.toAddress().plus(offset), + ObjectReference.fromObject(old), + ObjectReference.fromObject(value), offset.toWord(), - Word.fromIntZeroExtend(locationMetadata)).toObject(); + Word.zero(), // do not have location metadata + INSTANCE_FIELD); } else if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); - return null; + return false; } - } Modified: rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/MemoryManager.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/MemoryManager.java 2009-09-09 16:10:08 UTC (rev 15779) +++ rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/MemoryManager.java 2009-09-16 12:13:01 UTC (rev 15780) @@ -106,7 +106,7 @@ */ @Interruptible public static void init() { - if (VM.VerifyAssertions) VM._assert(!Selected.Constraints.get().needsStaticReadBarrier()); + if (VM.VerifyAssertions) VM._assert(!Selected.Constraints.get().needsReferenceStaticReadBarrier()); CollectorThread.init(); org.jikesrvm.mm.mmtk.Collection.init(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |