[pypy-commit] pypy inline-dict-ops: fix runner test and llgraph
fijal
noreply at buildbot.pypy.org
Fri Jul 1 15:03:42 CEST 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: inline-dict-ops
Changeset: r45220:5cc2f54862c8
Date: 2011-07-01 15:10 +0200
http://bitbucket.org/pypy/pypy/changeset/5cc2f54862c8/
Log: fix runner test and llgraph
diff --git a/pypy/jit/backend/llgraph/llimpl.py b/pypy/jit/backend/llgraph/llimpl.py
--- a/pypy/jit/backend/llgraph/llimpl.py
+++ b/pypy/jit/backend/llgraph/llimpl.py
@@ -808,26 +808,25 @@
else:
raise NotImplementedError
- def op_getinteriorfield_gc(self, fielddescr, array, index, arraydescr):
- if fielddescr.typeinfo == REF:
- return do_getinteriorfield_gc_ptr(array, index, fielddescr.ofs)
- elif fielddescr.typeinfo == INT:
- return do_getinteriorfield_gc_int(array, index, fielddescr.ofs)
- elif fielddescr.typeinfo == FLOAT:
- return do_getinteriorfield_gc_float(array, index, fielddescr.ofs)
+ def op_getinteriorfield_gc(self, descr, array, index):
+ if descr.typeinfo == REF:
+ return do_getinteriorfield_gc_ptr(array, index, descr.ofs)
+ elif descr.typeinfo == INT:
+ return do_getinteriorfield_gc_int(array, index, descr.ofs)
+ elif descr.typeinfo == FLOAT:
+ return do_getinteriorfield_gc_float(array, index, descr.ofs)
else:
raise NotImplementedError
- def op_setinteriorfield_gc(self, fielddescr, array, index, newvalue,
- arraydescr):
- if fielddescr.typeinfo == REF:
- return do_setinteriorfield_gc_ptr(array, index, fielddescr.ofs,
+ def op_setinteriorfield_gc(self, descr, array, index, newvalue):
+ if descr.typeinfo == REF:
+ return do_setinteriorfield_gc_ptr(array, index, descr.ofs,
newvalue)
- elif fielddescr.typeinfo == INT:
- return do_setinteriorfield_gc_int(array, index, fielddescr.ofs,
+ elif descr.typeinfo == INT:
+ return do_setinteriorfield_gc_int(array, index, descr.ofs,
newvalue)
- elif fielddescr.typeinfo == FLOAT:
- return do_setinteriorfield_gc_float(array, index, fielddescr.ofs,
+ elif descr.typeinfo == FLOAT:
+ return do_setinteriorfield_gc_float(array, index, descr.ofs,
newvalue)
else:
raise NotImplementedError
diff --git a/pypy/jit/backend/llgraph/runner.py b/pypy/jit/backend/llgraph/runner.py
--- a/pypy/jit/backend/llgraph/runner.py
+++ b/pypy/jit/backend/llgraph/runner.py
@@ -314,6 +314,13 @@
token = history.getkind(getattr(S, fieldname))
return self.getdescr(ofs, token[0], name=fieldname)
+ def interiorfielddescrof(self, A, fieldname):
+ S = A.OF
+ ofs2 = symbolic.get_size(A)
+ ofs, size = symbolic.get_field_token(S, fieldname)
+ token = history.getkind(getattr(S, fieldname))
+ return self.getdescr(ofs, token[0], name=fieldname, extrainfo=ofs2)
+
def calldescrof(self, FUNC, ARGS, RESULT, extrainfo=None):
arg_types = []
for ARG in ARGS:
diff --git a/pypy/jit/backend/model.py b/pypy/jit/backend/model.py
--- a/pypy/jit/backend/model.py
+++ b/pypy/jit/backend/model.py
@@ -1,5 +1,5 @@
from pypy.rlib.debug import debug_start, debug_print, debug_stop
-from pypy.jit.metainterp import history, compile
+from pypy.jit.metainterp import history
class AbstractCPU(object):
@@ -212,6 +212,10 @@
def typedescrof(TYPE):
raise NotImplementedError
+ @staticmethod
+ def interiorfielddescrof(A, fieldname):
+ raise NotImplementedError
+
# ---------- the backend-dependent operations ----------
# lltype specific operations
diff --git a/pypy/jit/backend/test/runner_test.py b/pypy/jit/backend/test/runner_test.py
--- a/pypy/jit/backend/test/runner_test.py
+++ b/pypy/jit/backend/test/runner_test.py
@@ -877,30 +877,26 @@
('p', lltype.Ptr(TP)))
a_box, A = self.alloc_array_of(ITEM, 15)
s_box, S = self.alloc_instance(TP)
- adescr = self.cpu.arraydescrof(A)
- kdescr = self.cpu.fielddescrof(ITEM, 'k')
- vdescr = self.cpu.fielddescrof(ITEM, 'v')
- pdescr = self.cpu.fielddescrof(ITEM, 'p')
+ kdescr = self.cpu.interiorfielddescrof(A, 'k')
+ vdescr = self.cpu.interiorfielddescrof(A, 'v')
+ pdescr = self.cpu.interiorfielddescrof(A, 'p')
self.execute_operation(rop.SETINTERIORFIELD_GC, [a_box, BoxInt(3),
- BoxFloat(1.5), adescr],
+ BoxFloat(1.5)],
'void', descr=kdescr)
- r = self.execute_operation(rop.GETINTERIORFIELD_GC, [a_box, BoxInt(3),
- adescr], 'float',
- descr=kdescr)
+ r = self.execute_operation(rop.GETINTERIORFIELD_GC, [a_box, BoxInt(3)],
+ 'float', descr=kdescr)
assert r.getfloat() == 1.5
self.execute_operation(rop.SETINTERIORFIELD_GC, [a_box, BoxInt(3),
- BoxInt(15), adescr],
+ BoxInt(15)],
'void', descr=vdescr)
- r = self.execute_operation(rop.GETINTERIORFIELD_GC, [a_box, BoxInt(3),
- adescr], 'int',
- descr=vdescr)
+ r = self.execute_operation(rop.GETINTERIORFIELD_GC, [a_box, BoxInt(3)],
+ 'int', descr=vdescr)
assert r.getint() == 15
self.execute_operation(rop.SETINTERIORFIELD_GC, [a_box, BoxInt(3),
- s_box, adescr],
+ s_box],
'void', descr=pdescr)
- r = self.execute_operation(rop.GETINTERIORFIELD_GC, [a_box, BoxInt(3),
- adescr], 'ref',
- descr=pdescr)
+ r = self.execute_operation(rop.GETINTERIORFIELD_GC, [a_box, BoxInt(3)],
+ 'ref', descr=pdescr)
assert r.getref_base() == s_box.getref_base()
def test_string_basic(self):
diff --git a/pypy/jit/metainterp/resoperation.py b/pypy/jit/metainterp/resoperation.py
--- a/pypy/jit/metainterp/resoperation.py
+++ b/pypy/jit/metainterp/resoperation.py
@@ -455,7 +455,7 @@
'GETARRAYITEM_GC/2d',
'GETARRAYITEM_RAW/2d',
- 'GETINTERIORFIELD_GC/3d',
+ 'GETINTERIORFIELD_GC/2d',
'GETFIELD_GC/1d',
'GETFIELD_RAW/1d',
'_MALLOC_FIRST',
@@ -472,7 +472,7 @@
'SETARRAYITEM_GC/3d',
'SETARRAYITEM_RAW/3d',
- 'SETINTERIORFIELD_GC/4d',
+ 'SETINTERIORFIELD_GC/3d',
'SETFIELD_GC/2d',
'SETFIELD_RAW/2d',
'STRSETITEM/3',
More information about the pypy-commit
mailing list