Author: Armin Rigo <ar...@tunes.org> Branch: stm-jit Changeset: r56585:90f0811738e1 Date: 2012-08-05 15:33 +0200 http://bitbucket.org/pypy/pypy/changeset/90f0811738e1/
Log: in-progress diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py --- a/pypy/jit/backend/llsupport/gc.py +++ b/pypy/jit/backend/llsupport/gc.py @@ -573,10 +573,19 @@ return rffi.cast(lltype.Signed, rst_addr) +class GcRootMap_stm(GcRootMap_shadowstack): + pass + + class WriteBarrierDescr(AbstractDescr): def __init__(self, gc_ll_descr): self.llop1 = gc_ll_descr.llop1 - self.WB_FUNCPTR = gc_ll_descr.WB_FUNCPTR + if not gc_ll_descr.stm: + self.WB_FUNCPTR = lltype.Ptr(lltype.FuncType( + [llmemory.Address], lltype.Void)) + else: + self.WB_STM_FUNCPTR = lltype.Ptr(lltype.FuncType( + [llmemory.Address], llmemory.Address)) self.fielddescr_tid = gc_ll_descr.fielddescr_tid # GCClass = gc_ll_descr.GCClass @@ -662,7 +671,7 @@ # we need the hybrid or minimark GC for rgc._make_sure_does_not_move() # to work. Additionally, 'hybrid' is missing some stuff like # jit_remember_young_pointer() for now. - if self.gcdescr.config.translation.gc not in ('minimark',): + if self.gcdescr.config.translation.gc not in ('minimark', 'stmgc'): raise NotImplementedError("--gc=%s not implemented with the JIT" % (self.gcdescr.config.translation.gc,)) @@ -704,8 +713,6 @@ self.fielddescr_tid = get_field_descr(self, self.GCClass.HDR, 'tid') def _setup_write_barrier(self): - self.WB_FUNCPTR = lltype.Ptr(lltype.FuncType( - [llmemory.Address], lltype.Void)) self.write_barrier_descr = WriteBarrierDescr(self) def _make_functions(self, really_not_translated): @@ -862,11 +869,13 @@ # get a pointer to the 'remember_young_pointer' function from # the GC, and call it immediately llop1 = self.llop1 - funcptr = llop1.get_write_barrier_failing_case(self.WB_FUNCPTR) + funcptr = llop1.get_write_barrier_failing_case( + self.write_barrier_descr.WB_FUNCPTR) funcptr(llmemory.cast_ptr_to_adr(gcref_struct)) def can_use_nursery_malloc(self, size): - return size < self.max_size_of_young_obj + return (self.max_size_of_young_obj is None or + size < self.max_size_of_young_obj) def has_write_barrier_class(self): return WriteBarrierDescr diff --git a/pypy/jit/metainterp/gc.py b/pypy/jit/metainterp/gc.py --- a/pypy/jit/metainterp/gc.py +++ b/pypy/jit/metainterp/gc.py @@ -25,6 +25,9 @@ class GC_minimark(GcDescription): malloc_zero_filled = True +class GC_stmgc(GcDescription): + malloc_zero_filled = True + def get_description(config): name = config.translation.gc diff --git a/pypy/rpython/lltypesystem/lloperation.py b/pypy/rpython/lltypesystem/lloperation.py --- a/pypy/rpython/lltypesystem/lloperation.py +++ b/pypy/rpython/lltypesystem/lloperation.py @@ -409,6 +409,9 @@ 'stm_start_transaction': LLOp(canrun=True, canmallocgc=True), 'stm_stop_transaction': LLOp(canrun=True, canmallocgc=True), + 'stm_gc_load': LLOp(sideeffects=False), + 'stm_gc_store': LLOp(), + # __________ address operations __________ 'boehm_malloc': LLOp(), 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 @@ -233,6 +233,16 @@ tls = self.stm_operations.get_tls() return StmGCTLS.cast_address_to_tls_object(tls) + @staticmethod + def JIT_max_size_of_young_obj(): + return None + + @staticmethod + def JIT_minimal_size_in_nursery(): + return 0 + + JIT_WB_IF_FLAG = GCFLAG_GLOBAL + # ---------- def malloc_fixedsize_clear(self, typeid, size, @@ -387,7 +397,7 @@ # should not really let the exception propagate. # XXX do something slightly better, like abort the transaction # and raise a MemoryError when retrying - fatalerror("MemoryError in _stm_write_barrier_global -- sorry") + fatalerror("FIXME: MemoryError in _stm_write_barrier_global") return llmemory.NULL # # Initialize the copy by doing an stm raw copy of the bytes _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit