Author: Maciej Fijalkowski <[email protected]>
Branch: fast-slowpath
Changeset: r65458:f8d06bf178e9
Date: 2013-07-18 12:39 +0200
http://bitbucket.org/pypy/pypy/changeset/f8d06bf178e9/
Log: start hacking on list_resize_ge
diff --git a/rpython/jit/backend/llsupport/rewrite.py
b/rpython/jit/backend/llsupport/rewrite.py
--- a/rpython/jit/backend/llsupport/rewrite.py
+++ b/rpython/jit/backend/llsupport/rewrite.py
@@ -1,9 +1,10 @@
from rpython.rlib.rarithmetic import ovfcheck
-from rpython.rtyper.lltypesystem import lltype, llmemory
+from rpython.rtyper.lltypesystem import llmemory
from rpython.jit.metainterp import history
from rpython.jit.metainterp.history import ConstInt, BoxPtr, ConstPtr
from rpython.jit.metainterp.resoperation import ResOperation, rop
from rpython.jit.codewriter import heaptracker
+from rpython.jit.codewriter.effectinfo import EffectInfo
from rpython.jit.backend.llsupport.symbolic import WORD
from rpython.jit.backend.llsupport.descr import SizeDescr, ArrayDescr
from rpython.jit.metainterp.history import JitCellToken
@@ -78,6 +79,11 @@
if op.getopnum() == rop.CALL_ASSEMBLER:
self.handle_call_assembler(op)
continue
+ if op.getopnum() == rop.CALL:
+ idx = op.getdescr().get_extra_info().oopspecindex
+ if idx == EffectInfo.OS_LIST_RESIZE_GE:
+ self.handle_list_resize_ge(op)
+ continue
#
self.newops.append(op)
return self.newops
@@ -118,6 +124,12 @@
else:
self.gen_malloc_fixedsize(size, descr.tid, op.result)
+ def handle_list_resize_ge(self, op):
+ """ what we want to do is to check the length and than add a
conditional
+ call to really resize
+ """
+ xxx
+
def handle_new_array(self, arraydescr, op, kind=FLAG_ARRAY):
v_length = op.getarg(0)
total_size = -1
diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py
b/rpython/jit/backend/llsupport/test/test_rewrite.py
--- a/rpython/jit/backend/llsupport/test/test_rewrite.py
+++ b/rpython/jit/backend/llsupport/test/test_rewrite.py
@@ -773,3 +773,6 @@
setarrayitem_gc(p1, 1, f0, descr=floatframedescr)
i3 = call_assembler(p1, descr=casmdescr)
""")
+
+ def test_rewrite_list_resize_ge(self):
+ pass
diff --git a/rpython/jit/codewriter/effectinfo.py
b/rpython/jit/codewriter/effectinfo.py
--- a/rpython/jit/codewriter/effectinfo.py
+++ b/rpython/jit/codewriter/effectinfo.py
@@ -85,10 +85,14 @@
OS_JIT_FORCE_VIRTUAL = 120
+ OS_LIST_RESIZE_GE = 130
+ OS_LIST_RESIZE_LE = 130
+
# for debugging:
_OS_CANRAISE = set([
OS_NONE, OS_STR2UNICODE, OS_LIBFFI_CALL, OS_RAW_MALLOC_VARSIZE_CHAR,
- OS_JIT_FORCE_VIRTUAL, OS_SHRINK_ARRAY,
+ OS_JIT_FORCE_VIRTUAL, OS_SHRINK_ARRAY, OS_LIST_RESIZE_GE,
+ OS_LIST_RESIZE_LE,
])
def __new__(cls, readonly_descrs_fields, readonly_descrs_arrays,
diff --git a/rpython/jit/codewriter/jtransform.py
b/rpython/jit/codewriter/jtransform.py
--- a/rpython/jit/codewriter/jtransform.py
+++ b/rpython/jit/codewriter/jtransform.py
@@ -359,11 +359,12 @@
else: raise AssertionError(kind)
lst.append(v)
- def handle_residual_call(self, op, extraargs=[], may_call_jitcodes=False):
+ def handle_residual_call(self, op, extraargs=[], may_call_jitcodes=False,
+ oopspecindex=EffectInfo.OS_NONE):
"""A direct_call turns into the operation 'residual_call_xxx' if it
is calling a function that we don't want to JIT. The initial args
of 'residual_call_xxx' are the function to call, and its calldescr."""
- calldescr = self.callcontrol.getcalldescr(op)
+ calldescr = self.callcontrol.getcalldescr(op,
oopspecindex=oopspecindex)
op1 = self.rewrite_call(op, 'residual_call',
[op.args[0]] + extraargs, calldescr=calldescr)
if may_call_jitcodes or self.callcontrol.calldescr_canraise(calldescr):
@@ -1616,6 +1617,15 @@
do_resizable_void_list_getitem_foldable = do_resizable_void_list_getitem
do_resizable_void_list_setitem = do_resizable_void_list_getitem
+ def do_resizable_list__resize_ge(self, op, args, *descrs):
+ index = EffectInfo.OS_LIST_RESIZE_GE
+ op1 = self.handle_residual_call(op, oopspecindex=index)[0]
+ LIST = args[0].concretetype.TO
+ lengthdescr = self.cpu.fielddescrof(LIST, 'length')
+ arraydescr = self.cpu.arraydescrof(LIST.items.TO)
+ op1.args += [lengthdescr, arraydescr]
+ return [op1, SpaceOperation('-live-', [], None)]
+
# ----------
# Strings and Unicodes.
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit