[pypy-commit] pypy stm-thread-2: Fix: must do this step after the GC was annotated.
arigo
noreply at buildbot.pypy.org
Mon Feb 18 17:43:35 CET 2013
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread-2
Changeset: r61416:8c39c061c441
Date: 2013-02-18 17:42 +0100
http://bitbucket.org/pypy/pypy/changeset/8c39c061c441/
Log: Fix: must do this step after the GC was annotated.
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
@@ -143,8 +143,8 @@
self.getentrypointptr() # build the wrapper first
# ^^ this is needed to make sure we see the no-GC wrapper function
# calling the GC entrypoint function.
- transformer = transform2.STMTransformer(self.translator)
- transformer.transform()
+ stmtransformer = transform2.STMTransformer(self.translator)
+ stmtransformer.transform()
gcpolicyclass = self.get_gcpolicyclass()
@@ -157,7 +157,10 @@
thread_enabled=self.config.translation.thread,
sandbox=self.config.translation.sandbox)
self.db = db
-
+
+ if self.config.translation.stm:
+ stmtransformer.transform_after_gc()
+
# give the gc a chance to register interest in the start-up functions it
# need (we call this for its side-effects of db.get())
list(db.gcpolicy.gc_startup_code())
diff --git a/rpython/translator/stm/threadlocalref.py b/rpython/translator/stm/threadlocalref.py
--- a/rpython/translator/stm/threadlocalref.py
+++ b/rpython/translator/stm/threadlocalref.py
@@ -18,8 +18,6 @@
if (op.opname == 'stm_threadlocalref_set' or
op.opname == 'stm_threadlocalref_get'):
ids.add(op.args[0].value)
- if len(ids) == 0:
- return
#
ids = sorted(ids)
fields = [('ptr%d' % id1, llmemory.Address) for id1 in ids]
diff --git a/rpython/translator/stm/transform2.py b/rpython/translator/stm/transform2.py
--- a/rpython/translator/stm/transform2.py
+++ b/rpython/translator/stm/transform2.py
@@ -7,13 +7,16 @@
def transform(self):
assert not hasattr(self.translator, 'stm_transformation_applied')
self.start_log()
- self.transform_threadlocalref()
self.transform_jit_driver()
self.transform_write_barrier()
self.transform_turn_inevitable()
self.print_logs()
self.translator.stm_transformation_applied = True
+ def transform_after_gc(self):
+ self.transform_threadlocalref()
+ self.print_logs_after_gc()
+
def transform_write_barrier(self):
from rpython.translator.backendopt.writeanalyze import WriteAnalyzer
from rpython.translator.stm.writebarrier import insert_stm_barrier
@@ -46,3 +49,7 @@
def print_logs(self):
from rpython.translator.c.support import log
log.info("Software Transactional Memory transformation applied")
+
+ def print_logs_after_gc(self):
+ from rpython.translator.c.support import log
+ log.info("Software Transactional Memory transformation-after-gc done")
More information about the pypy-commit
mailing list