[pypy-commit] pypy continulet-jit-3: (fijal around, arigo)

arigo noreply at buildbot.pypy.org
Sat Oct 13 18:52:34 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: continulet-jit-3
Changeset: r58106:ee9cdf23f0a6
Date: 2012-10-13 18:52 +0200
http://bitbucket.org/pypy/pypy/changeset/ee9cdf23f0a6/

Log:	(fijal around, arigo)

	Fixes to the llgraph backend and to tests.

diff --git a/pypy/jit/backend/llgraph/llimpl.py b/pypy/jit/backend/llgraph/llimpl.py
--- a/pypy/jit/backend/llgraph/llimpl.py
+++ b/pypy/jit/backend/llgraph/llimpl.py
@@ -488,6 +488,7 @@
         self._forced = False
         self._may_force = -1
         self._last_exception = None
+        self._finish_value = None
 
     def getenv(self, v):
         from pypy.jit.backend.llgraph.runner import Descr
@@ -516,6 +517,7 @@
         possibly following to other loops as well.
         """
         assert self._may_force == -1
+        assert self._finish_value is None
         assert self._last_exception is None, "exception left behind"
         verbose = True
         self.opindex = 0
@@ -578,7 +580,10 @@
                     log.trace('finished: %s' % (
                         ', '.join(map(str, args)),))
                 assert len(op.args) <= 1, "FINISH with more than 1 arg"
-                self.finish_args = op.args
+                if len(op.args) == 1:
+                    self._finish_value = self.getenv(op.args[0])
+                else:
+                    self._finish_value = "finished, and got no argument"
                 self.fail_args = op.fail_args
                 self.fail_index = op.fail_index
                 self._may_force = self.opindex
@@ -1354,14 +1359,30 @@
     frame = _from_opaque(frame)
     return len(frame.fail_args)
 
-def grab_exc_value(frame):
+def finish_value_int(frame):
     frame = _from_opaque(frame)
-    if frame._last_exception is not None:
-        result = frame._last_exception.args[1]
-        frame._last_exception = None
-        return lltype.cast_opaque_ptr(llmemory.GCREF, result)
-    else:
-        return lltype.nullptr(llmemory.GCREF.TO)
+    x = frame._finish_value
+    assert isinstance(x, int)
+    return x
+
+def finish_value_float(frame):
+    frame = _from_opaque(frame)
+    x = frame._finish_value
+    assert lltype.typeOf(x) is longlong.FLOATSTORAGE
+    return x
+
+def finish_value_ref(frame):
+    frame = _from_opaque(frame)
+    x = frame._finish_value
+    if x is None:
+        if frame._last_exception is not None:
+            result = frame._last_exception.args[1]
+            frame._last_exception = None
+            return lltype.cast_opaque_ptr(llmemory.GCREF, result)
+        else:
+            return lltype.nullptr(llmemory.GCREF.TO)
+    assert lltype.typeOf(x) == llmemory.GCREF
+    return x
 
 ##_pseudo_exceptions = {}
 
@@ -1919,7 +1940,9 @@
 setannotation(frame_float_getvalue, s_FloatStorage)
 setannotation(frame_get_value_count, annmodel.SomeInteger())
  
-setannotation(grab_exc_value, annmodel.SomePtr(llmemory.GCREF))
+setannotation(finish_value_int,   annmodel.SomeInteger())
+setannotation(finish_value_float, s_FloatStorage)
+setannotation(finish_value_ref,   annmodel.SomePtr(llmemory.GCREF))
 setannotation(force, annmodel.SomeInteger())
 
 setannotation(do_arraylen_gc, annmodel.SomeInteger())
diff --git a/pypy/jit/backend/llgraph/runner.py b/pypy/jit/backend/llgraph/runner.py
--- a/pypy/jit/backend/llgraph/runner.py
+++ b/pypy/jit/backend/llgraph/runner.py
@@ -309,9 +309,17 @@
         assert lltype.typeOf(jitframe) == llmemory.GCREF
         return llimpl.frame_get_value_count(jitframe)
 
-    def grab_exc_value(self, jitframe):
+    def get_finish_value_int(self, jitframe):
         assert lltype.typeOf(jitframe) == llmemory.GCREF
-        return llimpl.grab_exc_value(jitframe)
+        return llimpl.finish_value_int(jitframe)
+
+    def get_finish_value_float(self, jitframe):
+        assert lltype.typeOf(jitframe) == llmemory.GCREF
+        return llimpl.finish_value_float(jitframe)
+
+    def get_finish_value_ref(self, jitframe):
+        assert lltype.typeOf(jitframe) == llmemory.GCREF
+        return llimpl.finish_value_ref(jitframe)
 
     def redirect_call_assembler(self, oldlooptoken, newlooptoken):
         if we_are_translated():
diff --git a/pypy/jit/metainterp/test/support.py b/pypy/jit/metainterp/test/support.py
--- a/pypy/jit/metainterp/test/support.py
+++ b/pypy/jit/metainterp/test/support.py
@@ -145,11 +145,11 @@
     faildescr = cpu.get_latest_descr(frame)
     assert faildescr.__class__.__name__.startswith('DoneWithThisFrameDescr')
     if metainterp.jitdriver_sd.result_type == history.INT:
-        return cpu.get_latest_value_int(frame, 0)
+        return cpu.get_finish_value_int(frame)
     elif metainterp.jitdriver_sd.result_type == history.REF:
-        return cpu.get_latest_value_ref(frame, 0)
+        return cpu.get_finish_value_ref(frame)
     elif metainterp.jitdriver_sd.result_type == history.FLOAT:
-        return cpu.get_latest_value_float(frame, 0)
+        return cpu.get_finish_value_float(frame)
     else:
         return None
 
diff --git a/pypy/jit/metainterp/test/test_virtualizable.py b/pypy/jit/metainterp/test/test_virtualizable.py
--- a/pypy/jit/metainterp/test/test_virtualizable.py
+++ b/pypy/jit/metainterp/test/test_virtualizable.py
@@ -306,6 +306,7 @@
             while m > 0:
                 g(xy2, n)
                 m -= 1
+            promote_virtualizable(xy2, 'inst_l2')
             return xy2.inst_l2[0]
         assert f(18) == 10360
         res = self.meta_interp(f, [18])
@@ -452,6 +453,7 @@
             while m > 0:
                 g(xy2, n)
                 m -= 1
+            promote_virtualizable(xy2.parent, 'inst_l2')
             return xy2.parent.inst_l2[0]
         assert f(18) == 10360
         res = self.meta_interp(f, [18])


More information about the pypy-commit mailing list