Author: Armin Rigo <[email protected]>
Branch: stmgc-c4
Changeset: r65235:302484c08e8c
Date: 2013-07-06 16:00 +0200
http://bitbucket.org/pypy/pypy/changeset/302484c08e8c/
Log: Pass again test_ztranslated:test_abort_info
diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py
--- a/rpython/rlib/rstm.py
+++ b/rpython/rlib/rstm.py
@@ -1,5 +1,5 @@
from rpython.rlib.objectmodel import we_are_translated, specialize
-from rpython.rtyper.lltypesystem import lltype, rffi
+from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, rstr
from rpython.rtyper.lltypesystem.lloperation import llop
from rpython.rtyper.extregistry import ExtRegistryEntry
@@ -28,13 +28,13 @@
def abort_info_pop(count):
if we_are_translated():
- stmgcintf.StmOperations.abort_info_pop(count)
+ llop.stm_abort_info_pop(lltype.Void, count)
def charp_inspect_abort_info():
- return stmgcintf.StmOperations.inspect_abort_info()
+ return llop.stm_inspect_abort_info(rffi.CCHARP)
def abort_and_retry():
- stmgcintf.StmOperations.abort_and_retry()
+ llop.stm_abort_and_retry(lltype.Void)
def before_external_call():
llop.stm_commit_transaction(lltype.Void)
@@ -111,6 +111,7 @@
lst.append(-1) # end of sublist
continue
fieldname = 'inst_' + fieldname
+ extraofs = None
STRUCT = v_instance.concretetype.TO
while not hasattr(STRUCT, fieldname):
STRUCT = STRUCT.super
@@ -121,12 +122,15 @@
kind = 2
elif TYPE == lltype.Ptr(rstr.STR):
kind = 3
+ extraofs = llmemory.offsetof(rstr.STR, 'chars')
else:
raise NotImplementedError(
"abort_info_push(%s, %r): field of type %r"
% (STRUCT.__name__, fieldname, TYPE))
lst.append(kind)
lst.append(llmemory.offsetof(STRUCT, fieldname))
+ if extraofs is not None:
+ lst.append(extraofs)
lst.append(0)
ARRAY = rffi.CArray(lltype.Signed)
array = lltype.malloc(ARRAY, len(lst), flavor='raw', immortal=True)
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
@@ -443,12 +443,17 @@
'stm_perform_transaction':LLOp(canmallocgc=True),
'stm_enter_callback_call':LLOp(),
'stm_leave_callback_call':LLOp(),
+ 'stm_abort_and_retry': LLOp(),
'stm_threadlocalref_get': LLOp(sideeffects=False),
'stm_threadlocalref_set': LLOp(),
'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),
+
# __________ address operations __________
'boehm_malloc': LLOp(),
diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py
--- a/rpython/translator/c/funcgen.py
+++ b/rpython/translator/c/funcgen.py
@@ -606,6 +606,10 @@
OP_STM_PERFORM_TRANSACTION = _OP_STM
OP_STM_ENTER_CALLBACK_CALL = _OP_STM
OP_STM_LEAVE_CALLBACK_CALL = _OP_STM
+ OP_STM_ABORT_AND_RETRY = _OP_STM
+ OP_STM_ABORT_INFO_PUSH = _OP_STM
+ OP_STM_ABORT_INFO_POP = _OP_STM
+ OP_STM_INSPECT_ABORT_INFO = _OP_STM
def OP_PTR_NONZERO(self, op):
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
@@ -159,6 +159,22 @@
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 op_stm(funcgen, op):
func = globals()[op.opname]
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit