Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r127:25521e54d778
Date: 2013-06-14 17:01 +0200
http://bitbucket.org/pypy/stmgc/changeset/25521e54d778/

Log:    Reintroduce oalloc()

diff --git a/c4/test/support.py b/c4/test/support.py
--- a/c4/test/support.py
+++ b/c4/test/support.py
@@ -54,6 +54,7 @@
     void stm_set_transaction_length(long length_max);
 
     /* extra non-public code */
+    void *stm_malloc(size_t size);
     //gcptr stmgcpage_malloc(size_t size);
     //void stmgcpage_free(gcptr obj);
     //long stmgcpage_count(int quantity);
@@ -390,20 +391,18 @@
 # ____________________________________________________________
 
 def oalloc(size):
-    "Allocate an 'old' object, i.e. outside any nursery"
-    p = lib.stmgcpage_malloc(size)
-    p.h_tid = GCFLAG_WRITE_BARRIER | GCFLAG_OLD
-    p.h_revision = lib.get_local_revision()
+    "Allocate an 'old' public object, outside any nursery"
+    p = ffi.cast("gcptr", lib.stm_malloc(size))
+    p.h_tid = GCFLAG_OLD | GCFLAG_PUBLIC
+    p.h_revision = 1
     lib.settid(p, 42 + size)
     return p
 
-#ofree = lib.stmgcpage_free
-
 def oalloc_refs(nrefs):
-    "Allocate an 'old' object, i.e. outside any nursery, with nrefs pointers"
-    p = lib.stmgcpage_malloc(HDR + WORD * nrefs)
-    p.h_tid = GCFLAG_WRITE_BARRIER | GCFLAG_OLD
-    p.h_revision = lib.get_local_revision()
+    "Allocate an 'old' public object, outside any nursery, with nrefs pointers"
+    p = ffi.cast("gcptr", lib.stm_malloc(HDR + WORD * nrefs))
+    p.h_tid = GCFLAG_OLD | GCFLAG_PUBLIC
+    p.h_revision = 1
     lib.settid(p, 421 + nrefs)
     for i in range(nrefs):
         rawsetptr(p, i, ffi.NULL)
diff --git a/c4/test/test_nursery.py b/c4/test/test_nursery.py
--- a/c4/test/test_nursery.py
+++ b/c4/test/test_nursery.py
@@ -126,7 +126,7 @@
     check_not_free(p2b)
 
 def test_minor_collection_at_thread_end():
-    p1 = palloc_refs(1)
+    p1 = oalloc_refs(1)
     p2 = nalloc(HDR)
     setptr(p1, 0, p2)
     lib.stm_finalize()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to