Author: Armin Rigo <[email protected]>
Branch: stmgc-c4
Changeset: r65164:041f5c2e4e68
Date: 2013-07-02 09:29 +0200
http://bitbucket.org/pypy/pypy/changeset/041f5c2e4e68/
Log: Yay, targetdemo2 passes
diff --git a/rpython/memory/gctransform/stmframework.py
b/rpython/memory/gctransform/stmframework.py
--- a/rpython/memory/gctransform/stmframework.py
+++ b/rpython/memory/gctransform/stmframework.py
@@ -46,10 +46,22 @@
def gc_header_for(self, obj, needs_hash=False):
return self.gcdata.gc.gcheaderbuilder.header_of_object(obj)
+ def _gct_with_roots_pushed(self, hop):
+ livevars = self.push_roots(hop)
+ self.default(hop)
+ self.pop_roots(hop, livevars)
+
+ gct_stm_become_inevitable = _gct_with_roots_pushed
+ gct_stm_perform_transaction = _gct_with_roots_pushed
+
class StmRootWalker(BaseRootWalker):
def need_thread_support(self, gctransformer, getfn):
+ # gc_thread_start() and gc_thread_die() don't need to become
+ # anything. When a new thread start, there is anyway first
+ # the "after/before" callbacks from rffi, which contain calls
+ # to "stm_enter_callback_call/stm_leave_callback_call".
pass
def walk_stack_roots(self, collect_stack_root):
diff --git a/rpython/rtyper/lltypesystem/lloperation.py
b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -424,10 +424,10 @@
'stm_initialize': LLOp(),
'stm_finalize': LLOp(),
'stm_barrier': LLOp(sideeffects=False),
- 'stm_allocate': LLOp(sideeffects=False),
- 'stm_become_inevitable': LLOp(),
- 'stm_minor_collect': LLOp(),
- 'stm_major_collect': LLOp(),
+ 'stm_allocate': LLOp(sideeffects=False, canmallocgc=True),
+ 'stm_become_inevitable': LLOp(canmallocgc=True),
+ 'stm_minor_collect': LLOp(canmallocgc=True),
+ 'stm_major_collect': LLOp(canmallocgc=True),
'stm_get_tid': LLOp(canfold=True),
'stm_ptr_eq': LLOp(canfold=True),
'stm_id': LLOp(sideeffects=False),
@@ -440,7 +440,7 @@
'stm_set_transaction_length': LLOp(),
'stm_change_atomic': LLOp(),
'stm_get_atomic': LLOp(sideeffects=False),
- 'stm_perform_transaction':LLOp(),
+ 'stm_perform_transaction':LLOp(canmallocgc=True),
'stm_enter_callback_call':LLOp(),
'stm_leave_callback_call':LLOp(),
diff --git a/rpython/translator/stm/jitdriver.py
b/rpython/translator/stm/jitdriver.py
--- a/rpython/translator/stm/jitdriver.py
+++ b/rpython/translator/stm/jitdriver.py
@@ -63,7 +63,6 @@
# store (green args, red args) into p
# return 1 # causes perform_tr() to loop and call us again
# p.result_value = result_value
- # p.got_exception = NULL
# return 0 # stop perform_tr() and returns
def __init__(self, stmtransformer, graph):
@@ -212,21 +211,16 @@
blockst.closeblock(Link(a_vars, link.target))
#
# hack at the regular return block, to set the result into
- # 'p.result_value', clear 'p.got_exception', and return 0
+ # 'p.result_value' and return 0. Note that 'p.got_exception'
+ # is already cleared.
blockr = callback_graph.returnblock
c_result_value = Constant('result_value', lltype.Void)
- c_got_exception = Constant('got_exception', lltype.Void)
- c_null = Constant(lltype.nullptr(self.CONTAINER.got_exception.TO),
- self.CONTAINER.got_exception)
v_p = self.container_var()
renamed_p[blockr] = v_p
blockr.operations = [
SpaceOperation('setfield',
[v_p, c_result_value, blockr.inputargs[0]],
varoftype(lltype.Void)),
- SpaceOperation('setfield',
- [v_p, c_got_exception, c_null],
- varoftype(lltype.Void)),
]
v = varoftype(lltype.Signed)
annotator.setbinding(v, s_Int)
diff --git a/rpython/translator/stm/stmgcintf.py
b/rpython/translator/stm/stmgcintf.py
--- a/rpython/translator/stm/stmgcintf.py
+++ b/rpython/translator/stm/stmgcintf.py
@@ -7,7 +7,7 @@
cdir = os.path.abspath(os.path.join(cdir2, '..', 'stm'))
separate_source = '''
-#define _GC_DEBUG 2 /* XXX move elsewhere */
+//#define _GC_DEBUG 2 /* XXX move elsewhere */
#include "src_stm/stmgc.h"
diff --git a/rpython/translator/stm/test/support.py
b/rpython/translator/stm/test/support.py
--- a/rpython/translator/stm/test/support.py
+++ b/rpython/translator/stm/test/support.py
@@ -14,10 +14,11 @@
# Prevent the RaiseAnalyzer from just emitting "WARNING: Unknown
# operation". We want instead it to crash.
from rpython.translator.backendopt.canraise import RaiseAnalyzer
- RaiseAnalyzer.fail_on_unknown_operation = True
+ prev_setting = RaiseAnalyzer.fail_on_unknown_operation
try:
+ RaiseAnalyzer.fail_on_unknown_operation = True
res = StandaloneTests.compile(self, entry_point, debug=True,
**kwds)
finally:
- RaiseAnalyzer.fail_on_unknown_operation = False
+ RaiseAnalyzer.fail_on_unknown_operation = prev_setting
return res
diff --git a/rpython/translator/stm/test/targetdemo2.py
b/rpython/translator/stm/test/targetdemo2.py
--- a/rpython/translator/stm/test/targetdemo2.py
+++ b/rpython/translator/stm/test/targetdemo2.py
@@ -250,7 +250,6 @@
def setup_threads():
#space.threadlocals.setup_threads(space)
bootstrapper.setup()
- rstm.invoke_around_extcall()
def start_thread(args):
bootstrapper.acquire(args)
diff --git a/rpython/translator/stm/test/test_ztranslated.py
b/rpython/translator/stm/test/test_ztranslated.py
--- a/rpython/translator/stm/test/test_ztranslated.py
+++ b/rpython/translator/stm/test/test_ztranslated.py
@@ -115,8 +115,7 @@
def test_targetdemo(self):
t, cbuilder = self.compile(targetdemo2.entry_point)
- data, dataerr = cbuilder.cmdexec('4 5000', err=True,
- env={'PYPY_GC_DEBUG': '1'})
+ data, dataerr = cbuilder.cmdexec('4 5000', err=True)
assert 'check ok!' in data
def test_bug1(self):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit