[pypy-svn] r68137 - in pypy/trunk/pypy/jit/metainterp: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Sat Oct 3 12:13:49 CEST 2009
Author: cfbolz
Date: Sat Oct 3 12:13:48 2009
New Revision: 68137
Modified:
pypy/trunk/pypy/jit/metainterp/executor.py
pypy/trunk/pypy/jit/metainterp/history.py
pypy/trunk/pypy/jit/metainterp/optimizefindnode.py
pypy/trunk/pypy/jit/metainterp/optimizeopt.py
pypy/trunk/pypy/jit/metainterp/pyjitpl.py
pypy/trunk/pypy/jit/metainterp/resume.py
pypy/trunk/pypy/jit/metainterp/specnode.py
pypy/trunk/pypy/jit/metainterp/test/oparser.py
pypy/trunk/pypy/jit/metainterp/test/test_history.py
pypy/trunk/pypy/jit/metainterp/test/test_optimizeopt.py
pypy/trunk/pypy/jit/metainterp/typesystem.py
pypy/trunk/pypy/jit/metainterp/warmspot.py
Log:
Revert the checkins 68136, 68133, 68132. Their time will come.
Modified: pypy/trunk/pypy/jit/metainterp/executor.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/executor.py (original)
+++ pypy/trunk/pypy/jit/metainterp/executor.py Sat Oct 3 12:13:48 2009
@@ -6,7 +6,7 @@
from pypy.rpython.ootypesystem import ootype
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rlib.rarithmetic import ovfcheck, r_uint, intmask
-from pypy.jit.metainterp.history import BoxInt, constint, check_descr
+from pypy.jit.metainterp.history import BoxInt, ConstInt, check_descr
from pypy.jit.metainterp.history import INT, REF, ConstFloat
from pypy.jit.metainterp import resoperation
from pypy.jit.metainterp.resoperation import rop
@@ -19,86 +19,86 @@
# ____________________________________________________________
def do_int_add(cpu, box1, box2):
- return constint(intmask(box1.getint() + box2.getint()))
+ return ConstInt(intmask(box1.getint() + box2.getint()))
def do_int_sub(cpu, box1, box2):
- return constint(intmask(box1.getint() - box2.getint()))
+ return ConstInt(intmask(box1.getint() - box2.getint()))
def do_int_mul(cpu, box1, box2):
- return constint(intmask(box1.getint() * box2.getint()))
+ return ConstInt(intmask(box1.getint() * box2.getint()))
def do_int_floordiv(cpu, box1, box2):
z = llop.int_floordiv(lltype.Signed, box1.getint(), box2.getint())
- return constint(z)
+ return ConstInt(z)
def do_int_mod(cpu, box1, box2):
z = llop.int_mod(lltype.Signed, box1.getint(), box2.getint())
- return constint(z)
+ return ConstInt(z)
def do_int_and(cpu, box1, box2):
- return constint(box1.getint() & box2.getint())
+ return ConstInt(box1.getint() & box2.getint())
def do_int_or(cpu, box1, box2):
- return constint(box1.getint() | box2.getint())
+ return ConstInt(box1.getint() | box2.getint())
def do_int_xor(cpu, box1, box2):
- return constint(box1.getint() ^ box2.getint())
+ return ConstInt(box1.getint() ^ box2.getint())
def do_int_rshift(cpu, box1, box2):
- return constint(box1.getint() >> box2.getint())
+ return ConstInt(box1.getint() >> box2.getint())
def do_int_lshift(cpu, box1, box2):
- return constint(intmask(box1.getint() << box2.getint()))
+ return ConstInt(intmask(box1.getint() << box2.getint()))
def do_uint_rshift(cpu, box1, box2):
v = r_uint(box1.getint()) >> r_uint(box2.getint())
- return constint(intmask(v))
+ return ConstInt(intmask(v))
# ----------
def do_int_lt(cpu, box1, box2):
- return constint(box1.getint() < box2.getint())
+ return ConstInt(box1.getint() < box2.getint())
def do_int_le(cpu, box1, box2):
- return constint(box1.getint() <= box2.getint())
+ return ConstInt(box1.getint() <= box2.getint())
def do_int_eq(cpu, box1, box2):
- return constint(box1.getint() == box2.getint())
+ return ConstInt(box1.getint() == box2.getint())
def do_int_ne(cpu, box1, box2):
- return constint(box1.getint() != box2.getint())
+ return ConstInt(box1.getint() != box2.getint())
def do_int_gt(cpu, box1, box2):
- return constint(box1.getint() > box2.getint())
+ return ConstInt(box1.getint() > box2.getint())
def do_int_ge(cpu, box1, box2):
- return constint(box1.getint() >= box2.getint())
+ return ConstInt(box1.getint() >= box2.getint())
def do_uint_lt(cpu, box1, box2):
- return constint(r_uint(box1.getint()) < r_uint(box2.getint()))
+ return ConstInt(r_uint(box1.getint()) < r_uint(box2.getint()))
def do_uint_le(cpu, box1, box2):
- return constint(r_uint(box1.getint()) <= r_uint(box2.getint()))
+ return ConstInt(r_uint(box1.getint()) <= r_uint(box2.getint()))
def do_uint_gt(cpu, box1, box2):
- return constint(r_uint(box1.getint()) > r_uint(box2.getint()))
+ return ConstInt(r_uint(box1.getint()) > r_uint(box2.getint()))
def do_uint_ge(cpu, box1, box2):
- return constint(r_uint(box1.getint()) >= r_uint(box2.getint()))
+ return ConstInt(r_uint(box1.getint()) >= r_uint(box2.getint()))
# ----------
def do_int_is_true(cpu, box1):
- return constint(bool(box1.getint()))
+ return ConstInt(bool(box1.getint()))
def do_int_neg(cpu, box1):
- return constint(intmask(-box1.getint()))
+ return ConstInt(intmask(-box1.getint()))
def do_int_invert(cpu, box1):
- return constint(~box1.getint())
+ return ConstInt(~box1.getint())
def do_bool_not(cpu, box1):
- return constint(not box1.getint())
+ return ConstInt(not box1.getint())
def do_same_as(cpu, box1):
return box1
@@ -111,7 +111,7 @@
x = bool(box1.getref_base())
else:
assert False
- return constint(x)
+ return ConstInt(x)
def do_ooisnull(cpu, box1):
tp = box1.type
@@ -121,7 +121,7 @@
x = bool(box1.getref_base())
else:
assert False
- return constint(not x)
+ return ConstInt(not x)
def do_oois(cpu, box1, box2):
tp = box1.type
@@ -132,7 +132,7 @@
x = box1.getref_base() == box2.getref_base()
else:
assert False
- return constint(x)
+ return ConstInt(x)
def do_ooisnot(cpu, box1, box2):
tp = box1.type
@@ -143,14 +143,14 @@
x = box1.getref_base() != box2.getref_base()
else:
assert False
- return constint(x)
+ return ConstInt(x)
def do_ooidentityhash(cpu, box1):
obj = box1.getref_base()
- return constint(cpu.ts.ooidentityhash(obj))
+ return ConstInt(cpu.ts.ooidentityhash(obj))
def do_subclassof(cpu, box1, box2):
- return constint(cpu.ts.subclassOf(cpu, box1, box2))
+ return ConstInt(cpu.ts.subclassOf(cpu, box1, box2))
# ----------
@@ -202,7 +202,7 @@
return ConstFloat(abs(box1.getfloat()))
def do_float_is_true(cpu, box1):
- return constint(bool(box1.getfloat()))
+ return ConstInt(bool(box1.getfloat()))
def do_float_add(cpu, box1, box2):
return ConstFloat(box1.getfloat() + box2.getfloat())
@@ -217,25 +217,25 @@
return ConstFloat(box1.getfloat() / box2.getfloat())
def do_float_lt(cpu, box1, box2):
- return constint(box1.getfloat() < box2.getfloat())
+ return ConstInt(box1.getfloat() < box2.getfloat())
def do_float_le(cpu, box1, box2):
- return constint(box1.getfloat() <= box2.getfloat())
+ return ConstInt(box1.getfloat() <= box2.getfloat())
def do_float_eq(cpu, box1, box2):
- return constint(box1.getfloat() == box2.getfloat())
+ return ConstInt(box1.getfloat() == box2.getfloat())
def do_float_ne(cpu, box1, box2):
- return constint(box1.getfloat() != box2.getfloat())
+ return ConstInt(box1.getfloat() != box2.getfloat())
def do_float_gt(cpu, box1, box2):
- return constint(box1.getfloat() > box2.getfloat())
+ return ConstInt(box1.getfloat() > box2.getfloat())
def do_float_ge(cpu, box1, box2):
- return constint(box1.getfloat() >= box2.getfloat())
+ return ConstInt(box1.getfloat() >= box2.getfloat())
def do_cast_float_to_int(cpu, box1):
- return constint(int(box1.getfloat()))
+ return ConstInt(int(box1.getfloat()))
def do_cast_int_to_float(cpu, box1):
return ConstFloat(float(box1.getint()))
Modified: pypy/trunk/pypy/jit/metainterp/history.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/history.py (original)
+++ pypy/trunk/pypy/jit/metainterp/history.py Sat Oct 3 12:13:48 2009
@@ -160,7 +160,7 @@
intval = cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(x))
else:
intval = lltype.cast_primitive(lltype.Signed, x)
- return constint(intval)
+ return ConstInt(intval)
elif kind == "ref":
return cpu.ts.new_ConstRef(x)
elif kind == "float":
@@ -244,28 +244,9 @@
def repr_rpython(self):
return repr_rpython(self, 'ci')
-constint_lower = -5
-constint_upper = 200
-assert rop._LAST < constint_upper
-ConstInt.PREBUILT = [ConstInt(i) for i in range(constint_lower, constint_upper)]
-
-def constint(x):
- from pypy.rlib.rarithmetic import r_uint
- # use r_uint to perform a single comparison (this whole function
- # is getting inlined into every caller so keeping the branching
- # to a minimum is a good idea)
- if not we_are_translated() and not isinstance(x, int): # e.g. TotalOrderSymbolic
- return ConstInt(x)
- index = r_uint(x - constint_lower)
- if index >= r_uint(constint_upper - constint_lower):
- const = ConstInt(x)
- else:
- const = ConstInt.PREBUILT[index]
- return const
-
-CONST_0 = CONST_FALSE = constint(0)
-CONST_1 = CONST_TRUE = constint(1)
+CONST_FALSE = ConstInt(0)
+CONST_TRUE = ConstInt(1)
class ConstAddr(Const): # only for constants built before translation
type = INT
@@ -509,7 +490,7 @@
return BoxInt(self.value)
def constbox(self):
- return constint(self.value)
+ return ConstInt(self.value)
def getint(self):
return self.value
Modified: pypy/trunk/pypy/jit/metainterp/optimizefindnode.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/optimizefindnode.py (original)
+++ pypy/trunk/pypy/jit/metainterp/optimizefindnode.py Sat Oct 3 12:13:48 2009
@@ -4,7 +4,7 @@
from pypy.jit.metainterp.specnode import VirtualInstanceSpecNode
from pypy.jit.metainterp.specnode import VirtualArraySpecNode
from pypy.jit.metainterp.specnode import VirtualStructSpecNode
-from pypy.jit.metainterp.history import AbstractValue, constint, Const
+from pypy.jit.metainterp.history import AbstractValue, ConstInt, Const
from pypy.jit.metainterp.resoperation import rop
from pypy.jit.metainterp.executor import execute_nonspec
from pypy.jit.metainterp.optimizeutil import av_newdict, _findall, sort_descrs
@@ -199,7 +199,7 @@
def find_nodes_ARRAYLEN_GC(self, op):
arraynode = self.getnode(op.args[0])
if arraynode.arraydescr is not None:
- resbox = constint(arraynode.arraysize)
+ resbox = ConstInt(arraynode.arraysize)
self.set_constant_node(op.result, resbox)
def find_nodes_GUARD_CLASS(self, op):
Modified: pypy/trunk/pypy/jit/metainterp/optimizeopt.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/optimizeopt.py (original)
+++ pypy/trunk/pypy/jit/metainterp/optimizeopt.py Sat Oct 3 12:13:48 2009
@@ -1,6 +1,5 @@
from pypy.jit.metainterp.history import Box, BoxInt, LoopToken
-from pypy.jit.metainterp.history import Const, constint, ConstInt, ConstPtr, ConstObj, REF
-from pypy.jit.metainterp.history import CONST_0, CONST_1
+from pypy.jit.metainterp.history import Const, ConstInt, ConstPtr, ConstObj, REF
from pypy.jit.metainterp.resoperation import rop, ResOperation
from pypy.jit.metainterp.executor import execute_nonspec
from pypy.jit.metainterp.specnode import SpecNode, NotSpecNode, ConstantSpecNode
@@ -12,7 +11,7 @@
from pypy.jit.metainterp.optimizeutil import InvalidLoop
from pypy.jit.metainterp import resume, compile
from pypy.jit.metainterp.typesystem import llhelper, oohelper
-from pypy.rlib.objectmodel import we_are_translated, r_dict
+from pypy.rlib.objectmodel import we_are_translated
from pypy.rpython.lltypesystem import lltype
def optimize_loop_1(cpu, loop):
@@ -141,6 +140,8 @@
def __init__(self, box):
self.box = box
+CONST_0 = ConstInt(0)
+CONST_1 = ConstInt(1)
CVAL_ZERO = ConstantValue(CONST_0)
llhelper.CONST_NULL = ConstPtr(ConstPtr.value)
llhelper.CVAL_NULLREF = ConstantValue(llhelper.CONST_NULL)
@@ -268,7 +269,7 @@
if subvalue is not None:
subbox = subvalue.force_box()
op = ResOperation(rop.SETARRAYITEM_GC,
- [box, constint(index), subbox], None,
+ [box, ConstInt(index), subbox], None,
descr=self.arraydescr)
newoperations.append(op)
return self.box
@@ -348,23 +349,6 @@
subspecnode.teardown_virtual_node(optimizer, subvalue, newexitargs)
-def hash_op(op):
- from pypy.rlib.rarithmetic import intmask
- mult = 1000003
- x = 0x345678 ^ op.opnum
- z = len(op.args)
- for box in op.args:
- y = hash(box)
- x = (x ^ y) * mult
- z -= 1
- mult += 82520 + z + z
- x += 97531
- return intmask(x)
-
-def eq_op(op1, op2):
- return op1.opnum == op2.opnum and op1.args == op2.args
-
-
class Optimizer(object):
def __init__(self, cpu, loop):
@@ -379,7 +363,6 @@
self.values_to_clean = {}
self.interned_refs = {}
- self.emitted_pure_ops = r_dict(eq_op, hash_op)
def getinterned(self, box):
constbox = self.get_constant_box(box)
@@ -396,7 +379,7 @@
self.interned_refs[key] = box
return box
else:
- return constbox
+ return box
def getvalue(self, box):
box = self.getinterned(box)
@@ -427,7 +410,7 @@
self.make_equal_to(box, ConstantValue(constbox))
def make_constant_int(self, box, intvalue):
- self.make_constant(box, constint(intvalue))
+ self.make_constant(box, ConstInt(intvalue))
def make_virtual(self, known_class, box, source_op=None):
vvalue = VirtualValue(self, known_class, box, source_op)
@@ -512,14 +495,7 @@
op = op.clone()
must_clone = False
op.args[i] = box
- if op.is_always_pure():
- oldresult = self.emitted_pure_ops.get(op, None)
- if oldresult:
- self.make_equal_to(op.result, self.getvalue(oldresult))
- return
- else:
- self.emitted_pure_ops[op] = op.result
- elif op.is_guard():
+ if op.is_guard():
self.store_final_boxes_in_guard(op)
elif op.can_raise():
self.exception_might_have_happened = True
@@ -559,7 +535,6 @@
resbox = execute_nonspec(self.cpu, op.opnum, argboxes, op.descr)
self.make_constant(op.result, resbox.constbox())
return
-
elif not op.has_no_side_effect() and not op.is_ovf():
self.clean_fields_of_values()
# otherwise, the operation remains
Modified: pypy/trunk/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/trunk/pypy/jit/metainterp/pyjitpl.py Sat Oct 3 12:13:48 2009
@@ -6,7 +6,7 @@
from pypy.rlib.debug import debug_print
from pypy.jit.metainterp import history, compile, resume
-from pypy.jit.metainterp.history import Const, constint, Box, CONST_0
+from pypy.jit.metainterp.history import Const, ConstInt, Box
from pypy.jit.metainterp.resoperation import rop
from pypy.jit.metainterp import codewriter, executor
from pypy.jit.metainterp.logger import Logger
@@ -351,7 +351,7 @@
@arguments("orgpc", "box", "descr", "box")
def opimpl_check_neg_index(self, pc, arraybox, arraydesc, indexbox):
negbox = self.metainterp.execute_and_record(
- rop.INT_LT, None, indexbox, CONST_0)
+ rop.INT_LT, None, indexbox, ConstInt(0))
# xxx inefficient
negbox = self.implement_guard_value(pc, negbox)
if negbox.getint():
@@ -391,7 +391,7 @@
def opimpl_check_resizable_neg_index(self, pc, listbox, lengthdesc,
indexbox):
negbox = self.metainterp.execute_and_record(
- rop.INT_LT, None, indexbox, CONST_0)
+ rop.INT_LT, None, indexbox, ConstInt(0))
# xxx inefficient
negbox = self.implement_guard_value(pc, negbox)
if negbox.getint():
@@ -405,7 +405,7 @@
@arguments("orgpc", "box")
def opimpl_check_zerodivisionerror(self, pc, box):
nonzerobox = self.metainterp.execute_and_record(
- rop.INT_NE, None, box, CONST_0)
+ rop.INT_NE, None, box, ConstInt(0))
# xxx inefficient
nonzerobox = self.implement_guard_value(pc, nonzerobox)
if nonzerobox.getint():
@@ -419,11 +419,11 @@
# detect the combination "box1 = -sys.maxint-1, box2 = -1".
import sys
tmp1 = self.metainterp.execute_and_record( # combination to detect:
- rop.INT_ADD, None, box1, constint(sys.maxint)) # tmp1=-1, box2=-1
+ rop.INT_ADD, None, box1, ConstInt(sys.maxint)) # tmp1=-1, box2=-1
tmp2 = self.metainterp.execute_and_record(
rop.INT_AND, None, tmp1, box2) # tmp2=-1
tmp3 = self.metainterp.execute_and_record(
- rop.INT_EQ, None, tmp2, constint(-1)) # tmp3?
+ rop.INT_EQ, None, tmp2, ConstInt(-1)) # tmp3?
# xxx inefficient
tmp4 = self.implement_guard_value(pc, tmp3) # tmp4?
if not tmp4.getint():
@@ -439,7 +439,7 @@
@arguments("orgpc", "box")
def opimpl_int_abs(self, pc, box):
nonneg = self.metainterp.execute_and_record(
- rop.INT_GE, None, box, CONST_0)
+ rop.INT_GE, None, box, ConstInt(0))
# xxx inefficient
nonneg = self.implement_guard_value(pc, nonneg)
if nonneg.getint():
@@ -585,7 +585,7 @@
virtualizable_box = self.metainterp.virtualizable_boxes[-1]
virtualizable = vinfo.unwrap_virtualizable_box(virtualizable_box)
result = vinfo.get_array_length(virtualizable, arrayindex)
- self.make_result_box(constint(result))
+ self.make_result_box(ConstInt(result))
def perform_call(self, jitcode, varargs):
if (self.metainterp.is_blackholing() and
@@ -1725,7 +1725,7 @@
descr = vinfo.array_descrs[k]
for j in range(vinfo.get_array_length(virtualizable, k)):
itembox = self.execute_and_record(rop.GETARRAYITEM_GC,
- descr, abox, constint(j))
+ descr, abox, ConstInt(j))
self.virtualizable_boxes[i] = itembox
i += 1
assert i + 1 == len(self.virtualizable_boxes)
@@ -1749,7 +1749,7 @@
itembox = self.virtualizable_boxes[i]
i += 1
self.execute_and_record(rop.SETARRAYITEM_GC, descr,
- abox, constint(j), itembox)
+ abox, ConstInt(j), itembox)
assert i + 1 == len(self.virtualizable_boxes)
def gen_store_back_in_virtualizable_no_perform(self):
@@ -1770,7 +1770,7 @@
itembox = self.virtualizable_boxes[i]
i += 1
self.history.record(rop.SETARRAYITEM_GC,
- [abox, constint(j), itembox],
+ [abox, ConstInt(j), itembox],
None,
descr=vinfo.array_descrs[k])
assert i + 1 == len(self.virtualizable_boxes)
Modified: pypy/trunk/pypy/jit/metainterp/resume.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/resume.py (original)
+++ pypy/trunk/pypy/jit/metainterp/resume.py Sat Oct 3 12:13:48 2009
@@ -1,5 +1,5 @@
import sys
-from pypy.jit.metainterp.history import Box, Const, constint
+from pypy.jit.metainterp.history import Box, Const, ConstInt
from pypy.jit.metainterp.resoperation import rop
# Logic to encode the chain of frames and the state of the boxes at a
@@ -251,14 +251,14 @@
length = len(self.fieldnums)
return metainterp.execute_and_record(rop.NEW_ARRAY,
self.arraydescr,
- constint(length))
+ ConstInt(length))
def setfields(self, metainterp, box, fn_decode_box):
for i in range(len(self.fieldnums)):
itembox = fn_decode_box(self.fieldnums[i])
metainterp.execute_and_record(rop.SETARRAYITEM_GC,
self.arraydescr,
- box, constint(i), itembox)
+ box, ConstInt(i), itembox)
def repr_rpython(self):
return 'VArrayInfo("%s", %s)' % (self.arraydescr,
Modified: pypy/trunk/pypy/jit/metainterp/specnode.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/specnode.py (original)
+++ pypy/trunk/pypy/jit/metainterp/specnode.py Sat Oct 3 12:13:48 2009
@@ -97,7 +97,7 @@
for i in range(len(self.items)):
itembox = executor.execute(cpu, resoperation.rop.GETARRAYITEM_GC,
self.arraydescr,
- valuebox, history.constint(i))
+ valuebox, history.ConstInt(i))
subspecnode = self.items[i]
subspecnode.extract_runtime_data(cpu, itembox, resultlist)
Modified: pypy/trunk/pypy/jit/metainterp/test/oparser.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/test/oparser.py (original)
+++ pypy/trunk/pypy/jit/metainterp/test/oparser.py Sat Oct 3 12:13:48 2009
@@ -3,7 +3,7 @@
in a nicer fashion
"""
-from pypy.jit.metainterp.history import TreeLoop, BoxInt, constint,\
+from pypy.jit.metainterp.history import TreeLoop, BoxInt, ConstInt,\
ConstAddr, ConstObj, ConstPtr, Box, BasicFailDescr, LoopToken
from pypy.jit.metainterp.resoperation import rop, ResOperation
from pypy.jit.metainterp.typesystem import llhelper
@@ -98,9 +98,9 @@
def getvar(self, arg):
if not arg:
- return constint(0)
+ return ConstInt(0)
try:
- return constint(int(arg))
+ return ConstInt(int(arg))
except ValueError:
if arg.startswith('"') or arg.startswith("'"):
# XXX ootype
Modified: pypy/trunk/pypy/jit/metainterp/test/test_history.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/test/test_history.py (original)
+++ pypy/trunk/pypy/jit/metainterp/test/test_history.py Sat Oct 3 12:13:48 2009
@@ -9,13 +9,3 @@
s = lltype.cast_pointer(lltype.Ptr(S), t)
const = ConstPtr(lltype.cast_opaque_ptr(llmemory.GCREF, s))
assert const._getrepr_() == "*T"
-
-def test_constint_sharing():
- for val in [-1, 0, 1, 5, 99]:
- c1 = constint(val)
- c2 = constint(val)
- assert c1 is c2
- for val in [100000, -10000]:
- c1 = constint(val)
- c2 = constint(val)
- assert c1 is not c2
Modified: pypy/trunk/pypy/jit/metainterp/test/test_optimizeopt.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/test/test_optimizeopt.py (original)
+++ pypy/trunk/pypy/jit/metainterp/test/test_optimizeopt.py Sat Oct 3 12:13:48 2009
@@ -47,7 +47,6 @@
assert fdescr.rd_virtuals is None
assert fdescr.rd_consts == []
assert fdescr.rd_frame_infos == fi
-
# ____________________________________________________________
def equaloplists(oplist1, oplist2, strict_fail_args=True, remap={}):
@@ -133,17 +132,6 @@
class BaseTestOptimizeOpt(BaseTest):
- def test_getinterned(self):
- opt = optimizeopt.Optimizer(self.cpu, None)
- b1 = BoxInt()
- assert opt.getinterned(b1) is b1
- opt.make_constant(b1, ConstInt(1))
- c1 = opt.getinterned(b1)
- assert isinstance(c1, ConstInt)
- c1 = self.cpu.ts.ConstRef(self.myptr)
- c2 = self.cpu.ts.ConstRef(self.myptr)
- assert opt.getinterned(c1) is opt.getinterned(c2)
-
def invent_fail_descr(self, fail_args):
if fail_args is None:
return None
@@ -421,72 +409,6 @@
"""
self.optimize_loop(ops, '', expected)
- def test_common_expression_elimination(self):
- ops = """
- [i0, i1, i2, i3]
- ir1 = int_add(i0, 1)
- ir2 = int_add(i0, 1)
- ir3 = int_add(i1, i2)
- ir4 = int_add(i1, i2)
- jump(ir1, ir2, ir3, ir4)
- """
- expected = """
- [i0, i1, i2, i3]
- ir1 = int_add(i0, 1)
- ir3 = int_add(i1, i2)
- jump(ir1, ir1, ir3, ir3)
- """
- self.optimize_loop(ops, 'Not, Not, Not, Not', expected)
-
- ops = """
- [p0, p1]
- pr1 = getfield_gc_pure(p0, descr=valuedescr)
- pr2 = getfield_gc_pure(p0, descr=valuedescr)
- jump(pr1, pr2)
- """
- expected = """
- [p0, p1]
- pr1 = getfield_gc_pure(p0, descr=valuedescr)
- jump(pr1, pr1)
- """
- self.optimize_loop(ops, 'Not, Not', expected)
-
- ops = """
- [p0, p1]
- i1 = oois(p0, p1)
- guard_value(i1, 1) []
- i2 = oois(p0, p1)
- guard_value(i2, 1) []
- jump(p0, p1)
- """
- expected = """
- [p0, p1]
- i1 = oois(p0, p1)
- guard_value(i1, 1) []
- jump(p0, p1)
- """
- self.optimize_loop(ops, 'Not, Not', expected)
-
- def test_common_expression_elimination_virtual(self):
- ops = """
- [p0, p1]
- i1 = oois(p0, p1)
- guard_value(i1, 1) []
- p2 = new_with_vtable(ConstClass(node_vtable))
- setfield_gc(p2, p0, descr=valuedescr)
- p3 = getfield_gc(p2, descr=valuedescr)
- i2 = oois(p3, p1)
- guard_value(i2, 1) []
- jump(p0, p1)
- """
- expected = """
- [p0, p1]
- i1 = oois(p0, p1)
- guard_value(i1, 1) []
- jump(p0, p1)
- """
- self.optimize_loop(ops, 'Not, Not', expected)
-
def test_ooisnull_oononnull_via_virtual(self):
ops = """
[p0]
Modified: pypy/trunk/pypy/jit/metainterp/typesystem.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/typesystem.py (original)
+++ pypy/trunk/pypy/jit/metainterp/typesystem.py Sat Oct 3 12:13:48 2009
@@ -77,7 +77,7 @@
def cls_of_box(self, cpu, box):
obj = box.getref(lltype.Ptr(rclass.OBJECT))
cls = llmemory.cast_ptr_to_adr(obj.typeptr)
- return history.constint(cpu.cast_adr_to_int(cls))
+ return history.ConstInt(cpu.cast_adr_to_int(cls))
def subclassOf(self, cpu, clsbox1, clsbox2):
adr = clsbox2.getaddr(cpu)
@@ -87,7 +87,7 @@
return rclass.ll_issubclass(real_class, bounding_class)
def get_exception_box(self, etype):
- return history.constint(etype)
+ return history.ConstInt(etype)
def get_exc_value_box(self, evalue):
return history.BoxPtr(evalue)
Modified: pypy/trunk/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/warmspot.py (original)
+++ pypy/trunk/pypy/jit/metainterp/warmspot.py Sat Oct 3 12:13:48 2009
@@ -637,7 +637,7 @@
else:
value = intmask(value)
if in_const_box:
- return history.constint(value)
+ return history.ConstInt(value)
else:
return history.BoxInt(value)
wrap._annspecialcase_ = 'specialize:ll'
More information about the Pypy-commit
mailing list