[pypy-svn] r62639 - pypy/branch/pyjitpl5/pypy/jit/metainterp
arigo at codespeak.net
arigo at codespeak.net
Fri Mar 6 13:52:43 CET 2009
Author: arigo
Date: Fri Mar 6 13:52:42 2009
New Revision: 62639
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
Log:
Use the new executor module (only from one place so far, more to follow).
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 Fri Mar 6 13:52:42 2009
@@ -67,6 +67,9 @@
def constbox(self):
raise NotImplementedError
+ def nonconstbox(self):
+ raise NotImplementedError
+
def getaddr(self, cpu):
raise NotImplementedError
@@ -128,6 +131,8 @@
def clonebox(self):
return BoxInt(self.value)
+ nonconstbox = clonebox
+
def getint(self):
return self.value
@@ -162,6 +167,8 @@
def clonebox(self):
return BoxInt(self.cpu.cast_adr_to_int(self.value))
+ nonconstbox = clonebox
+
def getint(self):
return self.cpu.cast_adr_to_int(self.value)
@@ -187,6 +194,8 @@
def clonebox(self):
return BoxPtr(self.value)
+ nonconstbox = clonebox
+
def getptr_base(self):
return self.value
@@ -219,6 +228,9 @@
def equals(self, other):
return self is other
+ def nonconstbox(self):
+ return self
+
def __repr__(self):
result = str(self)
if self._extended_display:
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py Fri Mar 6 13:52:42 2009
@@ -15,6 +15,7 @@
from pypy.jit.metainterp.heaptracker import (get_vtable_for_gcstruct,
populate_type_cache)
from pypy.jit.metainterp import codewriter, optimize
+from pypy.jit.metainterp.executor import get_execute_function
from pypy.rlib.rarithmetic import intmask
# ____________________________________________________________
@@ -776,16 +777,20 @@
def execute_and_record(self, opnum, argboxes, result_type):
# execute the operation first
- resbox = self.cpu.execute_operation(opnum, argboxes, result_type)
+ func = get_execute_function(self.cpu, opnum)
+ resbox = func(self.cpu, argboxes)
# check if the operation can be constant-folded away
canfold = False
if rop._ALWAYS_PURE_FIRST <= opnum <= rop._ALWAYS_PURE_LAST:
# this part disappears if execute() is specialized for an
# opnum that is not within the range
- assert resbox is not None
canfold = self._all_constants(argboxes)
if canfold:
- resbox = resbox.constbox()
+ resbox = resbox.constbox() # ensure it is a Const
+ else:
+ resbox = resbox.nonconstbox() # ensure it is a Box
+ else:
+ assert resbox is None or isinstance(resbox, Box)
# record the operation if not constant-folded away
if not canfold:
self.history.record(opnum, argboxes, resbox)
More information about the Pypy-commit
mailing list