[pypy-commit] pypy default: Translation fix

arigo noreply at buildbot.pypy.org
Wed Jul 24 16:29:12 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r65611:6f92256ff372
Date: 2013-07-24 16:28 +0200
http://bitbucket.org/pypy/pypy/changeset/6f92256ff372/

Log:	Translation fix

diff --git a/pypy/module/pypyjit/interp_resop.py b/pypy/module/pypyjit/interp_resop.py
--- a/pypy/module/pypyjit/interp_resop.py
+++ b/pypy/module/pypyjit/interp_resop.py
@@ -125,12 +125,10 @@
         self.llbox = llbox
 
     def descr_getint(self, space):
-        try:
-            value = jit_hooks.box_getint(self.llbox)
-        except NotImplementedError:
+        if not jit_hooks.box_isint(self.llbox):
             raise OperationError(space.w_NotImplementedError,
                                  space.wrap("Box has no int value"))
-        return space.wrap(value)
+        return space.wrap(jit_hooks.box_getint(self.llbox))
 
 @unwrap_spec(no=int)
 def descr_new_box(space, w_tp, no):
diff --git a/rpython/rlib/jit_hooks.py b/rpython/rlib/jit_hooks.py
--- a/rpython/rlib/jit_hooks.py
+++ b/rpython/rlib/jit_hooks.py
@@ -111,6 +111,11 @@
     from rpython.jit.metainterp.history import Const
     return isinstance(_cast_to_box(llbox), Const)
 
+ at register_helper(annmodel.SomeBool())
+def box_isint(llbox):
+    from rpython.jit.metainterp.history import INT
+    return _cast_to_box(llbox).type == INT
+
 # ------------------------- stats interface ---------------------------
 
 @register_helper(annmodel.SomeBool())


More information about the pypy-commit mailing list