Author: Remi Meier <remi.me...@gmail.com>
Branch: copy-over-original2
Changeset: r405:9a584030a9e6
Date: 2013-07-16 15:08 +0200
http://bitbucket.org/pypy/stmgc/changeset/9a584030a9e6/

Log:    rename GCFLAG_NURSERY_MOVED to GCFLAG_MOVED

diff --git a/c4/demo_random.c b/c4/demo_random.c
--- a/c4/demo_random.c
+++ b/c4/demo_random.c
@@ -302,7 +302,7 @@
         }
         else {
             if (in_nursery(p)) {
-                assert(p->h_tid & GCFLAG_NURSERY_MOVED);
+                assert(p->h_tid & GCFLAG_MOVED);
                 assert(!(p->h_revision & 1));
             }
             return C_PUBLIC;
diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -122,7 +122,7 @@
           gcptr P_prev = P;
           P = (gcptr)v;
           assert((P->h_tid & GCFLAG_PUBLIC) ||
-                 (P_prev->h_tid & GCFLAG_NURSERY_MOVED));
+                 (P_prev->h_tid & GCFLAG_MOVED));
 
           v = ACCESS_ONCE(P->h_revision);
 
@@ -214,7 +214,7 @@
  add_in_recent_reads_cache:
   /* The risks are that the following assert fails, because the flag was
      added just now by a parallel thread during stealing... */
-  /*assert(!(P->h_tid & GCFLAG_NURSERY_MOVED));*/
+  /*assert(!(P->h_tid & GCFLAG_MOVED));*/
   fxcache_add(&d->recent_reads_cache, P);
   return P;
 
