[pypy-commit] pypy oparser-mock-model: add minimal support for Const* in the mock model, enough to make tests passing
antocuni
noreply at buildbot.pypy.org
Thu Jun 9 13:37:30 CEST 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: oparser-mock-model
Changeset: r44859:e2ea2d79e9d1
Date: 2011-06-09 12:03 +0200
http://bitbucket.org/pypy/pypy/changeset/e2ea2d79e9d1/
Log: add minimal support for Const* in the mock model, enough to make
tests passing
diff --git a/pypy/jit/tool/oparser_model.py b/pypy/jit/tool/oparser_model.py
--- a/pypy/jit/tool/oparser_model.py
+++ b/pypy/jit/tool/oparser_model.py
@@ -44,6 +44,19 @@
class BoxRef(Box):
type = 'p'
+ class Const(object):
+ def __init__(self, value=None):
+ self.value = value
+
+ class ConstInt(Const):
+ pass
+
+ class ConstPtr(Const):
+ pass
+
+ class ConstFloat(Const):
+ pass
+
class llhelper(object):
pass
diff --git a/pypy/jit/tool/test/test_oparser.py b/pypy/jit/tool/test/test_oparser.py
--- a/pypy/jit/tool/test/test_oparser.py
+++ b/pypy/jit/tool/test/test_oparser.py
@@ -3,8 +3,7 @@
from pypy.jit.tool.oparser import parse, OpParser
from pypy.jit.metainterp.resoperation import rop
-from pypy.jit.metainterp.history import AbstractDescr, BoxInt, LoopToken,\
- BoxFloat
+from pypy.jit.metainterp.history import AbstractDescr, BoxInt, LoopToken
class BaseTestOparser(object):
@@ -136,7 +135,10 @@
f1 = float_add(f0, 3.5)
'''
loop = self.parse(x)
- assert isinstance(loop.operations[0].getarg(0), BoxFloat)
+ box = loop.operations[0].getarg(0)
+ # we cannot use isinstance, because in case of mock the class will be
+ # constructed on the fly
+ assert box.__class__.__name__ == 'BoxFloat'
def test_debug_merge_point(self):
x = '''
More information about the pypy-commit
mailing list