[pypy-svn] r23338 - pypy/dist/pypy/jit
pedronis at codespeak.net
pedronis at codespeak.net
Tue Feb 14 17:39:13 CET 2006
Author: pedronis
Date: Tue Feb 14 17:39:11 2006
New Revision: 23338
Modified:
pypy/dist/pypy/jit/hintrtyper.py
pypy/dist/pypy/jit/rtimeshift.py
Log:
(arre, pedronis)
specialize retrieve on the type of the key argument (use a conversion through the rtyper
to its lowleveltype to get something usable as key)
Modified: pypy/dist/pypy/jit/hintrtyper.py
==============================================================================
--- pypy/dist/pypy/jit/hintrtyper.py (original)
+++ pypy/dist/pypy/jit/hintrtyper.py Tue Feb 14 17:39:11 2006
@@ -1,3 +1,4 @@
+from pypy.tool.sourcetools import valid_identifier
from pypy.annotation import model as annmodel
from pypy.annotation.pairtype import pair, pairtype
from pypy.rpython import annlowlevel
@@ -104,6 +105,9 @@
class MixLevelAnnotatorPolicy(annlowlevel.LowLevelAnnotatorPolicy):
+ def __init__(pol, rtyper):
+ pol.rtyper = rtyper
+
def default_specialize(pol, funcdesc, args_s):
name = funcdesc.name
if name.startswith('ll_') or name.startswith('_ll_'): # xxx can we do better?
@@ -111,7 +115,19 @@
else:
return funcdesc.cachedgraph(None)
- # TODO finer control specialisations for highlevel helpers ...
+ def arglltype(i):
+ def specialize_arglltype(pol, funcdesc, args_s):
+ key = pol.rtyper.getrepr(args_s[i]).lowleveltype
+ alt_name = funcdesc.name+"__for_%sLlT" % key._short_name()
+ return funcdesc.cachedgraph(key, alt_name=valid_identifier(alt_name))
+ return specialize_arglltype
+
+ specialize__arglltype0 = arglltype(0)
+ specialize__arglltype1 = arglltype(1)
+ specialize__arglltype2 = arglltype(2)
+
+ del arglltype
+
class HintLowLevelOpList(LowLevelOpList):
"""Warning: the HintLowLevelOpList's rtyper is the *original*
@@ -130,7 +146,7 @@
rtyper = self.rtyper
rtyper.call_all_setups() # compute ForwardReferences now
graph = rtyper.annotator.annotate_helper(function, args_s,
- policy=MixLevelAnnotatorPolicy()
+ policy=MixLevelAnnotatorPolicy(rtyper)
)
self.record_extra_call(graph) # xxx
Modified: pypy/dist/pypy/jit/rtimeshift.py
==============================================================================
--- pypy/dist/pypy/jit/rtimeshift.py (original)
+++ pypy/dist/pypy/jit/rtimeshift.py Tue Feb 14 17:39:11 2006
@@ -152,6 +152,7 @@
if not redboxes[0].isvar and redboxes[0].ll_getvalue(lltype.Signed) == 0:
redboxes[0] = redboxes[0]
return jitstate # XXX
+retrieve_jitstate_for_merge._annspecialcase_ = "specialize:arglltype2"
def ll_setup_jitstate():
More information about the Pypy-commit
mailing list