@@ -257,7 +257,7 @@
    */
   if (P->h_tid & GCFLAG_PUBLIC)
     {
-      if (P->h_tid & GCFLAG_NURSERY_MOVED)
+      if (P->h_tid & GCFLAG_MOVED)
         {
           P = (gcptr)P->h_revision;
           assert(P->h_tid & GCFLAG_PUBLIC);
@@ -389,7 +389,7 @@
 
       while (v = P->h_revision, IS_POINTER(v))
         {
-          if (P->h_tid & GCFLAG_NURSERY_MOVED)
+          if (P->h_tid & GCFLAG_MOVED)
             dprintf(("nursery_moved "));
 
           if (v & 2)
@@ -486,7 +486,7 @@
 static gcptr LocalizePublic(struct tx_descriptor *d, gcptr R)
 {
   assert(R->h_tid & GCFLAG_PUBLIC);
-  assert(!(R->h_tid & GCFLAG_NURSERY_MOVED));
+  assert(!(R->h_tid & GCFLAG_MOVED));
 
 #ifdef _GC_DEBUG
   wlog_t *entry;
@@ -581,7 +581,7 @@
          Add R into the list 'public_with_young_copy', unless W is
          actually an old object, in which case we need to record W.
       */
-      if (R->h_tid & GCFLAG_NURSERY_MOVED)
+      if (R->h_tid & GCFLAG_MOVED)
         {
           /* Bah, the object turned into this kind of stub, possibly
              while we were waiting for the collection_lock, because it
@@ -671,8 +671,8 @@
                   continue;
                 }
             }
-          else if ((R->h_tid & (GCFLAG_PUBLIC | GCFLAG_NURSERY_MOVED))
-                            == (GCFLAG_PUBLIC | GCFLAG_NURSERY_MOVED))
+          else if ((R->h_tid & (GCFLAG_PUBLIC | GCFLAG_MOVED))
+                            == (GCFLAG_PUBLIC | GCFLAG_MOVED))
             {
               /* such an object is identical to the one it points to
                (stolen protected young object with h_revision pointing
@@ -1084,7 +1084,7 @@
       assert(!(L->h_tid & GCFLAG_VISITED));
       assert(!(L->h_tid & GCFLAG_PUBLIC_TO_PRIVATE));
       assert(!(L->h_tid & GCFLAG_PREBUILT_ORIGINAL));
-      assert(!(L->h_tid & GCFLAG_NURSERY_MOVED));
+      assert(!(L->h_tid & GCFLAG_MOVED));
       assert(L->h_revision != localrev);   /* modified by AcquireLocks() */
 
 #ifdef DUMP_EXTRA
@@ -1131,7 +1131,7 @@
 
       assert(R->h_tid & GCFLAG_PUBLIC);
       assert(R->h_tid & GCFLAG_PUBLIC_TO_PRIVATE);
-      assert(!(R->h_tid & GCFLAG_NURSERY_MOVED));
+      assert(!(R->h_tid & GCFLAG_MOVED));
       assert(R->h_revision != localrev);
 
 #ifdef DUMP_EXTRA
@@ -1226,7 +1226,7 @@
           assert(!(B->h_tid & GCFLAG_BACKUP_COPY));
           P->h_tid |= GCFLAG_PUBLIC;
           assert(!(P->h_tid & GCFLAG_HAS_ID));
-          if (!(P->h_tid & GCFLAG_OLD)) P->h_tid |= GCFLAG_NURSERY_MOVED;
+          if (!(P->h_tid & GCFLAG_OLD)) P->h_tid |= GCFLAG_MOVED;
           /* P becomes a public outdated object.  It may create an
              exception documented in doc-objects.txt: a public but young
              object.  It's still fine because it should only be seen by
diff --git a/c4/et.h b/c4/et.h
--- a/c4/et.h
+++ b/c4/et.h
@@ -46,7 +46,7 @@
  * the list 'old_objects_to_trace'; it is set again at the next minor
  * collection.
  *
- * GCFLAG_NURSERY_MOVED is used temporarily during minor collections.
+ * GCFLAG_MOVED is used temporarily during minor/major collections.
  *
  * GCFLAG_STUB is set for debugging on stub objects made by stealing or
  * by major collections.  'p_stub->h_revision' might be a value
@@ -67,7 +67,7 @@
 static const revision_t GCFLAG_PREBUILT_ORIGINAL      = STM_FIRST_GCFLAG << 3;
 static const revision_t GCFLAG_PUBLIC_TO_PRIVATE      = STM_FIRST_GCFLAG << 4;
 // in stmgc.h:          GCFLAG_WRITE_BARRIER          = STM_FIRST_GCFLAG << 5;
-static const revision_t GCFLAG_NURSERY_MOVED          = STM_FIRST_GCFLAG << 6;
+static const revision_t GCFLAG_MOVED          = STM_FIRST_GCFLAG << 6;
 static const revision_t GCFLAG_BACKUP_COPY  /*debug*/ = STM_FIRST_GCFLAG << 7;
 static const revision_t GCFLAG_STUB         /*debug*/ = STM_FIRST_GCFLAG << 8;
 static const revision_t GCFLAG_PRIVATE_FROM_PROTECTED = STM_FIRST_GCFLAG << 9;
@@ -85,7 +85,7 @@
                          "PREBUILT_ORIGINAL", \
                          "PUBLIC_TO_PRIVATE", \
                          "WRITE_BARRIER",     \
-                         "NURSERY_MOVED",     \
+                         "MOVED",     \
                          "BACKUP_COPY",       \
                          "STUB",              \
                          "PRIVATE_FROM_PROTECTED", \
diff --git a/c4/gcpage.c b/c4/gcpage.c
--- a/c4/gcpage.c
+++ b/c4/gcpage.c
@@ -223,7 +223,7 @@
             id_copy->h_tid &= ~GCFLAG_PUBLIC_TO_PRIVATE;
             /* see fix_outdated() */
             id_copy->h_tid |= GCFLAG_VISITED;
-            assert(!(id_copy->h_tid & GCFLAG_NURSERY_MOVED));
+            assert(!(id_copy->h_tid & GCFLAG_MOVED));
 
             /* XXX: may not always need tracing? */
             if (!(id_copy->h_tid & GCFLAG_STUB))
@@ -278,7 +278,7 @@
            public_to_private. Otherwise, inevitable transactions
            would think their public obj was modified (also for
            other transactions, but they can abort) */
-        obj->h_tid |= GCFLAG_NURSERY_MOVED;
+        obj->h_tid |= GCFLAG_MOVED;
         
         return id_copy;
     }
@@ -316,7 +316,7 @@
             }
 
             obj->h_tid |= GCFLAG_VISITED;
-            assert(!(obj->h_tid & GCFLAG_NURSERY_MOVED));
+            assert(!(obj->h_tid & GCFLAG_MOVED));
 
             gcptrlist_insert(&objects_to_trace, obj);
 
@@ -341,7 +341,7 @@
             obj = (gcptr)(obj->h_revision - 2);
             if (!(obj->h_tid & GCFLAG_PUBLIC)) {
                 prev_obj->h_tid |= GCFLAG_VISITED;
-                assert(!(prev_obj->h_tid & GCFLAG_NURSERY_MOVED));
+                assert(!(prev_obj->h_tid & GCFLAG_MOVED));
 
                 keep_original_alive(prev_obj);
 
@@ -385,10 +385,10 @@
         }
         
         obj->h_tid |= GCFLAG_VISITED;
-        assert(!(obj->h_tid & GCFLAG_NURSERY_MOVED));
+        assert(!(obj->h_tid & GCFLAG_MOVED));
         assert(!(obj->h_tid & GCFLAG_STUB));
             
-        if (!(B->h_tid & GCFLAG_NURSERY_MOVED)) {
+        if (!(B->h_tid & GCFLAG_MOVED)) {
             B->h_tid |= GCFLAG_VISITED;
             assert(!(B->h_tid & GCFLAG_STUB));
             gcptrlist_insert2(&objects_to_trace, obj, B);
@@ -418,7 +418,7 @@
     if (!(obj->h_tid & GCFLAG_VISITED)) {
         obj->h_tid &= ~GCFLAG_PUBLIC_TO_PRIVATE;  /* see fix_outdated() */
         obj->h_tid |= GCFLAG_VISITED;
-        assert(!(obj->h_tid & GCFLAG_NURSERY_MOVED));
+        assert(!(obj->h_tid & GCFLAG_MOVED));
         gcptrlist_insert(&objects_to_trace, obj);
 
         if (IS_POINTER(obj->h_revision)) {
@@ -516,7 +516,7 @@
         G2L_LOOP_FORWARD(d->public_to_private, item) {
             gcptr R = item->addr;
             gcptr L = item->val;
-            if (R->h_tid & GCFLAG_NURSERY_MOVED) {
+            if (R->h_tid & GCFLAG_MOVED) {
                 /* R was copied over its original */
                 gcptr new_R = (gcptr)R->h_original;
                 /* gcptrlist_insert(&objects_to_trace, new_R); */
@@ -600,7 +600,7 @@
         gcptr obj = items[i];
         assert(obj->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED);
         /* we don't copy private / protected objects over prebuilts (yet) */
-        assert(!(obj->h_tid & GCFLAG_NURSERY_MOVED));
+        assert(!(obj->h_tid & GCFLAG_MOVED));
 
         if (!(obj->h_tid & GCFLAG_VISITED)) {
             /* forget 'obj' */
@@ -615,7 +615,7 @@
     items = d->old_objects_to_trace.items;
     for (i = d->old_objects_to_trace.size - 1; i >= 0; i--) {
         gcptr obj = items[i];
-        assert(!(obj->h_tid & GCFLAG_NURSERY_MOVED));
+        assert(!(obj->h_tid & GCFLAG_MOVED));
         assert(obj->h_tid & GCFLAG_VISITED);
     }
 #endif
@@ -636,7 +636,7 @@
         gcptr obj = items[i];
         assert(!(obj->h_tid & GCFLAG_STUB));
 
-        if (obj->h_tid & GCFLAG_NURSERY_MOVED) {
+        if (obj->h_tid & GCFLAG_MOVED) {
             assert(!(obj->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED));
             obj = (gcptr)obj->h_revision;
             items[i] = obj;
@@ -652,7 +652,7 @@
             obj = (gcptr)obj->h_revision;
 
             /* the backup-ptr should already be updated: */
-            assert(!(obj->h_tid & GCFLAG_NURSERY_MOVED));
+            assert(!(obj->h_tid & GCFLAG_MOVED));
         }
 
         revision_t v = obj->h_revision;
@@ -695,7 +695,7 @@
     G2L_LOOP_FORWARD(d->public_to_private, item) {
         assert(item->addr->h_tid & GCFLAG_VISITED);
         assert(item->val->h_tid & GCFLAG_VISITED);
-        assert(!(item->addr->h_tid & GCFLAG_NURSERY_MOVED));
+        assert(!(item->addr->h_tid & GCFLAG_MOVED));
         assert(item->addr->h_tid & GCFLAG_PUBLIC);
         /* assert(is_private(item->val)); but in the other thread,
            which becomes: */
diff --git a/c4/nursery.c b/c4/nursery.c
--- a/c4/nursery.c
+++ b/c4/nursery.c
@@ -132,7 +132,7 @@
 static inline gcptr create_old_object_copy(gcptr obj)
 {
     assert(!(obj->h_tid & GCFLAG_PUBLIC));
-    assert(!(obj->h_tid & GCFLAG_NURSERY_MOVED));
+    assert(!(obj->h_tid & GCFLAG_MOVED));
     assert(!(obj->h_tid & GCFLAG_VISITED));
     assert(!(obj->h_tid & GCFLAG_WRITE_BARRIER));
     assert(!(obj->h_tid & GCFLAG_PREBUILT_ORIGINAL));
@@ -155,9 +155,9 @@
     }
     else {
         /* it's a nursery object.  Was it already moved? */
-        if (UNLIKELY(obj->h_tid & GCFLAG_NURSERY_MOVED)) {
+        if (UNLIKELY(obj->h_tid & GCFLAG_MOVED)) {
             /* yes.  Such an object can be a public object in the nursery
-               too (such objects are always NURSERY_MOVED).  For all cases,
+               too (such objects are always MOVED).  For all cases,
                we can just fix the ref. 
                Can be stolen objects or those we already moved.
             */
@@ -178,7 +178,7 @@
             fresh_old_copy = create_old_object_copy(obj);
         }
         
-        obj->h_tid |= GCFLAG_NURSERY_MOVED;
+        obj->h_tid |= GCFLAG_MOVED;
         obj->h_revision = (revision_t)fresh_old_copy;
 
         /* fix the original reference */
@@ -414,13 +414,13 @@
             /* non-young or visited young objects are kept */
             continue;
         }
-        else if (obj->h_tid & GCFLAG_NURSERY_MOVED) {
+        else if (obj->h_tid & GCFLAG_MOVED) {
             /* visited nursery objects are kept and updated */
             items[i] = (gcptr)obj->h_revision;
             assert(!(items[i]->h_tid & GCFLAG_STUB));
             continue;
         }
-        /* Sanity check: a nursery object without the NURSERY_MOVED flag
+        /* Sanity check: a nursery object without the MOVED flag
            is necessarily a private-without-backup object, or a protected
            object; it cannot be a public object. */
         assert(!(obj->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED));
@@ -459,7 +459,7 @@
     setup_minor_collect(d);
 
     /* first do this, which asserts that some objects are private ---
-       which fails if they have already been GCFLAG_NURSERY_MOVED */
+       which fails if they have already been GCFLAG_MOVED */
     mark_public_to_young(d);
 
     mark_young_roots(d);
diff --git a/c4/steal.c b/c4/steal.c
--- a/c4/steal.c
+++ b/c4/steal.c
@@ -158,7 +158,7 @@
 
             /* note that we should follow h_revision at least one more
                step: it is necessary if L is public but young (and then
-               has GCFLAG_NURSERY_MOVED), but it is fine to do it more
+               has GCFLAG_MOVED), but it is fine to do it more
                generally. */
             v = ACCESS_ONCE(L->h_revision);
             if (IS_POINTER(v)) {
@@ -191,7 +191,7 @@
             }
             L->h_revision = (revision_t)O;
 
-            L->h_tid |= GCFLAG_PUBLIC | GCFLAG_NURSERY_MOVED;
+            L->h_tid |= GCFLAG_PUBLIC | GCFLAG_MOVED;
             /* subtle: we need to remove L from the fxcache of the target
                thread, otherwise its read barrier might not trigger on it.
                It is mostly fine because it is anyway identical to O.  But
diff --git a/c4/test/support.py b/c4/test/support.py
--- a/c4/test/support.py
+++ b/c4/test/support.py
@@ -129,7 +129,7 @@
     #define GCFLAG_BACKUP_COPY       ...
     #define GCFLAG_PUBLIC_TO_PRIVATE ...
     #define GCFLAG_WRITE_BARRIER     ...
-    #define GCFLAG_NURSERY_MOVED     ...
+    #define GCFLAG_MOVED     ...
     #define GCFLAG_STUB              ...
     #define GCFLAG_PRIVATE_FROM_PROTECTED  ...
     #define GCFLAG_HAS_ID            ...
@@ -645,9 +645,9 @@
             return "stub"
         else:
             # public objects usually never live in the nursery, but
-            # if stealing makes one, it has GCFLAG_NURSERY_MOVED.
+            # if stealing makes one, it has GCFLAG_MOVED.
             if lib.in_nursery(p):
-                assert p.h_tid & GCFLAG_NURSERY_MOVED
+                assert p.h_tid & GCFLAG_MOVED
                 assert not (p.h_revision & 1)   # "is a pointer"
             return "public"
     if backup:
diff --git a/c4/test/test_et.py b/c4/test/test_et.py
--- a/c4/test/test_et.py
+++ b/c4/test/test_et.py
@@ -396,7 +396,7 @@
         assert p2 == lib.stm_read_barrier(p)
         assert p2 != plist[-1]   # p2 is a public moved-out-of-nursery
         assert plist[-1].h_tid & GCFLAG_PUBLIC
-        assert plist[-1].h_tid & GCFLAG_NURSERY_MOVED
+        assert plist[-1].h_tid & GCFLAG_MOVED
         assert plist[-1].h_revision == int(ffi.cast("revision_t", p2))
         assert classify(p2) == "public"
         r.set(3)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to