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

Log:    update rewrite

diff --git a/rpython/jit/backend/llsupport/rewrite.py 
b/rpython/jit/backend/llsupport/rewrite.py
--- a/rpython/jit/backend/llsupport/rewrite.py
+++ b/rpython/jit/backend/llsupport/rewrite.py
@@ -1,5 +1,4 @@
 from rpython.rlib.rarithmetic import ovfcheck
-from rpython.rlib import rgc
 from rpython.rtyper.lltypesystem import lltype, llmemory
 from rpython.jit.metainterp import history
 from rpython.jit.metainterp.history import ConstInt, BoxPtr, ConstPtr
@@ -140,7 +139,7 @@
     def gen_malloc_frame(self, frame_info, frame, size_box):
         descrs = self.gc_ll_descr.getframedescrs(self.cpu)
         if self.gc_ll_descr.kind == 'boehm':
-            op0 = ResOperation(rop.GETFIELD_GC, [history.ConstPtr(frame_info)],
+            op0 = ResOperation(rop.GETFIELD_GC, [history.ConstInt(frame_info)],
                                size_box,
                                descr=descrs.jfi_frame_depth)
             self.newops.append(op0)
@@ -149,14 +148,14 @@
             self.handle_new_array(descrs.arraydescr, op1)
         else:
             # we read size in bytes here, not the length
-            op0 = ResOperation(rop.GETFIELD_GC, [history.ConstPtr(frame_info)],
+            op0 = ResOperation(rop.GETFIELD_GC, [history.ConstInt(frame_info)],
                                size_box,
                                descr=descrs.jfi_frame_size)
             self.newops.append(op0)
             self.gen_malloc_nursery_varsize(size_box, frame, is_small=True)
             self.gen_initialize_tid(frame, descrs.arraydescr.tid)
             length_box = history.BoxInt()
-            op1 = ResOperation(rop.GETFIELD_GC, [history.ConstPtr(frame_info)],
+            op1 = ResOperation(rop.GETFIELD_GC, [history.ConstInt(frame_info)],
                                length_box,
                                descr=descrs.jfi_frame_depth)
             self.newops.append(op1)
@@ -168,12 +167,11 @@
         loop_token = op.getdescr()
         assert isinstance(loop_token, history.JitCellToken)
         jfi = loop_token.compiled_loop_token.frame_info
-        llref = lltype.cast_opaque_ptr(llmemory.GCREF, jfi)
-        rgc._make_sure_does_not_move(llref)
+        llfi = heaptracker.adr2int(llmemory.cast_ptr_to_adr(jfi))
         size_box = history.BoxInt()
         frame = history.BoxPtr()
-        self.gen_malloc_frame(llref, frame, size_box)
-        op2 = ResOperation(rop.SETFIELD_GC, [frame, history.ConstPtr(llref)],
+        self.gen_malloc_frame(llfi, frame, size_box)
+        op2 = ResOperation(rop.SETFIELD_GC, [frame, history.ConstInt(llfi)],
                            None, descr=descrs.jf_frame_info)
         self.newops.append(op2)
         arglist = op.getarglist()
diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py 
b/rpython/jit/backend/llsupport/test/test_rewrite.py
--- a/rpython/jit/backend/llsupport/test/test_rewrite.py
+++ b/rpython/jit/backend/llsupport/test/test_rewrite.py
@@ -9,7 +9,7 @@
 from rpython.jit.metainterp.optimizeopt.util import equaloplists
 from rpython.jit.codewriter.heaptracker import register_known_gctype
 from rpython.jit.metainterp.history import JitCellToken, FLOAT
-from rpython.rtyper.lltypesystem import lltype, rclass, llmemory
+from rpython.rtyper.lltypesystem import lltype, rclass, rffi
 from rpython.jit.backend.x86.arch import WORD
 
 class Evaluator(object):
@@ -72,8 +72,7 @@
 
         casmdescr = JitCellToken()
         clt = FakeLoopToken()
-        frame_info = lltype.malloc(jitframe.JITFRAMEINFO)
-        ll_frame_info = lltype.cast_opaque_ptr(llmemory.GCREF, frame_info)
+        frame_info = lltype.malloc(jitframe.JITFRAMEINFO, flavor='raw')
         clt.frame_info = frame_info
         frame_info.jfi_frame_depth = 13
         frame_info.jfi_frame_size = 255
@@ -100,6 +99,7 @@
                                                         ops.operations,
                                                         [])
         equaloplists(operations, expected.operations)
+        lltype.free(frame_info, flavor='raw')
 
 class FakeTracker(object):
     pass
@@ -740,12 +740,12 @@
         i2 = call_assembler(i0, f0, descr=casmdescr)
         """, """
         [i0, f0]
-        i1 = getfield_gc(ConstPtr(ll_frame_info), descr=jfi_frame_size)
+        i1 = getfield_gc(ConstClass(frame_info), descr=jfi_frame_size)
         p1 = call_malloc_nursery_varsize_small(i1)
         setfield_gc(p1, 0, descr=tiddescr)
-        i2 = getfield_gc(ConstPtr(ll_frame_info), descr=jfi_frame_depth)
+        i2 = getfield_gc(ConstClass(frame_info), descr=jfi_frame_depth)
         setfield_gc(p1, i2, descr=framelendescr)
-        setfield_gc(p1, ConstPtr(ll_frame_info), descr=jf_frame_info)
+        setfield_gc(p1, ConstClass(frame_info), descr=jf_frame_info)
         setarrayitem_gc(p1, 0, i0, descr=signedframedescr)
         setarrayitem_gc(p1, 1, f0, descr=floatframedescr)
         i3 = call_assembler(p1, descr=casmdescr)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to