Author: Antonio Cuni <[email protected]>
Branch: stm
Changeset: r51345:a81e51b21e06
Date: 2012-01-16 16:06 +0100
http://bitbucket.org/pypy/pypy/changeset/a81e51b21e06/
Log: (arigo, antocuni): fix test_getfield_all_sizes, and make sure we
test both the cases of stm_getfield inside and outside a transaction
diff --git a/pypy/translator/stm/src_stm/et.c b/pypy/translator/stm/src_stm/et.c
--- a/pypy/translator/stm/src_stm/et.c
+++ b/pypy/translator/stm/src_stm/et.c
@@ -676,6 +676,10 @@
void* stm_perform_transaction(void*(*callback)(void*), void *arg)
{
void *result;
+#ifdef RPY_STM_ASSERT
+ /* you need to call descriptor_init() before calling stm_perform_transaction
*/
+ assert(thread_descriptor != NULL);
+#endif
STM_begin_transaction();
result = callback(arg);
stm_commit_transaction();
diff --git a/pypy/translator/stm/test/targetdemo.py
b/pypy/translator/stm/test/targetdemo.py
--- a/pypy/translator/stm/test/targetdemo.py
+++ b/pypy/translator/stm/test/targetdemo.py
@@ -1,6 +1,6 @@
import time
from pypy.module.thread import ll_thread
-from pypy.translator.stm import rstm
+#from pypy.translator.stm import rstm
class Node:
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
@@ -2,8 +2,11 @@
from pypy.rlib.rarithmetic import r_longlong, r_singlefloat
from pypy.translator.stm.test.test_transform import CompiledSTMTests
#from pypy.rlib import rstm
+from pypy.translator.stm._rffi_stm import (CALLBACK, perform_transaction,
+ descriptor_init, descriptor_done)
from pypy.translator.c.test.test_standalone import StandaloneTests
from pypy.rlib.debug import debug_print
+from pypy.rpython.annlowlevel import llhelper
class TestRStm(object):
@@ -78,7 +81,7 @@
return a
a_prebuilt = make_a_1()
-def do_stm_getfield(argv):
+def _play_with_getfield(dummy_arg):
a = a_prebuilt
assert a.x == -611
assert a.c1 == '/'
@@ -89,7 +92,7 @@
assert a.f == rf1
assert float(a.sa) == float(rs1a)
assert float(a.sb) == float(rs1b)
- return 0
+ return lltype.nullptr(rffi.VOIDP.TO)
def do_stm_setfield(argv):
a = a_prebuilt
@@ -241,6 +244,19 @@
class TestFuncGen(CompiledSTMTests):
def test_getfield_all_sizes(self):
+ def do_stm_getfield(argv):
+ _play_with_getfield(None)
+ return 0
+ t, cbuilder = self.compile(do_stm_getfield)
+ cbuilder.cmdexec('')
+
+ def test_getfield_all_sizes_inside_transaction(self):
+ def do_stm_getfield(argv):
+ callback = llhelper(CALLBACK, _play_with_getfield)
+ descriptor_init()
+ perform_transaction(callback, lltype.nullptr(rffi.VOIDP.TO))
+ descriptor_done()
+ return 0
t, cbuilder = self.compile(do_stm_getfield)
cbuilder.cmdexec('')
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit