Author: Armin Rigo <ar...@tunes.org> Branch: stm-gc-2 Changeset: r63444:55b694882862 Date: 2013-04-17 14:57 +0200 http://bitbucket.org/pypy/pypy/changeset/55b694882862/
Log: Translation fixes and a "bah": can't seem to get a doubly-linked list implementation correct. (stm/test/test_ztranslated.test_targetdemo) diff --git a/rpython/memory/gc/stmgc.py b/rpython/memory/gc/stmgc.py --- a/rpython/memory/gc/stmgc.py +++ b/rpython/memory/gc/stmgc.py @@ -203,14 +203,17 @@ llop.nop(lltype.Void, llhelper(self.stm_operations.DUPLICATE, self._stm_duplicate)) # + self.ll_global_lock = rthread.null_ll_lock self.sharedarea.setup() # self.linked_list_stmtls = None - self.ll_global_lock = rthread.allocate_ll_lock() # self.stm_operations.descriptor_init() self.stm_operations.begin_inevitable_transaction() self.setup_thread() + # + # Now the gc is running, we can allocate this lock object + self.ll_global_lock = rthread.allocate_ll_lock() def setup_thread(self): """Build the StmGCTLS object and start a transaction at the level @@ -237,15 +240,22 @@ stmtls.delete() def acquire_global_lock(self): - rthread.acquire_NOAUTO(self.ll_global_lock, True) + if self.ll_global_lock: + rthread.acquire_NOAUTO(self.ll_global_lock, True) def release_global_lock(self): - rthread.release_NOAUTO(self.ll_global_lock) + if self.ll_global_lock: + rthread.release_NOAUTO(self.ll_global_lock) def add_in_linked_list(self, stmtls): self.acquire_global_lock() + stmnext = self.linked_list_stmtls stmtls.linked_list_prev = None - stmtls.linked_list_next = self.linked_list_stmtls + stmtls.linked_list_next = stmnext + if stmnext is not None: + ll_assert(stmnext.linked_list_prev is None, + "add_in_linked_list: bad linked list") + stmnext.linked_list_prev = stmtls self.linked_list_stmtls = stmtls self.release_global_lock() @@ -254,9 +264,9 @@ c = 0 stmprev = stmtls.linked_list_prev stmnext = stmtls.linked_list_next - if stmnext: + if stmnext is not None: stmnext.linked_list_prev = stmprev - if stmprev: + if stmprev is not None: stmprev.linked_list_next = stmnext c += 1 if stmtls is self.linked_list_stmtls: diff --git a/rpython/memory/gc/stmshared.py b/rpython/memory/gc/stmshared.py --- a/rpython/memory/gc/stmshared.py +++ b/rpython/memory/gc/stmshared.py @@ -80,13 +80,7 @@ self.count_global_pages = 0 def setup(self): - self.ll_global_lock = rthread.allocate_ll_lock() - - def acquire_global_lock(self): - rthread.acquire_NOAUTO(self.ll_global_lock, True) - - def release_global_lock(self): - rthread.release_NOAUTO(self.ll_global_lock) + pass # ------------------------------------------------------------ @@ -239,7 +233,7 @@ them out. """ stmshared = self.sharedarea - stmshared.acquire_global_lock() + stmshared.gc.acquire_global_lock() i = stmshared.length - 1 while i >= 1: lpage = self.pages_for_size[i] @@ -250,7 +244,7 @@ stmshared.full_pages[i] = lpage i -= 1 stmshared.count_global_pages += self.count_pages - stmshared.release_global_lock() + stmshared.gc.release_global_lock() def delete(self): self.gift_all_pages_to_shared_area() diff --git a/rpython/rlib/rthread.py b/rpython/rlib/rthread.py --- a/rpython/rlib/rthread.py +++ b/rpython/rlib/rthread.py @@ -200,6 +200,7 @@ res = c_thread_acquirelock_NOAUTO(ll_lock, flag) res = rffi.cast(lltype.Signed, res) return bool(res) +acquire_NOAUTO._annenforceargs_ = (None, bool) def release_NOAUTO(ll_lock): if not we_are_translated(): diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py --- a/rpython/translator/c/genc.py +++ b/rpython/translator/c/genc.py @@ -355,6 +355,11 @@ def cmdexec(self, args='', env=None, err=False, expect_crash=False): assert self._compiled + if env is None: + envrepr = '' + else: + envrepr = ' [env=%r]' % (env,) + log.cmdexec('%s %s%s' % (self.executable_name, args, envrepr)) res = self.translator.platform.execute(self.executable_name, args, env=env) if res.returncode != 0: _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit