[pypy-commit] pypy stm: (arigo, antocuni): rename _rffi_stm.* to _rffi_stm.stm_* and rstm.stm_* to rstm.*

antocuni noreply at buildbot.pypy.org
Mon Jan 16 18:15:40 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: stm
Changeset: r51356:f19ffa0b7bb3
Date: 2012-01-16 18:14 +0100
http://bitbucket.org/pypy/pypy/changeset/f19ffa0b7bb3/

Log:	(arigo, antocuni): rename _rffi_stm.* to _rffi_stm.stm_* and
	rstm.stm_* to rstm.*

diff --git a/pypy/rlib/rstm.py b/pypy/rlib/rstm.py
--- a/pypy/rlib/rstm.py
+++ b/pypy/rlib/rstm.py
@@ -19,7 +19,7 @@
     return _stm_callback
 
 @specialize.arg(0, 1)
-def stm_perform_transaction(func, argcls, arg):
+def perform_transaction(func, argcls, arg):
     assert isinstance(arg, argcls)
     assert argcls._alloc_nonmovable_
     if we_are_translated():
@@ -31,8 +31,8 @@
         llarg = lltype.nullptr(rffi.VOIDP.TO)
     callback = _get_stm_callback(func, argcls)
     llcallback = llhelper(_rffi_stm.CALLBACK, callback)
-    _rffi_stm.perform_transaction(llcallback, llarg)
+    _rffi_stm.stm_perform_transaction(llcallback, llarg)
     keepalive_until_here(arg)
 
-stm_descriptor_init = _rffi_stm.descriptor_init
-stm_descriptor_done = _rffi_stm.descriptor_done
+descriptor_init = _rffi_stm.stm_descriptor_init
+descriptor_done = _rffi_stm.stm_descriptor_done
diff --git a/pypy/rlib/test/test_rstm.py b/pypy/rlib/test/test_rstm.py
--- a/pypy/rlib/test/test_rstm.py
+++ b/pypy/rlib/test/test_rstm.py
@@ -10,9 +10,9 @@
         arg.x = 42
 
     arg = Arg()
-    rstm.stm_descriptor_init()
-    rstm.stm_perform_transaction(setx, Arg, arg)
-    rstm.stm_descriptor_done()
+    rstm.descriptor_init()
+    rstm.perform_transaction(setx, Arg, arg)
+    rstm.descriptor_done()
     assert arg.x == 42
 
 
diff --git a/pypy/translator/stm/_rffi_stm.py b/pypy/translator/stm/_rffi_stm.py
--- a/pypy/translator/stm/_rffi_stm.py
+++ b/pypy/translator/stm/_rffi_stm.py
@@ -23,14 +23,14 @@
 SignedP = rffi.CArrayPtr(lltype.Signed)
 
 
-descriptor_init = llexternal('stm_descriptor_init', [], lltype.Void)
-descriptor_done = llexternal('stm_descriptor_done', [], lltype.Void)
+stm_descriptor_init = llexternal('stm_descriptor_init', [], lltype.Void)
+stm_descriptor_done = llexternal('stm_descriptor_done', [], lltype.Void)
 
 ##begin_transaction = llexternal('STM_begin_transaction', [], lltype.Void)
 ##begin_inevitable_transaction = llexternal('stm_begin_inevitable_transaction',
 ##                                          [], lltype.Void)
 ##commit_transaction = llexternal('stm_commit_transaction', [], lltype.Signed)
-try_inevitable = llexternal('stm_try_inevitable', [], lltype.Void)
+stm_try_inevitable = llexternal('stm_try_inevitable', [], lltype.Void)
 
 ##descriptor_init_and_being_inevitable_transaction = llexternal(
 ##    'stm_descriptor_init_and_being_inevitable_transaction', [], lltype.Void)
@@ -42,7 +42,7 @@
                             lltype.Void)
 
 CALLBACK = lltype.Ptr(lltype.FuncType([rffi.VOIDP], rffi.VOIDP))
-perform_transaction = llexternal('stm_perform_transaction',
-                                 [CALLBACK, rffi.VOIDP], rffi.VOIDP)
+stm_perform_transaction = llexternal('stm_perform_transaction',
+                                     [CALLBACK, rffi.VOIDP], rffi.VOIDP)
 
-abort_and_retry = llexternal('stm_abort_and_retry', [], lltype.Void)
+stm_abort_and_retry = llexternal('stm_abort_and_retry', [], lltype.Void)
diff --git a/pypy/translator/stm/test/test_funcgen.py b/pypy/translator/stm/test/test_funcgen.py
--- a/pypy/translator/stm/test/test_funcgen.py
+++ b/pypy/translator/stm/test/test_funcgen.py
@@ -1,9 +1,9 @@
 from pypy.rpython.lltypesystem import lltype, rffi
 from pypy.rlib.rarithmetic import r_longlong, r_singlefloat
