[pypy-commit] pypy result-in-resops: for clarity rename _p to _r everywhere.
fijal
noreply at buildbot.pypy.org
Wed Sep 26 00:42:02 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: result-in-resops
Changeset: r57592:7df32b18fd0e
Date: 2012-09-26 00:33 +0200
http://bitbucket.org/pypy/pypy/changeset/7df32b18fd0e/
Log: for clarity rename _p to _r everywhere.
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
@@ -789,7 +789,7 @@
def op_getarrayitem_gc_i(self, arraydescr, array, index):
return do_getarrayitem_gc_int(array, index)
- def op_getarrayitem_gc_p(self, arraydescr, array, index):
+ def op_getarrayitem_gc_r(self, arraydescr, array, index):
return do_getarrayitem_gc_ptr(array, index)
def op_getarrayitem_gc_f(self, arraydescr, array, index):
@@ -797,7 +797,7 @@
op_getarrayitem_gc_pure_i = op_getarrayitem_gc_i
op_getarrayitem_gc_pure_f = op_getarrayitem_gc_f
- op_getarrayitem_gc_pure_p = op_getarrayitem_gc_p
+ op_getarrayitem_gc_pure_r = op_getarrayitem_gc_r
def op_getarrayitem_raw_i(self, arraydescr, array, index):
return do_getarrayitem_raw_int(array, index, arraydescr.ofs)
@@ -814,12 +814,12 @@
def op_getfield_gc_f(self, fielddescr, struct):
return do_getfield_gc_float(struct, fielddescr.ofs)
- def op_getfield_gc_p(self, fielddescr, struct):
+ def op_getfield_gc_r(self, fielddescr, struct):
return do_getfield_gc_ptr(struct, fielddescr.ofs)
op_getfield_gc_pure_i = op_getfield_gc_i
op_getfield_gc_pure_f = op_getfield_gc_f
- op_getfield_gc_pure_p = op_getfield_gc_p
+ op_getfield_gc_pure_r = op_getfield_gc_r
def op_getfield_raw(self, fielddescr, struct):
if fielddescr.typeinfo == REF:
@@ -883,7 +883,7 @@
def op_getinteriorfield_gc_i(self, descr, array, index):
return do_getinteriorfield_gc_int(array, index, descr.ofs)
- def op_getinteriorfield_gc_p(self, descr, array, index):
+ def op_getinteriorfield_gc_r(self, descr, array, index):
return do_getinteriorfield_gc_ptr(array, index, descr.ofs)
def op_getinteriorfield_gc_f(self, descr, array, index):
@@ -1430,7 +1430,7 @@
def do_same_as_i(x):
return x
-do_same_as_p = do_same_as_i
+do_same_as_r = do_same_as_i
do_same_as_f = do_same_as_i
def do_arraylen_gc(arraydescr, array):
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
@@ -646,7 +646,7 @@
res = self.execute_operation(rop.SETFIELD_GC, [t_box, u_box],
'void', descr=fielddescr2)
assert res is None
- res = self.execute_operation(rop.GETFIELD_GC_p, [t_box],
+ res = self.execute_operation(rop.GETFIELD_GC_r, [t_box],
'ref', descr=fielddescr2)
assert res == u_box.value
#
@@ -654,7 +654,7 @@
res = self.execute_operation(rop.SETFIELD_GC, [t_box, null_const],
'void', descr=fielddescr2)
assert res is None
- res = self.execute_operation(rop.GETFIELD_GC_p, [t_box],
+ res = self.execute_operation(rop.GETFIELD_GC_r, [t_box],
'ref', descr=fielddescr2)
assert res == null_const.value
if self.cpu.supports_floats:
@@ -827,7 +827,7 @@
a_box],
'void', descr=arraydescr)
assert r is None
- r = self.execute_operation(rop.GETARRAYITEM_GC_p, [b_box, BoxInt(1)],
+ r = self.execute_operation(rop.GETARRAYITEM_GC_r, [b_box, BoxInt(1)],
'ref', descr=arraydescr)
assert r == a_box.value
#
@@ -969,7 +969,8 @@
assert r == s_box.getref_base()
self.cpu.bh_setinteriorfield_gc_r(a_box.getref_base(), 3, pdescr,
s_box.getref_base())
- r = self.execute_operation(rop.GETINTERIORFIELD_GC_p, [a_box, BoxInt(3)],
+ r = self.execute_operation(rop.GETINTERIORFIELD_GC_r,
+ [a_box, BoxInt(3)],
'ref', descr=pdescr)
assert r == s_box.getref_base()
@@ -1050,9 +1051,9 @@
r = self.execute_operation(rop.SAME_AS_i, [BoxInt(5)], 'int')
assert r == 5
u_box = self.alloc_unicode(u"hello\u1234")
- r = self.execute_operation(rop.SAME_AS_p, [u_box.constbox()], 'ref')
+ r = self.execute_operation(rop.SAME_AS_r, [u_box.constbox()], 'ref')
assert r == u_box.value
- r = self.execute_operation(rop.SAME_AS_p, [u_box], 'ref')
+ r = self.execute_operation(rop.SAME_AS_r, [u_box], 'ref')
assert r == u_box.value
if self.cpu.supports_floats:
diff --git a/pypy/jit/metainterp/blackhole.py b/pypy/jit/metainterp/blackhole.py
--- a/pypy/jit/metainterp/blackhole.py
+++ b/pypy/jit/metainterp/blackhole.py
@@ -1012,28 +1012,28 @@
@arguments("cpu", "r", "d", "d", "i", returns="i")
def bhimpl_getlistitem_gc_i(cpu, lst, itemsdescr, arraydescr, index):
- items = cpu.bh_getfield_gc_p(lst, itemsdescr)
+ items = cpu.bh_getfield_gc_r(lst, itemsdescr)
return cpu.bh_getarrayitem_gc_i(arraydescr, items, index)
@arguments("cpu", "r", "d", "d", "i", returns="r")
def bhimpl_getlistitem_gc_r(cpu, lst, itemsdescr, arraydescr, index):
- items = cpu.bh_getfield_gc_p(lst, itemsdescr)
- return cpu.bh_getarrayitem_gc_p(arraydescr, items, index)
+ items = cpu.bh_getfield_gc_r(lst, itemsdescr)
+ return cpu.bh_getarrayitem_gc_r(arraydescr, items, index)
@arguments("cpu", "r", "d", "d", "i", returns="f")
def bhimpl_getlistitem_gc_f(cpu, lst, itemsdescr, arraydescr, index):
- items = cpu.bh_getfield_gc_p(lst, itemsdescr)
+ items = cpu.bh_getfield_gc_r(lst, itemsdescr)
return cpu.bh_getarrayitem_gc_f(arraydescr, items, index)
@arguments("cpu", "r", "d", "d", "i", "i")
def bhimpl_setlistitem_gc_i(cpu, lst, itemsdescr, arraydescr, index, nval):
- items = cpu.bh_getfield_gc_p(lst, itemsdescr)
+ items = cpu.bh_getfield_gc_r(lst, itemsdescr)
cpu.bh_setarrayitem_gc_i(arraydescr, items, index, nval)
@arguments("cpu", "r", "d", "d", "i", "r")
def bhimpl_setlistitem_gc_r(cpu, lst, itemsdescr, arraydescr, index, nval):
- items = cpu.bh_getfield_gc_p(lst, itemsdescr)
+ items = cpu.bh_getfield_gc_r(lst, itemsdescr)
cpu.bh_setarrayitem_gc_r(arraydescr, items, index, nval)
@arguments("cpu", "r", "d", "d", "i", "f")
def bhimpl_setlistitem_gc_f(cpu, lst, itemsdescr, arraydescr, index, nval):
- items = cpu.bh_getfield_gc_p(lst, itemsdescr)
+ items = cpu.bh_getfield_gc_r(lst, itemsdescr)
cpu.bh_setarrayitem_gc_f(arraydescr, items, index, nval)
# ----------
@@ -1123,14 +1123,14 @@
def bhimpl_getarrayitem_gc_i(cpu, array, index, arraydescr):
return cpu.bh_getarrayitem_gc_i(arraydescr, array, index)
@arguments("cpu", "r", "i", "d", returns="r")
- def bhimpl_getarrayitem_gc_p(cpu, array, index, arraydescr):
- return cpu.bh_getarrayitem_gc_p(arraydescr, array, index)
+ def bhimpl_getarrayitem_gc_r(cpu, array, index, arraydescr):
+ return cpu.bh_getarrayitem_gc_r(arraydescr, array, index)
@arguments("cpu", "r", "i", "d", returns="f")
def bhimpl_getarrayitem_gc_f(cpu, array, index, arraydescr):
return cpu.bh_getarrayitem_gc_f(arraydescr, array, index)
bhimpl_getarrayitem_gc_i_pure = bhimpl_getarrayitem_gc_i
- bhimpl_getarrayitem_gc_p_pure = bhimpl_getarrayitem_gc_p
+ bhimpl_getarrayitem_gc_r_pure = bhimpl_getarrayitem_gc_r
bhimpl_getarrayitem_gc_f_pure = bhimpl_getarrayitem_gc_f
@arguments("cpu", "i", "i", "d", returns="i")
@@ -1168,41 +1168,41 @@
@arguments("cpu", "r", "d", "d", "i", returns="i")
def bhimpl_getarrayitem_vable_i(cpu, vable, fielddescr, arraydescr, index):
- array = cpu.bh_getfield_gc_p(vable, fielddescr)
+ array = cpu.bh_getfield_gc_r(vable, fielddescr)
return cpu.bh_getarrayitem_gc_i(arraydescr, array, index)
@arguments("cpu", "r", "d", "d", "i", returns="r")
def bhimpl_getarrayitem_vable_r(cpu, vable, fielddescr, arraydescr, index):
- array = cpu.bh_getfield_gc_p(vable, fielddescr)
- return cpu.bh_getarrayitem_gc_p(arraydescr, array, index)
+ array = cpu.bh_getfield_gc_r(vable, fielddescr)
+ return cpu.bh_getarrayitem_gc_r(arraydescr, array, index)
@arguments("cpu", "r", "d", "d", "i", returns="f")
def bhimpl_getarrayitem_vable_f(cpu, vable, fielddescr, arraydescr, index):
- array = cpu.bh_getfield_gc_p(vable, fielddescr)
+ array = cpu.bh_getfield_gc_r(vable, fielddescr)
return cpu.bh_getarrayitem_gc_f(arraydescr, array, index)
@arguments("cpu", "r", "d", "d", "i", "i")
def bhimpl_setarrayitem_vable_i(cpu, vable, fdescr, adescr, index, newval):
- array = cpu.bh_getfield_gc_p(vable, fdescr)
+ array = cpu.bh_getfield_gc_r(vable, fdescr)
cpu.bh_setarrayitem_gc_i(adescr, array, index, newval)
@arguments("cpu", "r", "d", "d", "i", "r")
def bhimpl_setarrayitem_vable_r(cpu, vable, fdescr, adescr, index, newval):
- array = cpu.bh_getfield_gc_p(vable, fdescr)
+ array = cpu.bh_getfield_gc_r(vable, fdescr)
cpu.bh_setarrayitem_gc_r(adescr, array, index, newval)
@arguments("cpu", "r", "d", "d", "i", "f")
def bhimpl_setarrayitem_vable_f(cpu, vable, fdescr, adescr, index, newval):
- array = cpu.bh_getfield_gc_p(vable, fdescr)
+ array = cpu.bh_getfield_gc_r(vable, fdescr)
cpu.bh_setarrayitem_gc_f(adescr, array, index, newval)
@arguments("cpu", "r", "d", "d", returns="i")
def bhimpl_arraylen_vable(cpu, vable, fdescr, adescr):
- array = cpu.bh_getfield_gc_p(vable, fdescr)
+ array = cpu.bh_getfield_gc_r(vable, fdescr)
return cpu.bh_arraylen_gc(adescr, array)
@arguments("cpu", "r", "i", "d", returns="i")
def bhimpl_getinteriorfield_gc_i(cpu, array, index, descr):
return cpu.bh_getinteriorfield_gc_i(array, index, descr)
@arguments("cpu", "r", "i", "d", returns="r")
- def bhimpl_getinteriorfield_gc_p(cpu, array, index, descr):
- return cpu.bh_getinteriorfield_gc_p(array, index, descr)
+ def bhimpl_getinteriorfield_gc_r(cpu, array, index, descr):
+ return cpu.bh_getinteriorfield_gc_r(array, index, descr)
@arguments("cpu", "r", "i", "d", returns="f")
def bhimpl_getinteriorfield_gc_f(cpu, array, index, descr):
return cpu.bh_getinteriorfield_gc_f(array, index, descr)
@@ -1221,22 +1221,22 @@
def bhimpl_getfield_gc_i(cpu, struct, fielddescr):
return cpu.bh_getfield_gc_i(struct, fielddescr)
@arguments("cpu", "r", "d", returns="r")
- def bhimpl_getfield_gc_p(cpu, struct, fielddescr):
- return cpu.bh_getfield_gc_p(struct, fielddescr)
+ def bhimpl_getfield_gc_r(cpu, struct, fielddescr):
+ return cpu.bh_getfield_gc_r(struct, fielddescr)
@arguments("cpu", "r", "d", returns="f")
def bhimpl_getfield_gc_f(cpu, struct, fielddescr):
return cpu.bh_getfield_gc_f(struct, fielddescr)
bhimpl_getfield_gc_i_pure = bhimpl_getfield_gc_i
- bhimpl_getfield_gc_p_pure = bhimpl_getfield_gc_p
+ bhimpl_getfield_gc_r_pure = bhimpl_getfield_gc_r
bhimpl_getfield_gc_f_pure = bhimpl_getfield_gc_f
bhimpl_getfield_vable_i = bhimpl_getfield_gc_i
- bhimpl_getfield_vable_p = bhimpl_getfield_gc_p
+ bhimpl_getfield_vable_r = bhimpl_getfield_gc_r
bhimpl_getfield_vable_f = bhimpl_getfield_gc_f
bhimpl_getfield_gc_i_greenfield = bhimpl_getfield_gc_i
- bhimpl_getfield_gc_p_greenfield = bhimpl_getfield_gc_p
+ bhimpl_getfield_gc_r_greenfield = bhimpl_getfield_gc_r
bhimpl_getfield_gc_f_greenfield = bhimpl_getfield_gc_f
@arguments("cpu", "i", "d", returns="i")
diff --git a/pypy/jit/metainterp/executor.py b/pypy/jit/metainterp/executor.py
--- a/pypy/jit/metainterp/executor.py
+++ b/pypy/jit/metainterp/executor.py
@@ -79,19 +79,19 @@
do_call_i = new_do_call(rop.CALL_i, 'i')
do_call_f = new_do_call(rop.CALL_f, 'f')
-do_call_p = new_do_call(rop.CALL_p, 'p')
+do_call_r = new_do_call(rop.CALL_r, 'r')
do_call_n = new_do_call(rop.CALL_N, 'N')
do_call_loopinvariant_i = new_do_call(rop.CALL_LOOPINVARIANT_i, 'i')
do_call_loopinvariant_f = new_do_call(rop.CALL_LOOPINVARIANT_f, 'f')
-do_call_loopinvariant_p = new_do_call(rop.CALL_LOOPINVARIANT_p, 'p')
+do_call_loopinvariant_r = new_do_call(rop.CALL_LOOPINVARIANT_r, 'r')
do_call_loopinvariant_n = new_do_call(rop.CALL_LOOPINVARIANT_N, 'N')
do_call_may_force_i = new_do_call(rop.CALL_MAY_FORCE_i, 'i')
do_call_may_force_f = new_do_call(rop.CALL_MAY_FORCE_f, 'f')
-do_call_may_force_p = new_do_call(rop.CALL_MAY_FORCE_p, 'p')
+do_call_may_force_r = new_do_call(rop.CALL_MAY_FORCE_r, 'r')
do_call_may_force_n = new_do_call(rop.CALL_MAY_FORCE_N, 'N')
do_call_pure_i = new_do_call(rop.CALL_PURE_i, 'i')
do_call_pure_f = new_do_call(rop.CALL_PURE_f, 'f')
-do_call_pure_p = new_do_call(rop.CALL_PURE_p, 'p')
+do_call_pure_r = new_do_call(rop.CALL_PURE_r, 'r')
do_call_pure_n = new_do_call(rop.CALL_PURE_N, 'N')
def do_setarrayitem_gc(cpu, _, arraybox, indexbox, itembox, arraydescr):
@@ -157,7 +157,7 @@
else:
cpu.bh_raw_store_i(addr, offset, arraydescr, valuebox.getint())
-def do_raw_load_p(cpu, _, addrbox, offsetbox, arraydescr):
+def do_raw_load_r(cpu, _, addrbox, offsetbox, arraydescr):
raise AssertionError("cannot store GC pointers in raw store")
def do_raw_load_i(cpu, _, addrbox, offsetbox, arraydescr):
@@ -220,9 +220,9 @@
return create_resop_2(rop.INT_MUL_OVF, z, box1, box2)
def do_same_as_i(cpu, _, box):
- return box.clonebox()
+ return box.nonconstbox()
do_same_as_f = do_same_as_i
-do_same_as_p = do_same_as_i
+do_same_as_r = do_same_as_i
def do_copystrcontent(cpu, _, srcbox, dstbox,
srcstartbox, dststartbox, lengthbox):
@@ -326,7 +326,7 @@
continue
if value in (rop.FORCE_TOKEN,
rop.CALL_ASSEMBLER_i,
- rop.CALL_ASSEMBLER_p,
+ rop.CALL_ASSEMBLER_r,
rop.CALL_ASSEMBLER_f,
rop.CALL_ASSEMBLER_N,
rop.COND_CALL_GC_WB,
@@ -335,12 +335,12 @@
rop.JIT_DEBUG,
rop.SETARRAYITEM_RAW,
rop.GETINTERIORFIELD_RAW_i,
- rop.GETINTERIORFIELD_RAW_p,
+ rop.GETINTERIORFIELD_RAW_r,
rop.GETINTERIORFIELD_RAW_f,
rop.GETINTERIORFIELD_RAW_N,
rop.SETINTERIORFIELD_RAW,
rop.CALL_RELEASE_GIL_i,
- rop.CALL_RELEASE_GIL_p,
+ rop.CALL_RELEASE_GIL_r,
rop.CALL_RELEASE_GIL_f,
rop.CALL_RELEASE_GIL_N,
rop.QUASIIMMUT_FIELD,
@@ -348,19 +348,19 @@
rop.CALL_MALLOC_NURSERY,
rop.LABEL,
rop.GETARRAYITEM_RAW_PURE_N,
- rop.GETFIELD_RAW_p,
- rop.GETARRAYITEM_RAW_PURE_p,
+ rop.GETFIELD_RAW_r,
+ rop.GETARRAYITEM_RAW_PURE_r,
rop.SAME_AS_N,
rop.GETINTERIORFIELD_GC_N,
rop.GETFIELD_RAW_N,
rop.GETFIELD_RAW_PURE_N,
- rop.GETFIELD_RAW_PURE_p,
+ rop.GETFIELD_RAW_PURE_r,
rop.GETARRAYITEM_RAW_N,
rop.GETFIELD_GC_PURE_N,
rop.GETARRAYITEM_GC_PURE_N,
rop.GETARRAYITEM_GC_N,
rop.GETFIELD_GC_N,
- rop.GETARRAYITEM_RAW_p,
+ rop.GETARRAYITEM_RAW_r,
rop.RAW_LOAD_N,
): # list of opcodes never executed by pyjitpl
continue
diff --git a/pypy/jit/metainterp/optimizeopt/earlyforce.py b/pypy/jit/metainterp/optimizeopt/earlyforce.py
--- a/pypy/jit/metainterp/optimizeopt/earlyforce.py
+++ b/pypy/jit/metainterp/optimizeopt/earlyforce.py
@@ -15,7 +15,7 @@
opnum != rop.SETARRAYITEM_GC and
opnum != rop.QUASIIMMUT_FIELD and
opnum != rop.SAME_AS_i and
- opnum != rop.SAME_AS_p and
+ opnum != rop.SAME_AS_r and
opnum != rop.SAME_AS_f and
opnum != rop.MARK_OPAQUE_PTR):
diff --git a/pypy/jit/metainterp/optimizeopt/heap.py b/pypy/jit/metainterp/optimizeopt/heap.py
--- a/pypy/jit/metainterp/optimizeopt/heap.py
+++ b/pypy/jit/metainterp/optimizeopt/heap.py
@@ -379,7 +379,7 @@
# then remember the result of reading the field
fieldvalue = self.getvalue(op)
cf.remember_field_value(structvalue, fieldvalue, op)
- optimize_GETFIELD_GC_p = optimize_GETFIELD_GC_i
+ optimize_GETFIELD_GC_r = optimize_GETFIELD_GC_i
optimize_GETFIELD_GC_f = optimize_GETFIELD_GC_i
def optimize_GETFIELD_GC_PURE_i(self, op):
@@ -393,7 +393,7 @@
structvalue.ensure_nonnull()
self.emit_operation(op)
optimize_GETFIELD_GC_PURE_f = optimize_GETFIELD_GC_PURE_i
- optimize_GETFIELD_GC_PURE_p = optimize_GETFIELD_GC_PURE_i
+ optimize_GETFIELD_GC_PURE_r = optimize_GETFIELD_GC_PURE_i
def optimize_SETFIELD_GC(self, op):
if op.type == INT:
@@ -403,7 +403,7 @@
op_key = create_resop_1(rop.GETFIELD_GC_PURE_f, 0.0, op.getarg(0),
op.getdescr())
else:
- op_key = create_resop_1(rop.GETFIELD_GC_PURE_p,
+ op_key = create_resop_1(rop.GETFIELD_GC_PURE_r,
lltype.nullptr(llmemory.GCREF.TO),
op.getarg(0),
op.getdescr())
@@ -439,7 +439,7 @@
if cf is not None:
fieldvalue = self.getvalue(op)
cf.remember_field_value(arrayvalue, fieldvalue, op)
- optimize_GETARRAYITEM_GC_p = optimize_GETARRAYITEM_GC_i
+ optimize_GETARRAYITEM_GC_r = optimize_GETARRAYITEM_GC_i
optimize_GETARRAYITEM_GC_f = optimize_GETARRAYITEM_GC_i
def optimize_GETARRAYITEM_GC_PURE_i(self, op):
@@ -461,7 +461,7 @@
# default case: produce the operation
arrayvalue.ensure_nonnull()
self.emit_operation(op)
- optimize_GETARRAYITEM_GC_PURE_p = optimize_GETARRAYITEM_GC_PURE_i
+ optimize_GETARRAYITEM_GC_PURE_r = optimize_GETARRAYITEM_GC_PURE_i
optimize_GETARRAYITEM_GC_PURE_f = optimize_GETARRAYITEM_GC_PURE_i
def optimize_SETARRAYITEM_GC(self, op):
@@ -474,7 +474,7 @@
op.getarg(0), op.getarg(1),
op.getdescr())
else:
- op_key = create_resop_2(rop.GETARRAYITEM_GC_PURE_p,
+ op_key = create_resop_2(rop.GETARRAYITEM_GC_PURE_r,
lltype.nullptr(llmemory.GCREF.TO),
op.getarg(0),
op.getarg(1),
diff --git a/pypy/jit/metainterp/optimizeopt/optimizer.py b/pypy/jit/metainterp/optimizeopt/optimizer.py
--- a/pypy/jit/metainterp/optimizeopt/optimizer.py
+++ b/pypy/jit/metainterp/optimizeopt/optimizer.py
@@ -688,7 +688,7 @@
def optimize_SAME_AS_i(self, op):
self.make_equal_to(op.result, self.getvalue(op.getarg(0)))
optimize_SAME_AS_f = optimize_SAME_AS_i
- optimize_SAME_AS_p = optimize_SAME_AS_i
+ optimize_SAME_AS_r = optimize_SAME_AS_i
def optimize_MARK_OPAQUE_PTR(self, op):
value = self.getvalue(op.getarg(0))
diff --git a/pypy/jit/metainterp/optimizeopt/pure.py b/pypy/jit/metainterp/optimizeopt/pure.py
--- a/pypy/jit/metainterp/optimizeopt/pure.py
+++ b/pypy/jit/metainterp/optimizeopt/pure.py
@@ -74,7 +74,7 @@
return optimize_CALL_PURE
optimize_CALL_PURE_i = _new_optimize_call_pure(rop.CALL_i)
optimize_CALL_PURE_f = _new_optimize_call_pure(rop.CALL_f)
- optimize_CALL_PURE_p = _new_optimize_call_pure(rop.CALL_p)
+ optimize_CALL_PURE_r = _new_optimize_call_pure(rop.CALL_r)
optimize_CALL_PURE_N = _new_optimize_call_pure(rop.CALL_N)
def optimize_GUARD_NO_EXCEPTION(self, op):
@@ -118,7 +118,7 @@
def produce_potential_short_preamble_ops(self, sb):
for op in self.emitted_pure_operations:
if op.getopnum() == rop.GETARRAYITEM_GC_PURE_i or \
- op.getopnum() == rop.GETARRAYITEM_GC_PURE_p or \
+ op.getopnum() == rop.GETARRAYITEM_GC_PURE_r or \
op.getopnum() == rop.GETARRAYITEM_GC_PURE_f or \
op.getopnum() == rop.STRGETITEM or \
op.getopnum() == rop.UNICODEGETITEM:
diff --git a/pypy/jit/metainterp/optimizeopt/rewrite.py b/pypy/jit/metainterp/optimizeopt/rewrite.py
--- a/pypy/jit/metainterp/optimizeopt/rewrite.py
+++ b/pypy/jit/metainterp/optimizeopt/rewrite.py
@@ -343,7 +343,7 @@
self.loop_invariant_results[key] = op
return optimize_CALL_LOOPINVARIANT
optimize_CALL_LOOPINVARIANT_i = _new_optimize_call_loopinvariant(rop.CALL_i)
- optimize_CALL_LOOPINVARIANT_p = _new_optimize_call_loopinvariant(rop.CALL_p)
+ optimize_CALL_LOOPINVARIANT_r = _new_optimize_call_loopinvariant(rop.CALL_r)
optimize_CALL_LOOPINVARIANT_f = _new_optimize_call_loopinvariant(rop.CALL_f)
optimize_CALL_LOOPINVARIANT_N = _new_optimize_call_loopinvariant(rop.CALL_N)
@@ -517,7 +517,7 @@
def optimize_SAME_AS_i(self, op):
self.replace(op, op.getarg(0))
- optimize_SAME_AS_p = optimize_SAME_AS_i
+ optimize_SAME_AS_r = optimize_SAME_AS_i
optimize_SAME_AS_f = optimize_SAME_AS_i
dispatch_opt = make_dispatcher_method(OptRewrite, 'optimize_',
diff --git a/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py
--- a/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -254,7 +254,7 @@
def test_remove_guard_class_constant(self):
ops = """
[i0]
- p0 = same_as_p(ConstPtr(myptr))
+ p0 = same_as_r(ConstPtr(myptr))
guard_class(p0, ConstClass(node_vtable)) []
jump(i0)
"""
@@ -463,7 +463,7 @@
pv = new_with_vtable(ConstClass(node_vtable))
setfield_gc(pv, p0, descr=valuedescr)
guard_nonnull(p0) []
- p1 = getfield_gc_p(pv, descr=valuedescr)
+ p1 = getfield_gc_r(pv, descr=valuedescr)
guard_nonnull(p1) []
jump(p0)
"""
@@ -641,7 +641,7 @@
def test_p123_anti_nested(self):
ops = """
[i1, p2, p3]
- p3sub = getfield_gc_p(p3, descr=nextdescr)
+ p3sub = getfield_gc_r(p3, descr=nextdescr)
i3 = getfield_gc_i(p3sub, descr=valuedescr)
escape(i3)
p1 = new_with_vtable(ConstClass(node_vtable))
@@ -934,7 +934,7 @@
[i0]
p0 = new_with_vtable(ConstClass(node_vtable))
setfield_gc(p0, NULL, descr=nextdescr)
- p2 = getfield_gc_p(p0, descr=nextdescr)
+ p2 = getfield_gc_r(p0, descr=nextdescr)
i1 = ptr_eq(p2, NULL)
jump(i1)
"""
@@ -949,7 +949,7 @@
[i0]
p0 = new_with_vtable(ConstClass(node_vtable))
setfield_gc(p0, ConstPtr(myptr), descr=nextdescr)
- p2 = getfield_gc_p(p0, descr=nextdescr)
+ p2 = getfield_gc_r(p0, descr=nextdescr)
i1 = ptr_eq(p2, NULL)
jump(i1)
"""
@@ -1562,7 +1562,7 @@
setfield_gc(p1, i1, descr=valuedescr)
setfield_gc(p0, p1, descr=nextdescr)
setfield_raw(i1, i1, descr=valuedescr) # random op with side-effects
- p2 = getfield_gc_p(p0, descr=nextdescr)
+ p2 = getfield_gc_r(p0, descr=nextdescr)
i2 = getfield_gc_i(p2, descr=valuedescr)
setfield_gc(p0, NULL, descr=nextdescr)
escape(i2)
@@ -1684,10 +1684,10 @@
def test_duplicate_getarrayitem_1(self):
ops = """
[p1]
- p2 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
- p3 = getarrayitem_gc_p(p1, 1, descr=arraydescr2)
- p4 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
- p5 = getarrayitem_gc_p(p1, 1, descr=arraydescr2)
+ p2 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
+ p3 = getarrayitem_gc_r(p1, 1, descr=arraydescr2)
+ p4 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
+ p5 = getarrayitem_gc_r(p1, 1, descr=arraydescr2)
escape(p2)
escape(p3)
escape(p4)
@@ -1696,8 +1696,8 @@
"""
expected = """
[p1]
- p2 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
- p3 = getarrayitem_gc_p(p1, 1, descr=arraydescr2)
+ p2 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
+ p3 = getarrayitem_gc_r(p1, 1, descr=arraydescr2)
escape(p2)
escape(p3)
escape(p2)
@@ -1710,7 +1710,7 @@
ops = """
[p1, p2]
setarrayitem_gc(p1, 0, p2, descr=arraydescr2)
- p3 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
+ p3 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
escape(p3)
jump(p1, p3)
"""
@@ -1728,8 +1728,8 @@
[p1, p2, p3, i1]
setarrayitem_gc(p1, 0, p2, descr=arraydescr2)
setarrayitem_gc(p1, i1, p3, descr=arraydescr2)
- p4 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
- p5 = getarrayitem_gc_p(p1, i1, descr=arraydescr2)
+ p4 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
+ p5 = getarrayitem_gc_r(p1, i1, descr=arraydescr2)
escape(p4)
escape(p5)
jump(p1, p2, p3, i1)
@@ -1738,7 +1738,7 @@
[p1, p2, p3, i1]
setarrayitem_gc(p1, 0, p2, descr=arraydescr2)
setarrayitem_gc(p1, i1, p3, descr=arraydescr2)
- p4 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
+ p4 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
escape(p4)
escape(p3)
jump(p1, p2, p3, i1)
@@ -1751,9 +1751,9 @@
setarrayitem_gc(p1, i1, p2, descr=arraydescr2)
setarrayitem_gc(p1, 0, p3, descr=arraydescr2)
setarrayitem_gc(p1, 1, p4, descr=arraydescr2)
- p5 = getarrayitem_gc_p(p1, i1, descr=arraydescr2)
- p6 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
- p7 = getarrayitem_gc_p(p1, 1, descr=arraydescr2)
+ p5 = getarrayitem_gc_r(p1, i1, descr=arraydescr2)
+ p6 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
+ p7 = getarrayitem_gc_r(p1, 1, descr=arraydescr2)
escape(p5)
escape(p6)
escape(p7)
@@ -1764,7 +1764,7 @@
setarrayitem_gc(p1, i1, p2, descr=arraydescr2)
setarrayitem_gc(p1, 0, p3, descr=arraydescr2)
setarrayitem_gc(p1, 1, p4, descr=arraydescr2)
- p5 = getarrayitem_gc_p(p1, i1, descr=arraydescr2)
+ p5 = getarrayitem_gc_r(p1, i1, descr=arraydescr2)
escape(p5)
escape(p3)
escape(p4)
@@ -1776,9 +1776,9 @@
ops = """
[p0, p1, p2]
guard_value(p0, ConstPtr(myptr)) []
- p3 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
+ p3 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
i4 = getfield_gc_pure_i(p0, descr=valuedescr)
- p5 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
+ p5 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
escape(p3)
escape(i4)
escape(p5)
@@ -1787,7 +1787,7 @@
expected = """
[p0, p1, p2]
guard_value(p0, ConstPtr(myptr)) []
- p3 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
+ p3 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
escape(p3)
escape(5)
escape(p3)
@@ -1800,8 +1800,8 @@
[p1, p2, p3, p4, i1]
setarrayitem_gc(p1, 0, p3, descr=arraydescr2)
setarrayitem_gc(p2, 1, p4, descr=arraydescr2)
- p5 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
- p6 = getarrayitem_gc_p(p2, 1, descr=arraydescr2)
+ p5 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
+ p6 = getarrayitem_gc_r(p2, 1, descr=arraydescr2)
escape(p5)
escape(p6)
jump(p1, p2, p3, p4, i1)
@@ -1885,7 +1885,7 @@
def test_bug_2(self):
ops = """
[i0, p1]
- p4 = getarrayitem_gc_p(p1, 0, descr=arraydescr2)
+ p4 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
guard_nonnull(p4) []
escape(p4)
#
@@ -2101,8 +2101,8 @@
def test_oois_of_itself(self):
ops = """
[p0]
- p1 = getfield_gc_p(p0, descr=nextdescr)
- p2 = getfield_gc_p(p0, descr=nextdescr)
+ p1 = getfield_gc_r(p0, descr=nextdescr)
+ p2 = getfield_gc_r(p0, descr=nextdescr)
i1 = ptr_eq(p1, p2)
guard_true(i1) []
i2 = ptr_ne(p1, p2)
@@ -2111,7 +2111,7 @@
"""
expected = """
[p0]
- p1 = getfield_gc_p(p0, descr=nextdescr)
+ p1 = getfield_gc_r(p0, descr=nextdescr)
jump(p0)
"""
self.optimize_loop(ops, expected)
@@ -2403,7 +2403,7 @@
if strict:
assert box.eq(oparse.getvar(varname))
else:
- assert box.value == oparse.getvar(varname).value
+ assert box.eq_value(oparse.getvar(varname))
else:
tag, resolved, fieldstext = virtuals[varname]
if tag[0] == 'virtual':
@@ -2415,7 +2415,7 @@
else:
assert 0
if resolved is not None:
- assert resolved.value == box.value
+ assert resolved.getref_base() == box.getref_base()
else:
virtuals[varname] = tag, box, fieldstext
#
@@ -2429,8 +2429,10 @@
for pvar, pfieldname, pfieldvar in pendingfields:
box = oparse.getvar(pvar)
fielddescr = self.namespace[pfieldname.strip()]
+ # guess the correct type
+ opnum = getattr(rop, 'GETFIELD_GC_' + fielddescr.typeinfo)
fieldbox = executor.execute(self.cpu, None,
- rop.GETFIELD_GC,
+ opnum,
fielddescr,
box)
_variables_equal(fieldbox, pfieldvar, strict=True)
@@ -2447,8 +2449,9 @@
if tag[0] in ('virtual', 'vstruct'):
fieldname, fieldvalue = fieldtext.split('=')
fielddescr = self.namespace[fieldname.strip()]
+ opnum = getattr(rop, 'GETFIELD_GC_' + fielddescr.typeinfo)
fieldbox = executor.execute(self.cpu, None,
- rop.GETFIELD_GC,
+ opnum,
fielddescr,
resolved)
elif tag[0] == 'varray':
@@ -2465,7 +2468,8 @@
def check_expanded_fail_descr(self, expectedtext, guard_opnum):
from pypy.jit.metainterp.test.test_resume import ResumeDataFakeReader
from pypy.jit.metainterp.test.test_resume import MyMetaInterp
- guard_op, = [op for op in self.loop.operations if op.is_guard()]
+ guard_op, = [op for op in self.loop.operations if op.is_guard()
+ and op.getopnum() == guard_opnum]
fail_args = guard_op.get_extra("failargs")
fdescr = guard_op.getdescr()
assert fdescr.guard_opnum == guard_opnum
@@ -2476,20 +2480,22 @@
def test_expand_fail_1(self):
ops = """
- [i1, i3]
+ [i1, i3, i5]
# first rename i3 into i4
p1 = new_with_vtable(ConstClass(node_vtable))
setfield_gc(p1, i3, descr=valuedescr)
- i4 = getfield_gc(p1, descr=valuedescr)
+ i4 = getfield_gc_i(p1, descr=valuedescr)
#
- i2 = int_add(10, 5)
+ guard_value(i5, 5) [i4]
+ i2 = int_add(10, i5)
guard_true(i1) [i2, i4]
- jump(i1, i4)
- """
- expected = """
- [i1, i3]
+ jump(i1, i4, i5)
+ """
+ expected = """
+ [i1, i3, i5]
+ guard_value(i5, 5) [i3]
guard_true(i1) [i3]
- jump(1, i3)
+ jump(1, i3, 5)
"""
self.optimize_loop(ops, expected)
self.check_expanded_fail_descr('15, i3', rop.GUARD_TRUE)
@@ -2539,12 +2545,12 @@
def test_expand_fail_4(self):
for arg in ['p1', 'i2,p1', 'p1,p2', 'p2,p1',
'i2,p1,p2', 'i2,p2,p1']:
- self.setup_method() # humpf
+ self.setup_method(self.test_expand_fail_4) # humpf
ops = """
[i1, i2, i3]
p1 = new_with_vtable(ConstClass(node_vtable))
setfield_gc(p1, i3, descr=valuedescr)
- i4 = getfield_gc(p1, descr=valuedescr) # copy of i3
+ i4 = getfield_gc_i(p1, descr=valuedescr) # copy of i3
p2 = new_with_vtable(ConstClass(node_vtable))
setfield_gc(p1, i2, descr=valuedescr)
setfield_gc(p1, p2, descr=nextdescr)
@@ -2633,8 +2639,8 @@
setfield_gc(p2, i1, descr=adescr)
setfield_gc(p2, p1, descr=bdescr)
guard_true(i1) [p2]
- i3 = getfield_gc(p2, descr=adescr)
- p3 = getfield_gc(p2, descr=bdescr)
+ i3 = getfield_gc_i(p2, descr=adescr)
+ p3 = getfield_gc_r(p2, descr=bdescr)
jump(i3, p3)
"""
expected = """
diff --git a/pypy/jit/metainterp/optimizeopt/virtualize.py b/pypy/jit/metainterp/optimizeopt/virtualize.py
--- a/pypy/jit/metainterp/optimizeopt/virtualize.py
+++ b/pypy/jit/metainterp/optimizeopt/virtualize.py
@@ -446,13 +446,13 @@
else:
value.ensure_nonnull()
self.emit_operation(op)
- optimize_GETFIELD_GC_p = optimize_GETFIELD_GC_i
+ optimize_GETFIELD_GC_r = optimize_GETFIELD_GC_i
optimize_GETFIELD_GC_f = optimize_GETFIELD_GC_i
# note: the following line does not mean that the two operations are
# completely equivalent, because GETFIELD_GC_PURE is_always_pure().
optimize_GETFIELD_GC_PURE_i = optimize_GETFIELD_GC_i
- optimize_GETFIELD_GC_PURE_p = optimize_GETFIELD_GC_i
+ optimize_GETFIELD_GC_PURE_r = optimize_GETFIELD_GC_i
optimize_GETFIELD_GC_PURE_f = optimize_GETFIELD_GC_i
def optimize_SETFIELD_GC(self, op):
@@ -506,14 +506,14 @@
return
value.ensure_nonnull()
self.emit_operation(op)
- optimize_GETARRAYITEM_GC_p = optimize_GETARRAYITEM_GC_i
+ optimize_GETARRAYITEM_GC_r = optimize_GETARRAYITEM_GC_i
optimize_GETARRAYITEM_GC_f = optimize_GETARRAYITEM_GC_i
# note: the following line does not mean that the two operations are
# completely equivalent, because GETARRAYITEM_GC_PURE is_always_pure().
optimize_GETARRAYITEM_GC_PURE_i = optimize_GETARRAYITEM_GC_i
optimize_GETARRAYITEM_GC_PURE_f = optimize_GETARRAYITEM_GC_i
- optimize_GETARRAYITEM_GC_PURE_p = optimize_GETARRAYITEM_GC_i
+ optimize_GETARRAYITEM_GC_PURE_r = optimize_GETARRAYITEM_GC_i
def optimize_SETARRAYITEM_GC(self, op):
value = self.getvalue(op.getarg(0))
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
@@ -95,7 +95,7 @@
cls = opclasses[opnum]
assert cls.NUMARGS == 1
if (cls.is_always_pure() and
- opnum not in (rop.SAME_AS_i, rop.SAME_AS_f, rop.SAME_AS_p)):
+ opnum not in (rop.SAME_AS_i, rop.SAME_AS_f, rop.SAME_AS_r)):
if arg0.is_constant():
return cls.wrap_constant(result)
if result is None:
@@ -386,6 +386,9 @@
def repr_rpython(self):
return repr_rpython(self, 'bi')
+ def eq_value(self, other):
+ return self.value == other.getint()
+
class BoxFloat(Box):
type = FLOAT
_attrs_ = ('value',)
@@ -415,6 +418,9 @@
def repr_rpython(self):
return repr_rpython(self, 'bf')
+ def eq_value(self, other):
+ return self.value == other.getfloatstorage()
+
class BoxPtr(Box):
type = REF
_attrs_ = ('value',)
@@ -451,6 +457,9 @@
def repr_rpython(self):
return repr_rpython(self, 'bp')
+ def eq_value(self, other):
+ return self.value == other.getref_base()
+
_getrepr_ = repr_pointer
NULLBOX = BoxPtr()
@@ -730,7 +739,7 @@
if descr is not None:
if other.getdescr() is not descr:
return False
- if not self.result_eq(other):
+ if not self.eq_value(other):
return False
if not self.args_eq(other):
return False
@@ -882,7 +891,7 @@
def get_result_hash(self):
return 0
- def result_eq(self, other):
+ def eq_value(self, other):
return True
class ResOpInt(object):
@@ -910,9 +919,8 @@
def get_result_hash(self):
return make_hashable_int(self.intval)
- def result_eq(self, other):
- assert isinstance(other, self.__class__)
- return self.intval == other.intval
+ def eq_value(self, other):
+ return self.intval == other.getint()
class ResOpFloat(object):
_mixin_ = True
@@ -940,9 +948,8 @@
def get_result_hash(self):
return longlong.gethash(self.floatval)
- def result_eq(self, other):
- assert isinstance(other, self.__class__)
- return self.floatval == other.floatval
+ def eq_value(self, other):
+ return self.floatval == other.getfloatstorage()
class ResOpPointer(object):
_mixin_ = True
@@ -956,6 +963,9 @@
return self.pval
getresult = getref_base
+ def getref(self, TYPE):
+ return lltype.cast_opaque_ptr(TYPE, self.getref_base())
+
def getresultrepr(self):
# XXX what do we want to put in here?
return str(self.pval)
@@ -973,9 +983,8 @@
def constbox(self):
return ConstPtr(self.pval)
- def result_eq(self, other):
- assert isinstance(other, self.__class__)
- return self.pval == other.pval
+ def eq_value(self, other):
+ return self.pval == other.getref_base()
# ===================
# Top of the hierachy
@@ -1356,7 +1365,7 @@
'GUARD_NONNULL_CLASS/2d/N',
'_GUARD_FOLDABLE_LAST',
'GUARD_NO_EXCEPTION/0d/N', # may be called with an exception currently set
- 'GUARD_EXCEPTION/1d/p', # may be called with an exception currently set
+ 'GUARD_EXCEPTION/1d/r', # may be called with an exception currently set
'GUARD_NO_OVERFLOW/0d/N',
'GUARD_OVERFLOW/0d/N',
'GUARD_NOT_FORCED/0d/N', # may be called with an exception currently set
@@ -1416,7 +1425,7 @@
'SAME_AS/1/*', # gets a Const or a Box, turns it into another Box
'_ALWAYS_PURE_NO_PTR_LAST',
'CAST_PTR_TO_INT/1/i',
- 'CAST_INT_TO_PTR/1/p',
+ 'CAST_INT_TO_PTR/1/r',
#
'PTR_EQ/2b/i',
'PTR_NE/2b/i',
@@ -1447,11 +1456,11 @@
'GETFIELD_GC/1d/*',
'GETFIELD_RAW/1d/*',
'_MALLOC_FIRST',
- 'NEW/0d/p',
- 'NEW_WITH_VTABLE/1/p',
- 'NEW_ARRAY/1d/p',
- 'NEWSTR/1/p',
- 'NEWUNICODE/1/p',
+ 'NEW/0d/r',
+ 'NEW_WITH_VTABLE/1/r',
+ 'NEW_ARRAY/1d/r',
+ 'NEWSTR/1/r',
+ 'NEWUNICODE/1/r',
'_MALLOC_LAST',
'FORCE_TOKEN/0/i',
'VIRTUAL_REF/2/i', # removed before it's passed to the backend
@@ -1490,8 +1499,8 @@
#'OOSEND', # ootype operation
#'OOSEND_PURE', # ootype operation
'CALL_PURE/*d/*', # removed before it's passed to the backend
- 'CALL_MALLOC_GC/*d/p', # like CALL, but NULL => propagate MemoryError
- 'CALL_MALLOC_NURSERY/1/p', # nursery malloc, const number of bytes, zeroed
+ 'CALL_MALLOC_GC/*d/r', # like CALL, but NULL => propagate MemoryError
+ 'CALL_MALLOC_NURSERY/1/r', # nursery malloc, const number of bytes, zeroed
'_CALL_LAST',
'_CANRAISE_LAST', # ----- end of can_raise operations -----
@@ -1589,7 +1598,7 @@
'N': ResOpNone,
'i': ResOpInt,
'f': ResOpFloat,
- 'p': ResOpPointer,
+ 'r': ResOpPointer,
}
is_guard = name.startswith('GUARD')
@@ -1604,7 +1613,7 @@
if tp == '*':
res = []
- for tp in ['f', 'p', 'i', 'N']:
+ for tp in ['f', 'r', 'i', 'N']:
cls_name = '%s_OP_%s' % (name, tp)
bases = (get_base_class(mixin, tpmixin[tp], baseclass),)
dic = {'opnum': opnum}
diff --git a/pypy/jit/metainterp/test/test_resoperation.py b/pypy/jit/metainterp/test/test_resoperation.py
--- a/pypy/jit/metainterp/test/test_resoperation.py
+++ b/pypy/jit/metainterp/test/test_resoperation.py
@@ -4,6 +4,8 @@
from pypy.rpython.lltypesystem import lltype, llmemory
class FakeBox(object):
+ type = rop.INT
+
def __init__(self, v):
self.v = v
@@ -31,27 +33,6 @@
def _get_hash_(self):
return id(self)
-def test_arity_mixins():
- cases = [
- (0, rop.NullaryOp),
- (1, rop.UnaryOp),
- (2, rop.BinaryOp),
- (3, rop.TernaryOp),
- (9, rop.N_aryOp)
- ]
-
- def test_case(n, cls):
- obj = cls()
- obj.initarglist(range(n))
- assert obj.getarglist() == range(n)
- assert obj.numargs() == n
- for i in range(n):
- assert obj.getarg(i) == i
- py.test.raises(IndexError, obj.getarg, n+1)
-
- for n, cls in cases:
- test_case(n, cls)
-
def test_concrete_classes():
cls = rop.opclasses[rop.rop.INT_ADD]
assert issubclass(cls, rop.PlainResOp)
@@ -92,7 +73,7 @@
assert op.getfloat() == 15.5
assert op.getdescr() is mydescr
- op = rop.create_resop(rop.rop.CALL_p, lltype.nullptr(llmemory.GCREF.TO),
+ op = rop.create_resop(rop.rop.CALL_r, lltype.nullptr(llmemory.GCREF.TO),
[FakeBox('a'), FakeBox('b')], descr=mydescr)
assert op.getarglist() == [FakeBox('a'), FakeBox('b')]
assert not op.getref_base()
@@ -112,7 +93,8 @@
def test_repr():
mydescr = FakeDescr()
- op = rop.create_resop_0(rop.rop.GUARD_NO_EXCEPTION, None, descr=mydescr)
+ op = rop.create_resop_0(rop.rop.GUARD_NO_EXCEPTION, None)
+ op.setdescr(mydescr)
assert repr(op) == 'guard_no_exception(, descr=descr)'
op = rop.create_resop_2(rop.rop.INT_ADD, 3, FakeBox("a"), FakeBox("b"))
assert repr(op) == '3 = int_add(a, b)'
@@ -129,7 +111,8 @@
def test_copy_if_modified_by_optimization():
mydescr = FakeDescr()
- op = rop.create_resop_0(rop.rop.GUARD_NO_EXCEPTION, None, descr=mydescr)
+ op = rop.create_resop_0(rop.rop.GUARD_NO_EXCEPTION, None)
+ op.setdescr(mydescr)
assert op.copy_if_modified_by_optimization(MockOpt({})) is op
op = rop.create_resop_1(rop.rop.INT_IS_ZERO, 1, FakeBox('a'))
assert op.copy_if_modified_by_optimization(MockOpt({})) is op
More information about the pypy-commit
mailing list