[pypy-commit] pypy continulet-jit-3: Consistently expect a JITFRAMEPTR and not a GCREF.

arigo noreply at buildbot.pypy.org
Sat Sep 29 06:31:51 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: continulet-jit-3
Changeset: r57654:22cce29a5095
Date: 2012-09-29 06:28 +0200
http://bitbucket.org/pypy/pypy/changeset/22cce29a5095/

Log:	Consistently expect a JITFRAMEPTR and not a GCREF.

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
@@ -16,8 +16,9 @@
 from pypy.rpython.llinterp import LLException
 from pypy.rpython.extregistry import ExtRegistryEntry
 
-from pypy.jit.metainterp import resoperation, jitframe
+from pypy.jit.metainterp import resoperation
 from pypy.jit.metainterp.resoperation import rop
+from pypy.jit.metainterp.jitframe import JITFRAMEPTR
 from pypy.jit.backend.llgraph import symbolic
 from pypy.jit.codewriter import longlong
 from pypy.jit.codewriter.effectinfo import EffectInfo
@@ -480,7 +481,7 @@
 
 class Frame(object):
     OPHANDLERS = [None] * (rop._LAST+1)
-    _TYPE = jitframe.JITFRAMEPTR.TO
+    _TYPE = JITFRAMEPTR.TO
 
     def __init__(self, cpu):
         self.verbose = False
@@ -1065,15 +1066,16 @@
             #
             # Emulate the fast path
             failindex = frame_descr_index(subframe)
+            realsubframe = lltype.cast_opaque_ptr(JITFRAMEPTR, subframe)
             if failindex == self.cpu.done_with_this_frame_int_v:
                 reset_vable(jd, vable)
-                return self.cpu.get_latest_value_int(subframe, 0)
+                return self.cpu.get_latest_value_int(realsubframe, 0)
             if failindex == self.cpu.done_with_this_frame_ref_v:
                 reset_vable(jd, vable)
-                return self.cpu.get_latest_value_ref(subframe, 0)
+                return self.cpu.get_latest_value_ref(realsubframe, 0)
             if failindex == self.cpu.done_with_this_frame_float_v:
                 reset_vable(jd, vable)
-                return self.cpu.get_latest_value_float(subframe, 0)
+                return self.cpu.get_latest_value_float(realsubframe, 0)
             if failindex == self.cpu.done_with_this_frame_void_v:
                 reset_vable(jd, vable)
                 return None
@@ -1081,7 +1083,7 @@
             assembler_helper_ptr = jd.assembler_helper_adr.ptr  # fish
             assembler_helper = assembler_helper_ptr._obj._callable
             try:
-                return assembler_helper(subframe, vable)
+                return assembler_helper(realsubframe, vable)
             except LLException, lle:
                 assert self._last_exception is None, "exception left behind"
                 self._last_exception = lle
@@ -1860,7 +1862,7 @@
 
 
 COMPILEDLOOP = lltype.Ptr(lltype.OpaqueType("CompiledLoop"))
-FRAME = jitframe.JITFRAMEPTR
+FRAME = JITFRAMEPTR
 #OOFRAME = lltype.Ptr(lltype.OpaqueType("OOFrame"))
 
 _TO_OPAQUE[CompiledLoop] = COMPILEDLOOP.TO
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
@@ -12,6 +12,7 @@
 from pypy.jit.metainterp.history import REF, INT, FLOAT, STRUCT
 from pypy.jit.metainterp.warmstate import unwrap
 from pypy.jit.metainterp.resoperation import rop
+from pypy.jit.metainterp.jitframe import JITFRAMEPTR
 from pypy.jit.backend import model
 from pypy.jit.backend.llgraph import llimpl, symbolic
 from pypy.jit.metainterp.typesystem import llhelper, oohelper
@@ -287,32 +288,39 @@
                     assert 0
             #
             jit_frame = self._execute_token(loop_token)
+            jit_frame = lltype.cast_opaque_ptr(JITFRAMEPTR, jit_frame)
             return jit_frame
         #
         return execute_token
 
     def get_latest_descr(self, jitframe):
+        assert lltype.typeOf(jitframe) == JITFRAMEPTR
         opaqueframe = lltype.cast_opaque_ptr(llmemory.GCREF, jitframe)
         fail_index = llimpl.frame_descr_index(opaqueframe)
         return self.get_fail_descr_from_number(fail_index)
 
     def get_latest_value_int(self, jitframe, index):
+        assert lltype.typeOf(jitframe) == JITFRAMEPTR
         opaqueframe = lltype.cast_opaque_ptr(llmemory.GCREF, jitframe)
         return llimpl.frame_int_getvalue(opaqueframe, index)
 
     def get_latest_value_ref(self, jitframe, index):
+        assert lltype.typeOf(jitframe) == JITFRAMEPTR
         opaqueframe = lltype.cast_opaque_ptr(llmemory.GCREF, jitframe)
         return llimpl.frame_ptr_getvalue(opaqueframe, index)
 
     def get_latest_value_float(self, jitframe, index):
