Author: Remi Meier <[email protected]>
Branch: stmgc-c7-rewindjmp
Changeset: r72892:9c727ae67f53
Date: 2014-08-18 17:48 +0200
http://bitbucket.org/pypy/pypy/changeset/9c727ae67f53/
Log: fix. we now need to turn inevitable before all frees
diff --git a/rpython/translator/stm/inevitable.py
b/rpython/translator/stm/inevitable.py
--- a/rpython/translator/stm/inevitable.py
+++ b/rpython/translator/stm/inevitable.py
@@ -37,7 +37,7 @@
# ____________________________________________________________
-def should_turn_inevitable_getter_setter(op, fresh_mallocs):
+def should_turn_inevitable_getter_setter(op):
# Getters and setters are allowed if their first argument is a GC pointer.
# If it is a RAW pointer, and it is a read from a non-immutable place,
# and it doesn't use the hint 'stm_dont_track_raw_accesses', then they
@@ -52,7 +52,7 @@
return False
if S._hints.get('stm_dont_track_raw_accesses', False):
return False
- return not fresh_mallocs.is_fresh_malloc(op.args[0])
+ return True
def should_turn_inevitable_call(op):
if op.opname == 'direct_call':
@@ -77,7 +77,7 @@
assert False
-def should_turn_inevitable(op, block, fresh_mallocs):
+def should_turn_inevitable(op, block):
# Always-allowed operations never cause a 'turn inevitable'
if op.opname in ALWAYS_ALLOW_OPERATIONS:
return False
@@ -86,22 +86,17 @@
if op.opname in GETTERS:
if op.result.concretetype is lltype.Void:
return False
- return should_turn_inevitable_getter_setter(op, fresh_mallocs)
+ return should_turn_inevitable_getter_setter(op)
if op.opname in SETTERS:
if op.args[-1].concretetype is lltype.Void:
return False
- return should_turn_inevitable_getter_setter(op, fresh_mallocs)
+ return should_turn_inevitable_getter_setter(op)
#
# Mallocs & Frees
if op.opname in MALLOCS:
return False
if op.opname in FREES:
- # We can only run a CFG in non-inevitable mode from start
- # to end in one transaction (every free gets called once
- # for every fresh malloc). No need to turn inevitable.
- # If the transaction is splitted, the remaining parts of the
- # CFG will always run in inevitable mode anyways.
- return not fresh_mallocs.is_fresh_malloc(op.args[0])
+ return True
#
# Function calls
if op.opname == 'direct_call' or op.opname == 'indirect_call':
@@ -117,12 +112,10 @@
varoftype(lltype.Void))
def insert_turn_inevitable(graph):
- from rpython.translator.backendopt.writeanalyze import FreshMallocs
- fresh_mallocs = FreshMallocs(graph)
for block in graph.iterblocks():
for i in range(len(block.operations)-1, -1, -1):
op = block.operations[i]
- inev = should_turn_inevitable(op, block, fresh_mallocs)
+ inev = should_turn_inevitable(op, block)
if inev:
if not isinstance(inev, str):
inev = op.opname
diff --git a/rpython/translator/stm/test/test_inevitable.py
b/rpython/translator/stm/test/test_inevitable.py
--- a/rpython/translator/stm/test/test_inevitable.py
+++ b/rpython/translator/stm/test/test_inevitable.py
@@ -120,7 +120,7 @@
lltype.free(p, flavor='raw')
res = self.interpret_inevitable(f1, [])
- assert res is None
+ assert res == 'free'
def test_raw_malloc_2(self):
X = lltype.Struct('X', ('foo', lltype.Signed))
@@ -130,7 +130,7 @@
llmemory.raw_free(addr)
res = self.interpret_inevitable(f1, [])
- assert res is None
+ assert res == 'raw_free'
def test_unknown_raw_free(self):
X = lltype.Struct('X', ('foo', lltype.Signed))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit