[pypy-commit] pypy stmgc-c4: write a test and fix

Raemi noreply at buildbot.pypy.org
Sun Jan 12 14:11:17 CET 2014


Author: Remi Meier <remi.meier at gmail.com>
Branch: stmgc-c4
Changeset: r68605:85b192f1e657
Date: 2014-01-12 12:56 +0100
http://bitbucket.org/pypy/pypy/changeset/85b192f1e657/

Log:	write a test and fix

diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -201,7 +201,7 @@
             funcaddr = llmemory.cast_ptr_to_adr(funcptr)
             mi._record_helper_nonpure_varargs(
                 rop.CALL, resbox, funcdescr,
-                [ConstInt(mi.cpu.cast_adr_to_int(funcaddr)),])
+                [ConstInt(heaptracker.adr2int(funcaddr)),])
             return resbox
         else:
             return ConstInt(0)
@@ -1502,8 +1502,10 @@
         if warmrunnerdesc:
             self.config = warmrunnerdesc.translator.config
         else:
-            from rpython.config.translationoption import get_combined_translation_config
-            self.config = get_combined_translation_config(translating=True)
+            self.config = cpu.rtyper.annotator.translator.config
+        # else:
+        #     from rpython.config.translationoption import get_combined_translation_config
+        #     self.config = get_combined_translation_config(translating=True)
 
         backendmodule = self.cpu.__module__
         backendmodule = backendmodule.split('.')[-2]
@@ -1523,7 +1525,8 @@
             self.stm_should_break_transaction = rffi.llexternal(
                 'stm_should_break_transaction',
                 [], lltype.Bool,
-                sandboxsafe=True, _nowrapper=True, transactionsafe=True)
+                sandboxsafe=True, _nowrapper=True, transactionsafe=True,
+                _callable=lambda : False)
             FUNC = lltype.typeOf(self.stm_should_break_transaction).TO
 
             ei = EffectInfo([], [], [], [],
diff --git a/rpython/jit/metainterp/test/test_stm.py b/rpython/jit/metainterp/test/test_stm.py
--- a/rpython/jit/metainterp/test/test_stm.py
+++ b/rpython/jit/metainterp/test/test_stm.py
@@ -14,6 +14,19 @@
             return rstm.jit_stm_should_break_transaction(False)
         res = self.interp_operations(g, [])
         assert res == False
+        self.check_operations_history({})
+
+    def test_not_removed(self):
+        import time
+        def g():
+            time.sleep(0)
+            return rstm.jit_stm_should_break_transaction(False)
+        res = self.interp_operations(g, [], translationoptions={"stm":True})
+        assert res == False
+        self.check_operations_history(call=1, call_may_force=1)
+        
+            
+    
 
 class TestLLtype(STMTests, LLJitMixin):
     pass


More information about the pypy-commit mailing list