-from pypy.translator.stm.test.test_transform import CompiledSTMTests
+from pypy.rlib.test.test_rstm import CompiledSTMTests
 #from pypy.rlib import rstm
-from pypy.translator.stm._rffi_stm import (CALLBACK, perform_transaction,
-                                           descriptor_init, descriptor_done)
+from pypy.translator.stm._rffi_stm import (CALLBACK, stm_perform_transaction,
+                                           stm_descriptor_init, stm_descriptor_done)
 from pypy.translator.c.test.test_standalone import StandaloneTests
 from pypy.rlib.debug import debug_print
 from pypy.rpython.annlowlevel import llhelper
@@ -251,9 +251,9 @@
     def test_getfield_all_sizes_inside_transaction(self):
         def do_stm_getfield(argv):
             callback = llhelper(CALLBACK, _play_with_getfield)
-            descriptor_init()
-            perform_transaction(callback, NULL)
-            descriptor_done()
+            stm_descriptor_init()
+            stm_perform_transaction(callback, NULL)
+            stm_descriptor_done()
             return 0
         t, cbuilder = self.compile(do_stm_getfield)
         cbuilder.cmdexec('')
@@ -269,11 +269,11 @@
         def do_stm_setfield(argv):
             callback1 = llhelper(CALLBACK, _play_with_setfields)
             callback2 = llhelper(CALLBACK, _check_values_of_fields)
-            descriptor_init()
-            perform_transaction(callback1, NULL)
+            stm_descriptor_init()
+            stm_perform_transaction(callback1, NULL)
             # read values which aren't local to the transaction
-            perform_transaction(callback2, NULL)
-            descriptor_done()
+            stm_perform_transaction(callback2, NULL)
+            stm_descriptor_done()
             return 0
         t, cbuilder = self.compile(do_stm_setfield)
         cbuilder.cmdexec('')
@@ -288,9 +288,9 @@
     def test_getarrayitem_all_sizes_inside_transaction(self):
         def do_stm_getarrayitem(argv):
             callback = llhelper(CALLBACK, _play_with_getarrayitem)
-            descriptor_init()
-            perform_transaction(callback, NULL)
-            descriptor_done()
+            stm_descriptor_init()
+            stm_perform_transaction(callback, NULL)
+            stm_descriptor_done()
             return 0
         t, cbuilder = self.compile(do_stm_getarrayitem)
         cbuilder.cmdexec('')
@@ -311,11 +311,11 @@
             callback2 = llhelper(CALLBACK, _play_with_setarrayitem_2)
             callback3 = llhelper(CALLBACK, _play_with_setarrayitem_3)
             #
-            descriptor_init()
-            perform_transaction(callback1, NULL)
-            perform_transaction(callback2, NULL)
-            perform_transaction(callback3, NULL)
-            descriptor_done()
+            stm_descriptor_init()
+            stm_perform_transaction(callback1, NULL)
+            stm_perform_transaction(callback2, NULL)
+            stm_perform_transaction(callback3, NULL)
+            stm_descriptor_done()
             return 0
         t, cbuilder = self.compile(do_stm_setarrayitem)
         cbuilder.cmdexec('')
@@ -330,9 +330,9 @@
     def test_getinteriorfield_all_sizes_inside_transaction(self):
         def do_stm_getinteriorfield(argv):
             callback = llhelper(CALLBACK, _play_with_getinteriorfield)
-            descriptor_init()
-            perform_transaction(callback, NULL)
-            descriptor_done()
+            stm_descriptor_init()
+            stm_perform_transaction(callback, NULL)
+            stm_descriptor_done()
             return 0
         t, cbuilder = self.compile(do_stm_getinteriorfield)
         cbuilder.cmdexec('')
@@ -351,10 +351,10 @@
             callback1 = llhelper(CALLBACK, _play_with_setinteriorfield_1)
             callback2 = llhelper(CALLBACK, _play_with_setinteriorfield_2)
             #
-            descriptor_init()
-            perform_transaction(callback1, NULL)
-            perform_transaction(callback2, NULL)
-            descriptor_done()
+            stm_descriptor_init()
+            stm_perform_transaction(callback1, NULL)
+            stm_perform_transaction(callback2, NULL)
+            stm_descriptor_done()
             return 0
         t, cbuilder = self.compile(do_stm_setinteriorfield)
         cbuilder.cmdexec('')
diff --git a/pypy/translator/stm/test/test_llstm.py b/pypy/translator/stm/test/test_llstm.py
--- a/pypy/translator/stm/test/test_llstm.py
+++ b/pypy/translator/stm/test/test_llstm.py
@@ -44,7 +44,7 @@
     assert a.x == -611 # xxx still the old value when reading non-transact.
     if a.y < 10:
         a.y += 1    # non-transactionally
