[pypy-svn] r32913 - in pypy/dist/pypy/rpython: . lltypesystem memory/gctransform2 memory/gctransform2/test
mwh at codespeak.net
mwh at codespeak.net
Thu Oct 5 15:45:36 CEST 2006
Author: mwh
Date: Thu Oct 5 15:45:34 2006
New Revision: 32913
Modified:
pypy/dist/pypy/rpython/llinterp.py
pypy/dist/pypy/rpython/lltypesystem/lloperation.py
pypy/dist/pypy/rpython/memory/gctransform2/statistics.py
pypy/dist/pypy/rpython/memory/gctransform2/test/test_refcounting.py
pypy/dist/pypy/rpython/memory/gctransform2/test/test_transform.py
pypy/dist/pypy/rpython/memory/gctransform2/transform.py
Log:
when will i learn? remove bare_getfield & co.
add bare_setarrayitem to some places.
Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py (original)
+++ pypy/dist/pypy/rpython/llinterp.py Thu Oct 5 15:45:34 2006
@@ -501,7 +501,6 @@
args = gc.get_arg_write_barrier(obj, fieldname, fieldvalue)
write_barrier = gc.get_funcptr_write_barrier()
result = self.op_direct_call(write_barrier, *args)
-
op_bare_setfield = op_setfield
def op_getarrayitem(self, array, index):
@@ -518,6 +517,7 @@
args = gc.get_arg_write_barrier(array, index, item)
write_barrier = gc.get_funcptr_write_barrier()
self.op_direct_call(write_barrier, *args)
+ op_bare_setarrayitem = op_setarrayitem
def perform_call(self, f, ARGS, args):
@@ -635,7 +635,6 @@
assert not isinstance(getattr(lltype.typeOf(obj).TO, field),
lltype.ContainerType)
return getattr(obj, field)
- op_bare_getfield = op_getfield
def op_cast_int_to_ptr(self, RESTYPE, int1):
return lltype.cast_int_to_ptr(RESTYPE, int1)
Modified: pypy/dist/pypy/rpython/lltypesystem/lloperation.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/lloperation.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/lloperation.py Thu Oct 5 15:45:34 2006
@@ -304,6 +304,7 @@
'setfield': LLOp(),
'bare_setfield': LLOp(),
'setarrayitem': LLOp(),
+ 'bare_setarrayitem': LLOp(),
'cast_pointer': LLOp(canfold=True),
'ptr_eq': LLOp(canfold=True),
'ptr_ne': LLOp(canfold=True),
Modified: pypy/dist/pypy/rpython/memory/gctransform2/statistics.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform2/statistics.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform2/statistics.py Thu Oct 5 15:45:34 2006
@@ -1,7 +1,7 @@
# calculate some statistics about the number of variables that need
# to be cared for across a call
-from pypy.rpython.lltypesystem import lltype, llmemory
+from pypy.rpython.lltypesystem import lltype
relevant_ops = ["direct_call", "indirect_call", "malloc", "malloc_varsize"]
@@ -31,7 +31,6 @@
return result
op = block.operations[index + 1]
result = live_vars_after(index + 1).union(filter_ptr(op.args + [op.result]))
-
return result
for i, op in enumerate(block.operations):
if op.opname not in relevant_ops:
Modified: pypy/dist/pypy/rpython/memory/gctransform2/test/test_refcounting.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform2/test/test_refcounting.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform2/test/test_refcounting.py Thu Oct 5 15:45:34 2006
@@ -136,7 +136,7 @@
check=False)
graph = graphof(t, f)
ops = getops(graph)
- assert len(ops['bare_getfield']) == 2
+ assert len(ops['getfield']) == 2
assert len(ops['bare_setfield']) == 4
def test_arraybarrier():
@@ -154,7 +154,7 @@
check=False)
graph = graphof(t, f)
ops = getops(graph)
- assert len(ops['bare_getarrayitem']) == 2
+ assert len(ops['getarrayitem']) == 2
assert len(ops['bare_setarrayitem']) == 2
assert len(ops['bare_setfield']) == 2
Modified: pypy/dist/pypy/rpython/memory/gctransform2/test/test_transform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform2/test/test_transform.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform2/test/test_transform.py Thu Oct 5 15:45:34 2006
@@ -37,7 +37,7 @@
# implicit_pyobj_pushalives included calls to things that return pyobject*
implicit_pyobj_pushalives = len([op for op in block.operations
if var_ispyobj(op.result)
- and op.opname not in ('bare_getfield', 'bare_getarrayitem', 'same_as')])
+ and op.opname not in ('getfield', 'getarrayitem', 'same_as')])
nonpyobj_gc_returning_calls = len([op for op in block.operations
if op.opname in ('direct_call', 'indirect_call')
and var_needsgc(op.result)
@@ -188,7 +188,7 @@
pyobj_setfields = 0
for b in fgraph.iterblocks():
for op in b.operations:
- if op.opname == 'bare_getfield' and var_ispyobj(op.result):
+ if op.opname == 'getfield' and var_ispyobj(op.result):
pyobj_getfields += 1
elif op.opname == 'bare_setfield' and var_ispyobj(op.args[2]):
pyobj_setfields += 1
@@ -248,3 +248,17 @@
return 0
return 1
t, transformer = rtype_and_transform(f, [], _TestGCTransformer)
+
+def test_bare_setfield():
+ from pypy.rpython.lltypesystem.lloperation import llop
+ class A:
+ def __init__(self, obj): self.x = obj
+ def f(v):
+ inst = A(v)
+ llop.setfield(lltype.Void, inst, 'x', v)
+ llop.bare_setfield(lltype.Void, inst, 'x', v)
+
+ t, transformer = rtype_and_transform(f, [object], _TestGCTransformer,
+ check=False)
+ ops = getops(graphof(t, f))
+ assert len(ops.get('getfield', [])) == 1
Modified: pypy/dist/pypy/rpython/memory/gctransform2/transform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform2/transform.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform2/transform.py Thu Oct 5 15:45:34 2006
@@ -260,7 +260,7 @@
def transform_generic_set(self, hop):
opname = hop.spaceop.opname
v_new = hop.spaceop.args[-1]
- v_old = hop.genop('bare_g' + opname[1:],
+ v_old = hop.genop('g' + opname[1:],
hop.inputargs()[:-1],
resulttype=v_new.concretetype)
self.push_alive(v_new)
@@ -306,9 +306,6 @@
def default(self, hop):
hop.llops.append(hop.spaceop)
- def gct_getfield(self, hop):
- hop.rename('bare_' + hop.spaceop.opname)
-
def gct_setfield(self, hop):
if self.var_needs_set_transform(hop.spaceop.args[-1]):
self.transform_generic_set(hop)
More information about the Pypy-commit
mailing list