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

Log:    make gcmap and frame_info raw-allocated structures

diff --git a/rpython/jit/backend/llsupport/jitframe.py 
b/rpython/jit/backend/llsupport/jitframe.py
--- a/rpython/jit/backend/llsupport/jitframe.py
+++ b/rpython/jit/backend/llsupport/jitframe.py
@@ -11,7 +11,7 @@
 # compiled loop token (in fact we could use this as a compiled loop token
 # XXX do this
 
-GCMAP = lltype.GcArray(lltype.Unsigned)
+GCMAP = lltype.Array(lltype.Unsigned)
 NULLGCMAP = lltype.nullptr(GCMAP)
 
 @enforceargs(None, int, int)
@@ -19,7 +19,7 @@
     jfi.jfi_frame_depth = new_depth
     jfi.jfi_frame_size = base_ofs + new_depth * SIZEOFSIGNED
 
-JITFRAMEINFO = lltype.GcStruct(
+JITFRAMEINFO = lltype.Struct(
     'JITFRAMEINFO',
     # the depth of the frame
     ('jfi_frame_depth', lltype.Signed),
@@ -84,25 +84,19 @@
 def jitframe_trace(obj_addr, prev):
     if prev == llmemory.NULL:
         (obj_addr + getofs('jf_gc_trace_state')).signed[0] = 0
-        return obj_addr + getofs('jf_frame_info')
+        return obj_addr + getofs('jf_descr')
     fld = (obj_addr + getofs('jf_gc_trace_state')).signed[0]
     state = fld & 0x7 # 3bits of possible states
     if state == 0:
         (obj_addr + getofs('jf_gc_trace_state')).signed[0] = 1
-        return obj_addr + getofs('jf_descr')
+        return obj_addr + getofs('jf_force_descr')
     elif state == 1:
         (obj_addr + getofs('jf_gc_trace_state')).signed[0] = 2
-        return obj_addr + getofs('jf_force_descr')
+        return obj_addr + getofs('jf_savedata')
     elif state == 2:
         (obj_addr + getofs('jf_gc_trace_state')).signed[0] = 3
-        return obj_addr + getofs('jf_gcmap')
-    elif state == 3:
-        (obj_addr + getofs('jf_gc_trace_state')).signed[0] = 4
-        return obj_addr + getofs('jf_savedata')
-    elif state == 4:
-        (obj_addr + getofs('jf_gc_trace_state')).signed[0] = 5
         return obj_addr + getofs('jf_guard_exc')
-    ll_assert(state == 5, "invalid state")
+    ll_assert(state == 3, "invalid state")
     # bit pattern
     # decode the pattern
     if IS_32BIT:
@@ -127,9 +121,9 @@
             # found it
             # save new state
             if IS_32BIT:
-                new_state = 5 | ((state + 1) << 3) | (no << 8)
+                new_state = 3 | ((state + 1) << 3) | (no << 8)
             else:
-                new_state = 5 | ((state + 1) << 3) | (no << 9)
+                new_state = 3 | ((state + 1) << 3) | (no << 9)
             (obj_addr + getofs('jf_gc_trace_state')).signed[0] = new_state
             return (obj_addr + getofs('jf_frame') + BASEITEMOFS + SIGN_SIZE *
                     (no * SIZEOFSIGNED * 8 + state))
diff --git a/rpython/jit/backend/llsupport/test/test_gc.py 
b/rpython/jit/backend/llsupport/test/test_gc.py
--- a/rpython/jit/backend/llsupport/test/test_gc.py
+++ b/rpython/jit/backend/llsupport/test/test_gc.py
@@ -271,10 +271,10 @@
         return (frame_adr + jitframe.getofs('jf_frame') +
                 jitframe.BASEITEMOFS + jitframe.SIGN_SIZE * no)
     
-    frame_info = lltype.malloc(jitframe.JITFRAMEINFO, zero=True)
+    frame_info = lltype.malloc(jitframe.JITFRAMEINFO, zero=True, flavor='raw')
     frame = lltype.malloc(jitframe.JITFRAME, 15, zero=True)
     frame.jf_frame_info = frame_info
-    frame.jf_gcmap = lltype.malloc(jitframe.GCMAP, 2)
+    frame.jf_gcmap = lltype.malloc(jitframe.GCMAP, 2, flavor='raw')
     if sys.maxint == 2**31 - 1:
         max = r_uint(2 ** 31)
     else:
@@ -290,18 +290,20 @@
     counter = 0
     for name in jitframe.JITFRAME._names:
         TP = getattr(jitframe.JITFRAME, name)
-        if isinstance(TP, lltype.Ptr): # only GC pointers
+        if isinstance(TP, lltype.Ptr) and TP.TO._gckind == 'gc': 
             assert all_addrs[counter] == frame_adr + jitframe.getofs(name)
             counter += 1
     # gcpattern
-    assert all_addrs[6] == indexof(0)
-    assert all_addrs[7] == indexof(1)
-    assert all_addrs[8] == indexof(3)
-    assert all_addrs[9] == indexof(5)
-    assert all_addrs[10] == indexof(7)
-    assert all_addrs[11] == indexof(63)
+    assert all_addrs[4] == indexof(0)
+    assert all_addrs[5] == indexof(1)
+    assert all_addrs[6] == indexof(3)
+    assert all_addrs[7] == indexof(5)
+    assert all_addrs[8] == indexof(7)
+    assert all_addrs[9] == indexof(63)
     # XXX 32bit
-    assert all_addrs[12] == indexof(65)
+    assert all_addrs[10] == indexof(65)
 
-    assert len(all_addrs) == 6 + 6 + 4
-    # 6 static fields, 4 addresses from gcmap, 2 from gcpattern
+    assert len(all_addrs) == 4 + 6 + 4
+    # 4 static fields, 4 addresses from gcmap, 2 from gcpattern
+    lltype.free(frame_info, flavor='raw')
+    lltype.free(frame.jf_gcmap, flavor='raw')
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to