Example #1
0
 protected override void WriteImplByRef(ref Object location,
                                        Object value,
                                        int mask)
 {
     CMSMarking.ReferenceCheck(ref location, value, mask);
     location = value;
 }
Example #2
0
 protected override void WriteImpl(UIntPtr *location,
                                   Object value,
                                   int mask)
 {
     CMSMarking.ReferenceCheck(location, value, mask);
     *location = Magic.addressOf(value);
 }
Example #3
0
 protected override Object AtomicCompareAndSwapImpl(ref Object loc,
                                                    Object newVal,
                                                    Object comp,
                                                    int mask)
 {
     CMSMarking.ReferenceCheck(ref loc, newVal, 0);
     newVal = ForwardNullable(newVal);
     for (;;)
     {
         Object oldVal = loc;
         Object commitVal;
         if (oldVal == comp ||
             ForwardNullable(oldVal) == ForwardNullable(comp))
         {
             commitVal = newVal;
         }
         else
         {
             // still CAS but only to get a memory barrier
             commitVal = oldVal;
         }
         if (Interlocked.CompareExchange(ref loc,
                                         commitVal, oldVal)
             == oldVal)
         {
             return(oldVal);
         }
     }
 }
Example #4
0
 internal static void Mark(UIntPtr ptr)
 {
     if (CMSMarking.MarkIfNecessary(ptr) &&
         fVerifyToSpaceMark &&
         ptr != UIntPtr.Zero &&
         !instance.IsInToSpace(ptr))
     {
         VTable.DebugBreak();
     }
 }
Example #5
0
        protected override Object AtomicSwapImpl(ref Object reference,
                                                 Object value,
                                                 int mask)
        {
            CMSMarking.ReferenceCheck(ref reference, value, mask);
            UIntPtr resultAddr =
                Interlocked.Exchange(Magic.toPointer(ref reference),
                                     Magic.addressOf(value));

            return(Magic.fromAddress(resultAddr));
        }
Example #6
0
        Object AtomicCompareAndSwapImpl(ref Object reference,
                                        Object newValue,
                                        Object comparand,
                                        int mask)
        {
            CMSMarking.ReferenceCheck(ref reference, newValue, mask);
            UIntPtr resultAddr =
                Interlocked.CompareExchange(Magic.toPointer(ref reference),
                                            Magic.addressOf(newValue),
                                            Magic.addressOf(comparand));

            return(Magic.fromAddress(resultAddr));
        }