[pypy-commit] pypy stm-gc: In-progress
arigo
noreply at buildbot.pypy.org
Thu Feb 9 16:19:22 CET 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r52299:298267a49c01
Date: 2012-02-09 12:04 +0100
http://bitbucket.org/pypy/pypy/changeset/298267a49c01/
Log: In-progress
diff --git a/pypy/rpython/memory/gc/stmgc.py b/pypy/rpython/memory/gc/stmgc.py
--- a/pypy/rpython/memory/gc/stmgc.py
+++ b/pypy/rpython/memory/gc/stmgc.py
@@ -1,4 +1,4 @@
-from pypy.rpython.lltypesystem import lltype, llmemory, llarena, rffi
+from pypy.rpython.lltypesystem import lltype, llmemory, llarena, llgroup, rffi
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rpython.lltypesystem.llmemory import raw_malloc_usage
from pypy.rpython.memory.gc.base import GCBase
@@ -15,6 +15,7 @@
GCFLAG_GLOBAL = first_gcflag << 0 # keep in sync with et.c
GCFLAG_WAS_COPIED = first_gcflag << 1 # keep in sync with et.c
+GCFLAG_HAS_HASH = first_gcflag << 2
PRIMITIVE_SIZES = {1: lltype.Char,
2: rffi.SHORT,
@@ -41,7 +42,7 @@
HDR = lltype.Struct('header', ('tid', lltype.Signed),
('version', llmemory.Address))
typeid_is_in_field = 'tid'
- withhash_flag_is_in_field = 'tid', 'XXX'
+ withhash_flag_is_in_field = 'tid', GCFLAG_HAS_HASH
GCTLS = lltype.Struct('GCTLS', ('nursery_free', llmemory.Address),
('nursery_top', llmemory.Address),
@@ -80,12 +81,13 @@
self.declare_reader(size, TYPE)
self.declare_write_barrier()
+ GETSIZE = lltype.Ptr(lltype.FuncType([llmemory.Address], lltype.Signed))
+
def setup(self):
"""Called at run-time to initialize the GC."""
GCBase.setup(self)
- GETSIZE = lltype.Ptr(lltype.FuncType([llmemory.Address],lltype.Signed))
self.stm_operations.setup_size_getter(
- llhelper(GETSIZE, self._getsize_fn))
+ llhelper(self.GETSIZE, self._getsize_fn))
self.main_thread_tls = self.setup_thread(True)
self.mutex_lock = ll_thread.allocate_ll_lock()
@@ -201,6 +203,11 @@
@always_inline
+ def get_type_id(self, obj):
+ tid = self.header(obj).tid
+ return llop.extract_ushort(llgroup.HALFWORD, tid)
+
+ @always_inline
def combine(self, typeid16, flags):
return llop.combine_ushort(lltype.Signed, typeid16, flags)
@@ -209,6 +216,10 @@
hdr = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(self.HDR))
hdr.tid = self.combine(typeid16, flags)
+ def init_gc_object_immortal(self, addr, typeid16, flags=0):
+ flags |= GCFLAG_GLOBAL
+ self.init_gc_object(addr, typeid16, flags)
+
# ----------
def declare_reader(self, size, TYPE):
@@ -317,6 +328,10 @@
def release(self, lock):
ll_thread.c_thread_releaselock(lock)
+ # ----------
+
+ def identityhash(self, gcobj):
+ raise NotImplementedError("XXX")
# ------------------------------------------------------------
diff --git a/pypy/rpython/memory/gctransform/framework.py b/pypy/rpython/memory/gctransform/framework.py
--- a/pypy/rpython/memory/gctransform/framework.py
+++ b/pypy/rpython/memory/gctransform/framework.py
@@ -318,7 +318,7 @@
getfn(GCClass.writebarrier_before_copy.im_func,
[s_gc] + [annmodel.SomeAddress()] * 2 +
[annmodel.SomeInteger()] * 3, annmodel.SomeBool())
- elif GCClass.needs_write_barrier:
+ elif GCClass.needs_write_barrier and GCClass.needs_write_barrier != 'stm':
raise NotImplementedError("GC needs write barrier, but does not provide writebarrier_before_copy functionality")
# in some GCs we can inline the common case of
diff --git a/pypy/translator/stm/test/targetdemo.py b/pypy/translator/stm/test/targetdemo.py
--- a/pypy/translator/stm/test/targetdemo.py
+++ b/pypy/translator/stm/test/targetdemo.py
@@ -57,10 +57,10 @@
glob.done += 1
def run_me():
- debug_print("thread starting...")
- arg = Arg()
rstm.descriptor_init()
try:
+ debug_print("thread starting...")
+ arg = Arg()
for i in range(glob.LENGTH):
arg.anchor = glob.anchor
arg.value = i
More information about the pypy-commit
mailing list