Author: Armin Rigo <ar...@tunes.org>
Branch: stmgc-c7
Changeset: r69890:a701941eff30
Date: 2014-03-12 09:45 +0100
http://bitbucket.org/pypy/pypy/changeset/a701941eff30/

Log:    Enough to make the rstm.abort_info* functions not crash, but so far
        they don't record anything.

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
@@ -429,6 +429,7 @@
     'stm_pop_root_into':      LLOp(),
     'stm_commit_if_not_atomic':           LLOp(canmallocgc=True),
     'stm_start_inevitable_if_not_atomic': LLOp(canmallocgc=True),
+    'stm_abort_and_retry':                LLOp(canmallocgc=True),
     'stm_enter_callback_call':            LLOp(canmallocgc=True),
     'stm_leave_callback_call':            LLOp(),
     'stm_perform_transaction':            LLOp(canmallocgc=True),
@@ -445,6 +446,10 @@
     'stm_decrement_atomic':   LLOp(),
     'stm_get_atomic':         LLOp(sideeffects=False),
 
+    'stm_abort_info_push':    LLOp(),
+    'stm_abort_info_pop':     LLOp(),
+    'stm_inspect_abort_info': LLOp(sideeffects=False, canmallocgc=True),
+
 ##    'stm_allocate_nonmovable_int_adr': LLOp(sideeffects=False, 
canmallocgc=True),
 ##    'stm_become_inevitable':  LLOp(canmallocgc=True),
 ##    'stm_stop_all_other_threads': LLOp(canmallocgc=True),
@@ -453,19 +458,8 @@
 ##    'stm_major_collect':      LLOp(canmallocgc=True),
 ##    'stm_get_tid':            LLOp(canfold=True),
 ##    'stm_ptr_eq':             LLOp(canfold=True),
-##    'stm_abort_and_retry':    LLOp(canmallocgc=True),
 
 ##    'stm_weakref_allocate':   LLOp(sideeffects=False, canmallocgc=True),
-    
-##    'stm_threadlocalref_get': LLOp(sideeffects=False),
-##    'stm_threadlocalref_set': LLOp(canmallocgc=True), # may allocate new 
array,
-##                                                      # see threadlocalref.py
-##    'stm_threadlocal_get':    LLOp(sideeffects=False),
-##    'stm_threadlocal_set':    LLOp(),
-
-##    'stm_abort_info_push':    LLOp(),
-##    'stm_abort_info_pop':     LLOp(),
-##    'stm_inspect_abort_info': LLOp(sideeffects=False, canmallocgc=True),
 
 ##    'stm_get_adr_of_private_rev_num':LLOp(),
 ##    'stm_get_adr_of_read_barrier_cache':LLOp(),
diff --git a/rpython/translator/stm/funcgen.py 
b/rpython/translator/stm/funcgen.py
--- a/rpython/translator/stm/funcgen.py
+++ b/rpython/translator/stm/funcgen.py
@@ -181,6 +181,22 @@
     result = funcgen.expr(op.result)
     return '%s = pypy_stm_get_atomic();' % (result,)
 
+def stm_abort_and_retry(funcgen, op):
+    return 'stm_abort_transaction();'
+
+def stm_abort_info_push(funcgen, op):
+    arg0 = funcgen.expr(op.args[0])
+    arg1 = funcgen.expr(op.args[1])
+    return '//XXX stm_abort_info_push((gcptr)%s, %s);' % (arg0, arg1)
+
+def stm_abort_info_pop(funcgen, op):
+    arg0 = funcgen.expr(op.args[0])
+    return '//XXX stm_abort_info_pop(%s);' % (arg0,)
+
+def stm_inspect_abort_info(funcgen, op):
+    result = funcgen.expr(op.result)
+    return '%s = NULL; //XXX stm_inspect_abort_info();' % (result,)
+
 
 ##def stm_initialize(funcgen, op):
 ##    return '''stm_initialize();
@@ -319,22 +335,6 @@
 ##    arg0 = funcgen.expr(op.args[0])
 ##    return 'stm_leave_callback_call(%s);' % (arg0,)
 
-##def stm_abort_and_retry(funcgen, op):
-##    return 'stm_abort_and_retry();'
-
-##def stm_abort_info_push(funcgen, op):
-##    arg0 = funcgen.expr(op.args[0])
-##    arg1 = funcgen.expr(op.args[1])
-##    return 'stm_abort_info_push((gcptr)%s, %s);' % (arg0, arg1)
-
-##def stm_abort_info_pop(funcgen, op):
-##    arg0 = funcgen.expr(op.args[0])
-##    return 'stm_abort_info_pop(%s);' % (arg0,)
-
-##def stm_inspect_abort_info(funcgen, op):
-##    result = funcgen.expr(op.result)
-##    return '%s = stm_inspect_abort_info();' % (result,)
-
 ##def stm_minor_collect(funcgen, op):
 ##    return 'stm_minor_collect();'
 
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
@@ -255,7 +255,10 @@
                 rstm.abort_and_retry()
             #
             last = rstm.charp_inspect_abort_info()
-            print rffi.charp2str(last)
+            if last:
+                print rffi.charp2str(last)
+            else:
+                print 'got abort_info=NULL!'
             print int(bool(rstm.charp_inspect_abort_info()))
             #
             rstm.abort_info_pop(2)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to