Author: Maciej Fijalkowski <[email protected]>
Branch: jitframe-on-heap
Changeset: r60082:bc9a7d2f84ff
Date: 2013-01-15 14:09 +0200
http://bitbucket.org/pypy/pypy/changeset/bc9a7d2f84ff/

Log:    fixes

diff --git a/pypy/jit/backend/llsupport/llmodel.py 
b/pypy/jit/backend/llsupport/llmodel.py
--- a/pypy/jit/backend/llsupport/llmodel.py
+++ b/pypy/jit/backend/llsupport/llmodel.py
@@ -56,10 +56,22 @@
                                              llmemory.GCREF))
 
         def realloc_frame(frame):
-            frame = lltype.cast_opaque_ptr(jitframe.JITFRAME, frame)
-            import pdb
-            pdb.set_trace()
-            return frame
+            frame = lltype.cast_opaque_ptr(jitframe.JITFRAMEPTR, frame)
+            frame_info = frame.jf_frame_info
+            new_frame = lltype.malloc(jitframe.JITFRAME,
+                                      frame_info.jfi_frame_depth)
+            new_frame.jf_frame_info = frame_info
+            # we need to do this, because we're not sure what things
+            # are GC pointers and which ones are not
+            llop.gc_writebarrier_before_copy(lltype.Bool, frame, new_frame,
+                                             0, 0, len(frame.jf_frame))
+            i = 0
+            while i < len(frame.jf_frame):
+                new_frame.jf_frame[i] = frame.jf_frame[i]
+                i += 1
+            new_frame.jf_savedata = frame.jf_savedata
+            # all other fields are empty
+            return lltype.cast_opaque_ptr(llmemory.GCREF, new_frame)
         
         f = llhelper(FUNC_TP, realloc_frame)
         self.realloc_frame = heaptracker.adr2int(llmemory.cast_ptr_to_adr(f))
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
@@ -3766,8 +3766,7 @@
                                     EffectInfo.MOST_GENERAL)
 
         def func2(a, b, c, d, e, f, g, h, i, j, k, l):
-            import pdb
-            pdb.set_trace()
+            pass
 
         FUNC2 = self.FuncType([lltype.Signed] * 12, lltype.Void)
         FPTR2 = self.Ptr(FUNC2)
@@ -3786,4 +3785,11 @@
         """, namespace=locals())
         self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken)
         frame = self.cpu.execute_token(looptoken, 0, 0, 3)
-        assert self.cpu.get_latest_descr(frame) is guarddescr
+        #assert self.cpu.get_latest_descr(frame) is guarddescr
+        from pypy.jit.backend.llsupport.llmodel import AbstractLLCPU
+
+        if not isinstance(self.cpu, AbstractLLCPU):
+            py.test.skip("pointless test on non-asm")
+            
+        frame = lltype.cast_opaque_ptr(jitframe.JITFRAMEPTR, frame)
+        assert len(frame.jf_frame) == frame.jf_frame_info.jfi_frame_depth
diff --git a/pypy/jit/backend/x86/assembler.py 
b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -175,7 +175,9 @@
         assert not IS_X86_32
         # push first arg
         mc.LEA_rb(edi.value, -base_ofs)
+        mc.SUB_ri(esp.value, WORD) # we need that cause we're inside a call
         mc.CALL(imm(self.cpu.realloc_frame))
+        mc.ADD_ri(esp.value, WORD) 
         mc.LEA_rm(ebp.value, (eax.value, base_ofs))
         self._pop_all_regs_from_frame(mc, self.cpu.supports_floats)
         mc.RET()
diff --git a/pypy/rpython/lltypesystem/opimpl.py 
b/pypy/rpython/lltypesystem/opimpl.py
--- a/pypy/rpython/lltypesystem/opimpl.py
+++ b/pypy/rpython/lltypesystem/opimpl.py
@@ -524,9 +524,12 @@
                                    source_start, dest_start, length):
     A = lltype.typeOf(source)
     assert A == lltype.typeOf(dest)
-    assert isinstance(A.TO, lltype.GcArray)
-    assert isinstance(A.TO.OF, lltype.Ptr)
-    assert A.TO.OF.TO._gckind == 'gc'
+    if isinstance(A.TO, lltype.GcArray):
+        assert isinstance(A.TO.OF, lltype.Ptr)
+        assert A.TO.OF.TO._gckind == 'gc'
+    else:
+        assert isinstance(A.TO, lltype.GcStruct)
+        assert hasattr(A.TO, '_arrayfld')
     assert type(source_start) is int
     assert type(dest_start) is int
     assert type(length) is int
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to