+        assert lltype.typeOf(jitframe) == JITFRAMEPTR
         opaqueframe = lltype.cast_opaque_ptr(llmemory.GCREF, jitframe)
         return llimpl.frame_float_getvalue(opaqueframe, index)
 
     def get_latest_value_count(self, jitframe):
+        assert lltype.typeOf(jitframe) == JITFRAMEPTR
         opaqueframe = lltype.cast_opaque_ptr(llmemory.GCREF, jitframe)
         return llimpl.frame_get_value_count(opaqueframe)
 
     def grab_exc_value(self, jitframe):
+        assert lltype.typeOf(jitframe) == JITFRAMEPTR
         opaqueframe = lltype.cast_opaque_ptr(llmemory.GCREF, jitframe)
         return llimpl.grab_exc_value(opaqueframe)
 
@@ -593,6 +601,7 @@
         return lltype.malloc(LOOP_RUN_CONTAINER, 0)
 
     def force(self, jitframe):
+        assert lltype.typeOf(jitframe) == JITFRAMEPTR
         opaqueframe = lltype.cast_opaque_ptr(llmemory.GCREF, jitframe)
         fail_index = llimpl.force(opaqueframe)
         return self.get_fail_descr_from_number(fail_index)
diff --git a/pypy/jit/backend/test/runner_test.py b/pypy/jit/backend/test/runner_test.py
--- a/pypy/jit/backend/test/runner_test.py
+++ b/pypy/jit/backend/test/runner_test.py
@@ -9,6 +9,7 @@
                                          ConstObj, BoxFloat, ConstFloat)
 from pypy.jit.metainterp.resoperation import ResOperation, rop
 from pypy.jit.metainterp.typesystem import deref
+from pypy.jit.metainterp.jitframe import JITFRAMEPTR
 from pypy.jit.codewriter.effectinfo import EffectInfo
 from pypy.jit.tool.oparser import parse
 from pypy.rpython.lltypesystem import lltype, llmemory, rstr, rffi, rclass
@@ -2192,6 +2193,7 @@
     def test_force_operations_returning_void(self):
         values = []
         def maybe_force(token, flag):
+            assert lltype.typeOf(token) == JITFRAMEPTR
             if flag:
                 descr = self.cpu.force(token)
                 values.append(descr)
@@ -2199,7 +2201,7 @@
                 values.append(self.cpu.get_latest_value_int(token, 1))
                 values.append(token)
 
-        FUNC = self.FuncType([llmemory.GCREF, lltype.Signed], lltype.Void)
+        FUNC = self.FuncType([JITFRAMEPTR, lltype.Signed], lltype.Void)
         func_ptr = llhelper(lltype.Ptr(FUNC), maybe_force)
         funcbox = self.get_funcbox(self.cpu, func_ptr).constbox()
         calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
@@ -2240,7 +2242,7 @@
                values.append(token)
             return 42
 
-        FUNC = self.FuncType([llmemory.GCREF, lltype.Signed], lltype.Signed)
+        FUNC = self.FuncType([JITFRAMEPTR, lltype.Signed], lltype.Signed)
         func_ptr = llhelper(lltype.Ptr(FUNC), maybe_force)
         funcbox = self.get_funcbox(self.cpu, func_ptr).constbox()
         calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
@@ -2285,7 +2287,7 @@
                values.append(token)
             return 42.5
 
-        FUNC = self.FuncType([llmemory.GCREF, lltype.Signed], lltype.Float)
+        FUNC = self.FuncType([JITFRAMEPTR, lltype.Signed], lltype.Float)
         func_ptr = llhelper(lltype.Ptr(FUNC), maybe_force)
         funcbox = self.get_funcbox(self.cpu, func_ptr).constbox()
         calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
@@ -2716,7 +2718,6 @@
         lltype.free(x, flavor='raw')
 
     def test_assembler_call(self):
-        from pypy.jit.metainterp.jitframe import JITFRAMEPTR
         called = []
         def assembler_helper(jitframe, virtualizable):
             assert self.cpu.get_latest_value_int(jitframe, 0) == 97
@@ -2790,7 +2791,6 @@
             del self.cpu.done_with_this_frame_int_v
 
     def test_assembler_call_float(self):
-        from pypy.jit.metainterp.jitframe import JITFRAMEPTR
         if not self.cpu.supports_floats:
             py.test.skip("requires floats")
         called = []
@@ -2887,7 +2887,6 @@
         lltype.free(a, flavor='raw')
 
     def test_redirect_call_assembler(self):
-        from pypy.jit.metainterp.jitframe import JITFRAMEPTR
         if not self.cpu.supports_floats:
             py.test.skip("requires floats")
         called = []
@@ -3665,7 +3664,7 @@
             values.append(token)
             return 42
 
-        FUNC = self.FuncType([llmemory.GCREF, lltype.Signed], lltype.Signed)
+        FUNC = self.FuncType([JITFRAMEPTR, lltype.Signed], lltype.Signed)
         func_ptr = llhelper(lltype.Ptr(FUNC), maybe_force)
         funcbox = self.get_funcbox(self.cpu, func_ptr).constbox()
         calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,


More information about the pypy-commit mailing list