[pypy-svn] r62327 - in pypy/branch/pyjitpl5/pypy/jit: backend/llgraph backend/x86 metainterp
arigo at codespeak.net
arigo at codespeak.net
Mon Mar 2 11:22:38 CET 2009
Author: arigo
Date: Mon Mar 2 11:22:36 2009
New Revision: 62327
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py
pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py
pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py
pypy/branch/pyjitpl5/pypy/jit/backend/x86/support.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py
Log:
Kill the ever_seen hack and replace it with another (but one-liner) hack.
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py Mon Mar 2 11:22:36 2009
@@ -68,8 +68,7 @@
llimpl.compile_add_int_const(c, x.value)
elif isinstance(x, history.ConstPtr):
llimpl.compile_add_ptr_const(c, x.value)
- elif (history.ConstAddr.ever_seen and
- isinstance(x, history.ConstAddr)):
+ elif isinstance(x, history.ConstAddr):
llimpl.compile_add_int_const(c, x.getint())
else:
raise Exception("%s args contain: %r" % (op.getopname(),
@@ -232,8 +231,7 @@
llimpl.frame_int_setvalue(frame, argindex, valuebox.value)
elif isinstance(valuebox, history.ConstPtr):
llimpl.frame_ptr_setvalue(frame, argindex, valuebox.value)
- elif (history.ConstAddr.ever_seen and
- isinstance(valuebox, history.ConstAddr)):
+ elif isinstance(valuebox, history.ConstAddr):
llimpl.frame_int_setvalue(frame, argindex, valuebox.getint())
else:
raise AssertionError('setvalue: valuebox = %s' % (valuebox,))
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py Mon Mar 2 11:22:36 2009
@@ -82,7 +82,7 @@
return imm(c.value)
elif isinstance(c, ConstPtr):
return imm(rffi.cast(lltype.Signed, c.value))
- elif ConstAddr.ever_seen and isinstance(c, ConstAddr):
+ elif isinstance(c, ConstAddr):
return imm(ll2ctypes.cast_adr_to_int(c.value))
else:
raise ValueError("convert_to_imm: got a %s" % c)
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py Mon Mar 2 11:22:36 2009
@@ -243,7 +243,7 @@
elif isinstance(box, ConstPtr):
self.keepalives.append(box.value)
return self.cast_gcref_to_int(box.value)
- elif ConstAddr.ever_seen and isinstance(box, ConstAddr):
+ elif isinstance(box, ConstAddr):
return self.cast_adr_to_int(box.value)
else:
raise ValueError('get_box_value_as_int, wrong arg')
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/support.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/support.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/support.py Mon Mar 2 11:22:36 2009
@@ -43,8 +43,6 @@
for arg in args:
assert isinstance(arg, int)
- ConstAddr.ever_seen = False
-
t = TranslationContext()
t.config.translation.gc = 'boehm'
src = py.code.Source("""
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py Mon Mar 2 11:22:36 2009
@@ -86,6 +86,8 @@
graph = self.unfinished_graphs.pop()
self.make_one_bytecode(graph, False)
log.info("there are %d JitCode instances." % len(self.all_graphs))
+ # xxx annotation hack: make sure there is at least one ConstAddr around
+ jitcode.constants.append(history.ConstAddr(llmemory.NULL, self.cpu))
return jitcode
def make_one_bytecode(self, graph, portal):
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py Mon Mar 2 11:22:36 2009
@@ -148,11 +148,9 @@
class ConstAddr(Const): # only for constants built before translation
type = 'int'
- ever_seen = False
def __init__(self, adrvalue, cpu):
"NOT_RPYTHON"
- self.__class__.ever_seen = True
assert not we_are_translated()
if isinstance(lltype.typeOf(adrvalue), lltype.Ptr):
adrvalue = llmemory.cast_ptr_to_adr(adrvalue) # convenience
More information about the Pypy-commit
mailing list