-        abort_and_retry()
+        stm_abort_and_retry()
     return lltype.nullptr(rffi.VOIDP.TO)
 
 def test_stm_getfield():
@@ -58,10 +58,10 @@
     a.f = rf1
     a.sa = rs1a
     a.sb = rs1b
-    descriptor_init()
-    perform_transaction(llhelper(CALLBACK, callback1),
+    stm_descriptor_init()
+    stm_perform_transaction(llhelper(CALLBACK, callback1),
                         rffi.cast(rffi.VOIDP, a))
-    descriptor_done()
+    stm_descriptor_done()
     assert a.x == 420
     assert a.c1 == '/'
     assert a.c2 == '\\'
@@ -117,7 +117,7 @@
     assert float(a.sb) == float(rs1b)
     if a.y < 10:
         a.y += 1    # non-transactionally
-        abort_and_retry()
+        stm_abort_and_retry()
     return lltype.nullptr(rffi.VOIDP.TO)
 
 def test_stm_setfield():
@@ -131,10 +131,10 @@
     a.f = rf1
     a.sa = rs1a
     a.sb = rs1b
-    descriptor_init()
-    perform_transaction(llhelper(CALLBACK, callback2),
+    stm_descriptor_init()
+    stm_perform_transaction(llhelper(CALLBACK, callback2),
                         rffi.cast(rffi.VOIDP, a))
-    descriptor_done()
+    stm_descriptor_done()
     assert a.x == 420
     assert a.c1 == '('
     assert a.c2 == '?'
diff --git a/pypy/translator/stm/test/test_rffi_stm.py b/pypy/translator/stm/test/test_rffi_stm.py
--- a/pypy/translator/stm/test/test_rffi_stm.py
+++ b/pypy/translator/stm/test/test_rffi_stm.py
@@ -2,35 +2,35 @@
 from pypy.rpython.annlowlevel import llhelper
 
 def test_descriptor():
-    descriptor_init()
-    descriptor_done()
+    stm_descriptor_init()
+    stm_descriptor_done()
 
-def test_perform_transaction():
+def test_stm_perform_transaction():
     def callback1(x):
         return lltype.nullptr(rffi.VOIDP.TO)
-    descriptor_init()
-    perform_transaction(llhelper(CALLBACK, callback1),
+    stm_descriptor_init()
+    stm_perform_transaction(llhelper(CALLBACK, callback1),
                         lltype.nullptr(rffi.VOIDP.TO))
-    descriptor_done()
+    stm_descriptor_done()
 
-def test_abort_and_retry():
+def test_stm_abort_and_retry():
     A = lltype.Struct('A', ('x', lltype.Signed), ('y', lltype.Signed))
     a = lltype.malloc(A, immortal=True, flavor='raw')
     a.y = 0
     def callback1(x):
         if a.y < 10:
             a.y += 1    # non-transactionally
-            abort_and_retry()
+            stm_abort_and_retry()
         else:
             a.x = 42 * a.y
             return lltype.nullptr(rffi.VOIDP.TO)
-    descriptor_init()
-    perform_transaction(llhelper(CALLBACK, callback1),
+    stm_descriptor_init()
+    stm_perform_transaction(llhelper(CALLBACK, callback1),
                         lltype.nullptr(rffi.VOIDP.TO))
-    descriptor_done()
+    stm_descriptor_done()
     assert a.x == 420
 
-def test_abort_and_retry_transactionally():
+def test_stm_abort_and_retry_transactionally():
     A = lltype.Struct('A', ('x', lltype.Signed), ('y', lltype.Signed))
     a = lltype.malloc(A, immortal=True, flavor='raw')
     a.x = -611
@@ -45,11 +45,11 @@
         assert a.x == -611 # xxx still the old value when reading non-transact.
         if a.y < 10:
             a.y += 1    # non-transactionally
-            abort_and_retry()
+            stm_abort_and_retry()
         else:
             return lltype.nullptr(rffi.VOIDP.TO)
-    descriptor_init()
-    perform_transaction(llhelper(CALLBACK, callback1),
+    stm_descriptor_init()
+    stm_perform_transaction(llhelper(CALLBACK, callback1),
                         lltype.nullptr(rffi.VOIDP.TO))
-    descriptor_done()
+    stm_descriptor_done()
     assert a.x == 420
diff --git a/pypy/translator/stm/test/test_ztranslated.py b/pypy/translator/stm/test/test_ztranslated.py
--- a/pypy/translator/stm/test/test_ztranslated.py
+++ b/pypy/translator/stm/test/test_ztranslated.py
@@ -1,5 +1,5 @@
 import py
-from pypy.translator.stm.test.test_transform import CompiledSTMTests
+from pypy.rlib.test.test_rstm import CompiledSTMTests
 from pypy.translator.stm.test import targetdemo
 
 


More information about the pypy-commit mailing list