[pypy-svn] r77271 - in pypy/branch/jit-str/pypy/jit: codewriter codewriter/test metainterp metainterp/optimizeopt metainterp/test
arigo at codespeak.net
arigo at codespeak.net
Wed Sep 22 16:02:58 CEST 2010
Author: arigo
Date: Wed Sep 22 16:02:56 2010
New Revision: 77271
Modified:
pypy/branch/jit-str/pypy/jit/codewriter/jtransform.py
pypy/branch/jit-str/pypy/jit/codewriter/test/test_jtransform.py
pypy/branch/jit-str/pypy/jit/codewriter/test/test_list.py
pypy/branch/jit-str/pypy/jit/metainterp/blackhole.py
pypy/branch/jit-str/pypy/jit/metainterp/executor.py
pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/optimizer.py
pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/rewrite.py
pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/virtualize.py
pypy/branch/jit-str/pypy/jit/metainterp/pyjitpl.py
pypy/branch/jit-str/pypy/jit/metainterp/resoperation.py
pypy/branch/jit-str/pypy/jit/metainterp/resume.py
pypy/branch/jit-str/pypy/jit/metainterp/simple_optimize.py
pypy/branch/jit-str/pypy/jit/metainterp/test/test_optimizefindnode.py
pypy/branch/jit-str/pypy/jit/metainterp/test/test_optimizeopt.py
pypy/branch/jit-str/pypy/jit/metainterp/test/test_string.py
Log:
Still in-progress. Rewriting stuff.
Modified: pypy/branch/jit-str/pypy/jit/codewriter/jtransform.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/codewriter/jtransform.py (original)
+++ pypy/branch/jit-str/pypy/jit/codewriter/jtransform.py Wed Sep 22 16:02:56 2010
@@ -1028,7 +1028,7 @@
def _handle_oopspec_call(self, op, args, oopspecindex):
cc = self.callcontrol
calldescr = cc.getcalldescr(op, oopspecindex=oopspecindex)
- return SpaceOperation('oopspec_call',
+ return SpaceOperation('call_oopspec',
[calldescr, op.args[0]] + args,
op.result)
Modified: pypy/branch/jit-str/pypy/jit/codewriter/test/test_jtransform.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/codewriter/test/test_jtransform.py (original)
+++ pypy/branch/jit-str/pypy/jit/codewriter/test/test_jtransform.py Wed Sep 22 16:02:56 2010
@@ -694,7 +694,7 @@
op = SpaceOperation('direct_call', [const(func), v1, v2], v3)
tr = Transformer(FakeCPU(), FakeBuiltinCallControl())
op1 = tr.rewrite_operation(op)
- assert op1.opname == 'oopspec_call'
+ assert op1.opname == 'call_oopspec'
assert op1.args[0] == 'calldescr-%d' % effectinfo.EffectInfo.OS_STR_CONCAT
assert op1.args[1].value == func
assert op1.args[2:] == [v1, v2]
@@ -712,7 +712,7 @@
op = SpaceOperation('direct_call', [const(func), v1, v2], v3)
tr = Transformer(FakeCPU(), FakeBuiltinCallControl())
op1 = tr.rewrite_operation(op)
- assert op1.opname == 'oopspec_call'
+ assert op1.opname == 'call_oopspec'
assert op1.args[0] == 'calldescr-%d' % effectinfo.EffectInfo.OS_UNI_CONCAT
assert op1.args[1].value == func
assert op1.args[2:] == [v1, v2]
@@ -731,7 +731,7 @@
op = SpaceOperation('direct_call', [const(func), v1, v2], v3)
tr = Transformer(FakeCPU(), FakeBuiltinCallControl())
op1 = tr.rewrite_operation(op)
- assert op1.opname == 'oopspec_call'
+ assert op1.opname == 'call_oopspec'
assert op1.args[0] == 'calldescr-%d' % (
effectinfo.EffectInfo.OS_STR_SLICE_STARTONLY)
assert op1.args[1].value == func
@@ -752,7 +752,7 @@
op = SpaceOperation('direct_call', [const(func), v1, v2, v3], v4)
tr = Transformer(FakeCPU(), FakeBuiltinCallControl())
op1 = tr.rewrite_operation(op)
- assert op1.opname == 'oopspec_call'
+ assert op1.opname == 'call_oopspec'
assert op1.args[0] == 'calldescr-%d' % (
effectinfo.EffectInfo.OS_STR_SLICE_STARTSTOP)
assert op1.args[1].value == func
@@ -770,7 +770,7 @@
op = SpaceOperation('direct_call', [const(func), v1], v2)
tr = Transformer(FakeCPU(), FakeBuiltinCallControl())
op1 = tr.rewrite_operation(op)
- assert op1.opname == 'oopspec_call'
+ assert op1.opname == 'call_oopspec'
assert op1.args[0] == 'calldescr-%d' % (
effectinfo.EffectInfo.OS_STR_SLICE_MINUSONE)
assert op1.args[1].value == func
@@ -793,7 +793,7 @@
op = SpaceOperation('direct_call', [const(func), v1, v2, v3, v4, v5], v6)
tr = Transformer(FakeCPU(), FakeBuiltinCallControl())
op1 = tr.rewrite_operation(op)
- assert op1.opname == 'oopspec_call'
+ assert op1.opname == 'call_oopspec'
assert op1.args[0] == 'calldescr-%d' % effectinfo.EffectInfo.OS_ARRAYCOPY
assert op1.args[1].value == func
assert op1.args[2:] == [v1, v2, v3, v4, v5]
Modified: pypy/branch/jit-str/pypy/jit/codewriter/test/test_list.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/codewriter/test/test_list.py (original)
+++ pypy/branch/jit-str/pypy/jit/codewriter/test/test_list.py Wed Sep 22 16:02:56 2010
@@ -103,7 +103,7 @@
varoftype(lltype.Signed),
varoftype(lltype.Signed)],
lltype.Void, """
- oopspec_call <CallDescrOS1>, $'myfunc', %r0, %r1, %i0, %i1, %i2
+ call_oopspec <CallDescrOS1>, $'myfunc', %r0, %r1, %i0, %i1, %i2
""")
def test_fixed_getitem():
Modified: pypy/branch/jit-str/pypy/jit/metainterp/blackhole.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/blackhole.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/blackhole.py Wed Sep 22 16:02:56 2010
@@ -1024,10 +1024,6 @@
def bhimpl_arraylen_gc(cpu, array, arraydescr):
return cpu.bh_arraylen_gc(arraydescr, array)
- @arguments("cpu", "d", "i", "r", "r", "i", "i", "i", "d")
- def bhimpl_arraycopy(cpu, calldescr, func, x1, x2, x3, x4, x5, arraydescr):
- cpu.bh_call_v(func, calldescr, [x3, x4, x5], [x1, x2], None)
-
@arguments("cpu", "r", "d", "d", "i", returns="i")
def bhimpl_getarrayitem_vable_i(cpu, vable, fielddescr, arraydescr, index):
array = cpu.bh_getfield_gc_r(vable, fielddescr)
Modified: pypy/branch/jit-str/pypy/jit/metainterp/executor.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/executor.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/executor.py Wed Sep 22 16:02:56 2010
@@ -165,12 +165,6 @@
def do_new_with_vtable(cpu, _, clsbox):
return BoxPtr(exec_new_with_vtable(cpu, clsbox))
-def do_arraycopy(cpu, _, calldescr, funcbox, x1box, x2box,
- x3box, x4box, x5box, arraydescr):
- cpu.bh_call_v(funcbox.getint(), calldescr,
- [x3box.getint(), x4box.getint(), x5box.getint()],
- [x1box.getref_base(), x2box.getref_base()], None)
-
def do_int_add_ovf(cpu, metainterp, box1, box2):
# the overflow operations can be called without a metainterp, if an
# overflow cannot occur
Modified: pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/optimizer.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/optimizer.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/optimizer.py Wed Sep 22 16:02:56 2010
@@ -126,12 +126,6 @@
def setitem(self, index, value):
raise NotImplementedError
- def getchar(self):
- raise NotImplementedError
-
- def setchar(self, charvalue):
- raise NotImplementedError
-
class ConstantValue(OptValue):
def __init__(self, box):
self.make_constant(box)
Modified: pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/rewrite.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/rewrite.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/rewrite.py Wed Sep 22 16:02:56 2010
@@ -138,6 +138,7 @@
# replace CALL_PURE with just CALL
self.emit_operation(ResOperation(rop.CALL, op.args[1:], op.result,
op.descr))
+
def optimize_guard(self, op, constbox, emit_operation=True):
value = self.getvalue(op.args[0])
if value.is_constant():
Modified: pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/virtualize.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/virtualize.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/optimizeopt/virtualize.py Wed Sep 22 16:02:56 2010
@@ -7,6 +7,8 @@
from pypy.jit.metainterp.optimizeutil import _findall
from pypy.rlib.objectmodel import we_are_translated
from pypy.jit.metainterp.optimizeopt.optimizer import *
+from pypy.jit.codewriter.effectinfo import EffectInfo
+from pypy.rlib.unroll import unrolling_iterable
class AbstractVirtualValue(OptValue):
@@ -193,37 +195,42 @@
def _make_virtual(self, modifier):
return modifier.make_varray(self.arraydescr)
-class VStringLength1Value(AbstractVirtualValue):
+class VStringPlainValue(AbstractVirtualValue):
- def __init__(self, optimizer, keybox, source_op=None):
+ def __init__(self, optimizer, size, keybox, source_op=None):
AbstractVirtualValue.__init__(self, optimizer, keybox, source_op)
- self._char = CVAL_ZERO
+ self._chars = [CVAL_ZERO] * size
+
+ def getlength(self):
+ return len(self._chars)
- def getchar(self):
- return self._char
+ def getitem(self, index):
+ return self._chars[index]
- def setchar(self, charvalue):
+ def setitem(self, index, charvalue):
assert isinstance(charvalue, OptValue)
- self._char = charvalue
+ self._chars[index] = charvalue
def _really_force(self):
assert self.source_op is not None
newoperations = self.optimizer.newoperations
newoperations.append(self.source_op)
self.box = box = self.source_op.result
- charbox = self._char.force_box()
- op = ResOperation(rop.STRSETITEM,
- [box, ConstInt(0), charbox], None)
+ for i in range(len(self._chars)):
+ charbox = self._chars[i].force_box()
+ op = ResOperation(rop.STRSETITEM,
+ [box, ConstInt(i), charbox], None)
newoperations.append(op)
def get_args_for_fail(self, modifier):
if self.box is None and not modifier.already_seen_virtual(self.keybox):
- charboxes = [self._char.get_key_box()]
+ charboxes = [box.get_key_box() for box in self._chars]
modifier.register_virtual_fields(self.keybox, charboxes)
- self._char.get_args_for_fail(modifier)
+ for box in self._chars:
+ box.get_args_for_fail(modifier)
def _make_virtual(self, modifier):
- return modifier.make_vstring()
+ return modifier.make_vstrconcat()
class __extend__(SpecNode):
def setup_virtual_node(self, optimizer, box, newinputargs):
@@ -313,8 +320,8 @@
self.make_equal_to(box, vvalue)
return vvalue
- def make_vstring_length1(self, box, source_op=None):
- vvalue = VStringLength1Value(self.optimizer, box, source_op)
+ def make_vstring_plain(self, length, box, source_op=None):
+ vvalue = VStringPlainValue(self.optimizer, length, box, source_op)
self.make_equal_to(box, vvalue)
return vvalue
@@ -457,12 +464,25 @@
###self.heap_op_optimizer.optimize_SETARRAYITEM_GC(op, value, fieldvalue)
self.emit_operation(op)
- def optimize_ARRAYCOPY(self, op):
- source_value = self.getvalue(op.args[2])
- dest_value = self.getvalue(op.args[3])
- source_start_box = self.get_constant_box(op.args[4])
- dest_start_box = self.get_constant_box(op.args[5])
- length = self.get_constant_box(op.args[6])
+ def optimize_CALL(self, op):
+ # dispatch based on 'oopspecindex' to a method that handles
+ # specifically the given oopspec call. For non-oopspec calls,
+ # oopspecindex is just zero.
+ effectinfo = op.descr.get_extra_info()
+ if effectinfo is not None:
+ oopspecindex = effectinfo.oopspecindex
+ for value, meth in opt_call_oopspec_ops:
+ if oopspecindex == value:
+ if meth(self, op):
+ return
+ self.emit_operation(op)
+
+ def opt_call_oopspec_ARRAYCOPY(self, op):
+ source_value = self.getvalue(op.args[1])
+ dest_value = self.getvalue(op.args[2])
+ source_start_box = self.get_constant_box(op.args[3])
+ dest_start_box = self.get_constant_box(op.args[4])
+ length = self.get_constant_box(op.args[5])
if (source_value.is_virtual() and source_start_box and dest_start_box
and length and dest_value.is_virtual()):
# XXX optimize the case where dest value is not virtual,
@@ -472,48 +492,47 @@
for index in range(length.getint()):
val = source_value.getitem(index + source_start)
dest_value.setitem(index + dest_start, val)
- return
+ return True
if length and length.getint() == 0:
- return # 0-length arraycopy
- descr = op.args[0]
- assert isinstance(descr, AbstractDescr)
- self.emit_operation(ResOperation(rop.CALL, op.args[1:], op.result,
- descr))
+ return True # 0-length arraycopy
+ return False
def optimize_NEWSTR(self, op):
length_box = self.get_constant_box(op.args[0])
- if length_box and length_box.getint() == 1: # NEWSTR(1)
+ if length_box:
# if the original 'op' did not have a ConstInt as argument,
# build a new one with the ConstInt argument
if not isinstance(op.args[0], ConstInt):
- op = ResOperation(rop.NEWSTR, [CONST_1], op.result)
- self.make_vstring_length1(op.result, op)
+ op = ResOperation(rop.NEWSTR, [length_box], op.result)
+ self.make_vstring_plain(length_box.getint(), op.result, op)
else:
self.emit_operation(op)
def optimize_STRSETITEM(self, op):
value = self.getvalue(op.args[0])
- if value.is_virtual():
- charvalue = self.getvalue(op.args[2])
- value.setchar(charvalue)
- else:
- value.ensure_nonnull()
- self.emit_operation(op)
+ if value.is_virtual() and isinstance(value, VStringPlainValue):
+ indexbox = self.get_constant_box(op.args[1])
+ if indexbox is not None:
+ value.setitem(indexbox.getint(), self.getvalue(op.args[2]))
+ return
+ value.ensure_nonnull()
+ self.emit_operation(op)
def optimize_STRGETITEM(self, op):
value = self.getvalue(op.args[0])
- if value.is_virtual():
- charvalue = value.getchar()
- assert charvalue is not None
- self.make_equal_to(op.result, charvalue)
- else:
- value.ensure_nonnull()
- self.emit_operation(op)
+ if value.is_virtual() and isinstance(value, VStringPlainValue):
+ indexbox = self.get_constant_box(op.args[1])
+ if indexbox is not None:
+ charvalue = value.getitem(indexbox.getint())
+ self.make_equal_to(op.result, charvalue)
+ return
+ value.ensure_nonnull()
+ self.emit_operation(op)
def optimize_STRLEN(self, op):
value = self.getvalue(op.args[0])
if value.is_virtual():
- self.make_constant_int(op.result, 1)
+ self.make_constant_int(op.result, value.getlength())
else:
value.ensure_nonnull()
self.emit_operation(op)
@@ -528,3 +547,14 @@
self.emit_operation(op)
optimize_ops = _findall(OptVirtualize, 'optimize_')
+
+def _findall_call_oopspec():
+ prefix = 'opt_call_oopspec_'
+ result = []
+ for name in dir(OptVirtualize):
+ if name.startswith(prefix):
+ value = getattr(EffectInfo, 'OS_' + name[len(prefix):])
+ assert isinstance(value, int) and value != 0
+ result.append((value, getattr(OptVirtualize, name)))
+ return unrolling_iterable(result)
+opt_call_oopspec_ops = _findall_call_oopspec()
Modified: pypy/branch/jit-str/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/pyjitpl.py Wed Sep 22 16:02:56 2010
@@ -421,14 +421,6 @@
def opimpl_arraylen_gc(self, arraybox, arraydescr):
return self.execute_with_descr(rop.ARRAYLEN_GC, arraydescr, arraybox)
- @arguments("descr", "box", "box", "box", "box", "box", "box", "descr")
- def opimpl_arraycopy(self, calldescr, fnptr, sourcebox, destbox,
- source_startbox, dest_startbox, lengthbox,
- arraydescr):
- self.execute_with_descr(rop.ARRAYCOPY, arraydescr, calldescr, fnptr,
- sourcebox, destbox, source_startbox,
- dest_startbox, lengthbox)
-
@arguments("orgpc", "box", "descr", "box")
def opimpl_check_neg_index(self, orgpc, arraybox, arraydescr, indexbox):
negbox = self.metainterp.execute_and_record(
Modified: pypy/branch/jit-str/pypy/jit/metainterp/resoperation.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/resoperation.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/resoperation.py Wed Sep 22 16:02:56 2010
@@ -213,7 +213,6 @@
'SETARRAYITEM_RAW/3d',
'SETFIELD_GC/2d',
'SETFIELD_RAW/2d',
- 'ARRAYCOPY/7d', # removed before it's passed to the backend
'NEWSTR/1',
'STRSETITEM/3',
'UNICODESETITEM/3',
Modified: pypy/branch/jit-str/pypy/jit/metainterp/resume.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/resume.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/resume.py Wed Sep 22 16:02:56 2010
@@ -253,8 +253,8 @@
def make_varray(self, arraydescr):
return VArrayInfo(arraydescr)
- def make_vstring(self):
- return VStringInfo()
+ def make_vstrconcat(self):
+ return VStrConcatInfo()
def register_virtual_fields(self, virtualbox, fieldboxes):
tagged = self.liveboxes_from_env.get(virtualbox, UNASSIGNEDVIRTUAL)
@@ -489,7 +489,11 @@
for i in self.fieldnums:
debug_print("\t\t", str(untag(i)))
-class VStringInfo(AbstractVirtualInfo):
+class VStrConcatInfo(AbstractVirtualInfo):
+ """Stands for the string made out of the concatenation of all
+ fieldnums. Each fieldnum can be an integer (the ord() of a single
+ character) or a pointer (another string). XXX only integers implemented
+ """
def __init__(self):
pass
#self.fieldnums = ...
Modified: pypy/branch/jit-str/pypy/jit/metainterp/simple_optimize.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/simple_optimize.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/simple_optimize.py Wed Sep 22 16:02:56 2010
@@ -9,14 +9,12 @@
def transform(op):
from pypy.jit.metainterp.history import AbstractDescr
- # change ARRAYCOPY to call, so we don't have to pass around
- # unnecessary information to the backend. Do the same with VIRTUAL_REF_*.
- if op.opnum == rop.ARRAYCOPY:
- descr = op.args[0]
- assert isinstance(descr, AbstractDescr)
- op = ResOperation(rop.CALL, op.args[1:], op.result, descr=descr)
- elif op.opnum == rop.CALL_PURE:
+ # Rename CALL_PURE and CALL_OOPSPEC to CALL.
+ # Simplify the VIRTUAL_REF_* so that they don't show up in the backend.
+ if op.opnum == rop.CALL_PURE:
op = ResOperation(rop.CALL, op.args[1:], op.result, op.descr)
+ elif op.opnum == rop.CALL_OOPSPEC:
+ op = ResOperation(rop.CALL, op.args[:], op.result, op.descr)
elif op.opnum == rop.VIRTUAL_REF:
op = ResOperation(rop.SAME_AS, [op.args[0]], op.result)
elif op.opnum == rop.VIRTUAL_REF_FINISH:
Modified: pypy/branch/jit-str/pypy/jit/metainterp/test/test_optimizefindnode.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/test/test_optimizefindnode.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/test/test_optimizefindnode.py Wed Sep 22 16:02:56 2010
@@ -115,6 +115,8 @@
mayforcevirtdescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
EffectInfo([nextdescr], [], [],
EffectInfo.EF_FORCES_VIRTUAL_OR_VIRTUALIZABLE))
+ arraycopydescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
+ EffectInfo([], [], [], oopspecindex=EffectInfo.OS_ARRAYCOPY))
class LoopToken(AbstractDescr):
pass
asmdescr = LoopToken() # it can be whatever, it's not a descr though
Modified: pypy/branch/jit-str/pypy/jit/metainterp/test/test_optimizeopt.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/test/test_optimizeopt.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/test/test_optimizeopt.py Wed Sep 22 16:02:56 2010
@@ -3080,7 +3080,7 @@
setarrayitem_gc(p1, 1, 1, descr=arraydescr)
p2 = new_array(3, descr=arraydescr)
setarrayitem_gc(p2, 1, 3, descr=arraydescr)
- arraycopy(0, 0, p1, p2, 1, 1, 2, descr=arraydescr)
+ call(0, p1, p2, 1, 1, 2, descr=arraycopydescr)
i2 = getarrayitem_gc(p2, 1, descr=arraydescr)
jump(i2)
'''
@@ -3097,7 +3097,7 @@
p2 = new_array(3, descr=arraydescr)
setarrayitem_gc(p1, 0, i0, descr=arraydescr)
setarrayitem_gc(p2, 0, 3, descr=arraydescr)
- arraycopy(0, 0, p1, p2, 1, 1, 2, descr=arraydescr)
+ call(0, p1, p2, 1, 1, 2, descr=arraycopydescr)
i2 = getarrayitem_gc(p2, 0, descr=arraydescr)
jump(i2)
'''
@@ -3114,7 +3114,7 @@
p2 = new_array(3, descr=arraydescr)
setarrayitem_gc(p1, 2, 10, descr=arraydescr)
setarrayitem_gc(p2, 2, 13, descr=arraydescr)
- arraycopy(0, 0, p1, p2, 0, 0, 3, descr=arraydescr)
+ call(0, p1, p2, 0, 0, 3, descr=arraycopydescr)
jump(p2)
'''
expected = '''
@@ -3131,7 +3131,7 @@
ops = '''
[p1]
p0 = new_array(0, descr=arraydescr)
- arraycopy(0, 0, p0, p1, 0, 0, 0, descr=arraydescr)
+ call(0, p0, p1, 0, 0, 0, descr=arraycopydescr)
jump(p1)
'''
expected = '''
Modified: pypy/branch/jit-str/pypy/jit/metainterp/test/test_string.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/metainterp/test/test_string.py (original)
+++ pypy/branch/jit-str/pypy/jit/metainterp/test/test_string.py Wed Sep 22 16:02:56 2010
@@ -155,19 +155,23 @@
def test_strconcat_pure(self):
for dochr in [chr, ]: #unichr]:
+ jitdriver = JitDriver(greens = [], reds = ['m', 'n'])
@dont_look_inside
def escape(x):
pass
def f(n, m):
- s = dochr(n) + dochr(m)
- if not we_are_jitted():
- escape(s)
+ while m >= 0:
+ jitdriver.can_enter_jit(m=m, n=n)
+ jitdriver.jit_merge_point(m=m, n=n)
+ s = dochr(n) + dochr(m)
+ if m > 100:
+ escape(s)
+ m -= 1
return 42
- self.interp_operations(f, [65, 66])
- py.test.xfail()
- self.check_operations_history(newstr=0, strsetitem=0,
- newunicode=0, unicodesetitem=0,
- call=0, call_pure=0)
+ self.meta_interp(f, [6, 7])
+ self.check_loops(newstr=0, strsetitem=0,
+ newunicode=0, unicodesetitem=0,
+ call=0, call_pure=0)
class TestOOtype(StringTests, OOJitMixin):
More information about the Pypy-commit
mailing list