Commits

Maciej Fijalkowski committed 9a2f46a

fix fix fix

Comments (0)

Files changed (3)

pypy/jit/backend/llsupport/llmodel.py

 from pypy.rpython.lltypesystem import lltype, llmemory, rffi, rclass, rstr
 from pypy.rpython.lltypesystem.lloperation import llop
 from pypy.rpython.llinterp import LLInterpreter
-from pypy.rpython.annlowlevel import llhelper, cast_instance_to_base_ptr
+from pypy.rpython.annlowlevel import llhelper, cast_instance_to_base_ptr,\
+     cast_instance_to_gcref
 from pypy.rlib.objectmodel import we_are_translated, specialize
 from pypy.jit.metainterp import history
 from pypy.jit.codewriter import heaptracker, longlong
         descr = deadframe.jf_descr
         return history.AbstractDescr.show(self, descr)
 
+    def store_fail_descr(self, deadframe, failindex):
+        faildescr = self.get_fail_descr_from_number(failindex)
+        frame = lltype.cast_opaque_ptr(jitframe.JITFRAMEPTR, deadframe)
+        frame.jf_descr = cast_instance_to_gcref(faildescr)
+
     def _decode_pos(self, deadframe, index):
         descr = self.get_latest_descr(deadframe)
         if descr.final_descr:

pypy/jit/backend/test/runner_test.py

     def test_assembler_call(self):
         called = []
         def assembler_helper(failindex, deadframe, virtualizable):
-            faildescr = self.cpu.get_fail_descr_from_number(failindex)
-            frame = lltype.cast_opaque_ptr(jitframe.JITFRAMEPTR, deadframe)
-            frame.jf_descr = cast_instance_to_gcref(faildescr)
+            self.cpu.store_fail_descr(deadframe, failindex)
             assert self.cpu.get_int_value(deadframe, 0) == 97
             called.append(self.cpu.get_latest_descr(deadframe))
             return 4 + 9
             py.test.skip("requires floats")
         called = []
         def assembler_helper(failindex, deadframe, virtualizable):
-            frame = lltype.cast_opaque_ptr(jitframe.JITFRAMEPTR, deadframe)
-            faildescr = self.cpu.get_fail_descr_from_number(failindex)
-            frame.jf_descr = cast_instance_to_gcref(faildescr)
+            self.cpu.store_fail_descr(deadframe, failindex)
             x = self.cpu.get_float_value(deadframe, 0)
             assert longlong.getrealfloat(x) == 1.2 + 3.2
             called.append(self.cpu.get_latest_descr(deadframe))
         if not self.cpu.supports_floats:
             py.test.skip("requires floats")
         called = []
-        def assembler_helper(deadframe, virtualizable):
+        def assembler_helper(failindex, deadframe, virtualizable):
+            self.cpu.store_fail_descr(deadframe, failindex)
             x = self.cpu.get_float_value(deadframe, 0)
             assert longlong.getrealfloat(x) == 1.25 + 3.25
             called.append(self.cpu.get_latest_descr(deadframe))
             return 13.5
 
-        FUNCPTR = lltype.Ptr(lltype.FuncType([llmemory.GCREF, llmemory.GCREF],
+        FUNCPTR = lltype.Ptr(lltype.FuncType([lltype.Signed,
+                                              llmemory.GCREF, llmemory.GCREF],
                                              lltype.Float))
         class FakeJitDriverSD:
             index_of_virtualizable = -1

pypy/jit/backend/x86/assembler.py

         self.patch_jump_for_descr(faildescr, rawstart)
         ops_offset = self.mc.ops_offset
         self.fixup_target_tokens(rawstart)
-        frame_depth = max(self.current_clt.frame_depth,
+        frame_depth = max(self.current_clt.frame_info.jfi_frame_depth,
                           frame_depth + JITFRAME_FIXED_SIZE)
         self.current_clt.frame_info.jfi_frame_depth = frame_depth
         self.teardown()
         frame_depth = regalloc.get_final_frame_depth()
         jump_target_descr = regalloc.jump_target_descr
         if jump_target_descr is not None:
-            target_frame_depth = jump_target_descr._x86_clt.frame_info.frame_depth
+            target_frame_depth = jump_target_descr._x86_clt.frame_info.jfi_frame_depth
             frame_depth = max(frame_depth, target_frame_depth)
         return frame_depth
 
             self.mc.SUB_mi8((ebx.value, 0), 2*WORD)  # SUB [ebx], 2*WORD
 
     def redirect_call_assembler(self, oldlooptoken, newlooptoken):
-        xxx
         # some minimal sanity checking
         old_nbargs = oldlooptoken.compiled_loop_token._debug_nbargs
         new_nbargs = newlooptoken.compiled_loop_token._debug_nbargs