Author: Maciej Fijalkowski <[email protected]>
Branch: jitframe-on-heap
Changeset: r60738:d564608f9ea1
Date: 2013-01-30 17:33 +0200
http://bitbucket.org/pypy/pypy/changeset/d564608f9ea1/
Log: a test and some debug prints
diff --git a/rpython/jit/backend/x86/assembler.py
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -1883,6 +1883,8 @@
malloc_size = (size // WORD // 8 + 1) + 1
rawgcmap = self.datablockwrapper.malloc_aligned(WORD * malloc_size,
WORD)
+ debug_print("gcmap: %x, len %d for %d" % (rawgcmap, malloc_size - 1,
+ self.mc.get_relative_pos()))
# set the length field
rffi.cast(rffi.CArrayPtr(lltype.Signed), rawgcmap)[0] = malloc_size - 1
gcmap = rffi.cast(lltype.Ptr(jitframe.GCMAP), rawgcmap)
diff --git a/rpython/jit/backend/x86/regalloc.py
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -29,6 +29,8 @@
from rpython.jit.backend.x86.arch import IS_X86_32, IS_X86_64
from rpython.jit.backend.x86 import rx86
from rpython.rlib.rarithmetic import r_longlong, r_uint
+from rpython.rlib.debug import (debug_print, debug_start, debug_stop,
+ have_debug_prints)
class X86RegisterManager(RegisterManager):
@@ -896,6 +898,7 @@
def get_gcmap(self, forbidden_regs=[], noregs=False):
frame_depth = self.fm.get_frame_depth()
gcmap = self.assembler.allocate_gcmap(frame_depth)
+ debug_start("jit-backend-gcmap")
for box, loc in self.rm.reg_bindings.iteritems():
if loc in forbidden_regs:
continue
@@ -909,6 +912,9 @@
assert isinstance(loc, StackLoc)
val = loc.value // WORD
gcmap[val // WORD // 8] |= r_uint(1) << (val % (WORD * 8))
+ for i in range(len(gcmap)):
+ debug_print(str(gcmap[i]))
+ debug_stop('jit-backend-gcmap')
return gcmap
diff --git a/rpython/translator/c/test/test_symbolic.py
b/rpython/translator/c/test/test_symbolic.py
--- a/rpython/translator/c/test/test_symbolic.py
+++ b/rpython/translator/c/test/test_symbolic.py
@@ -19,6 +19,29 @@
res = fn()
assert res == 12
+def test_offsetof_nogc():
+ ARR = lltype.Array(lltype.Signed)
+ offsetx = llmemory.arraylengthoffset(ARR)
+ offsety = llmemory.itemoffsetof(ARR, 0)
+ ARR2 = lltype.GcArray(lltype.Signed)
+ offsetx2 = llmemory.arraylengthoffset(ARR2)
+ offsety2 = llmemory.itemoffsetof(ARR2, 0)
+
+ def f():
+ a = lltype.malloc(ARR, 5, flavor='raw')
+ a2 = lltype.malloc(ARR2, 6, flavor='raw')
+ a2[0] = 1
+ a[0] = 3
+ adr = llmemory.cast_ptr_to_adr(a)
+ adr2 = llmemory.cast_ptr_to_adr(a2)
+ return ((adr + offsetx).signed[0] * 1000 +
+ (adr + offsety).signed[0] * 100 +
+ (adr2 + offsetx2).signed[0] * 10 + (adr2 + offsety2).signed[0])
+
+ fn = compile(f, [])
+ res = fn()
+ assert res == 5361
+
def test_sizeof_array_with_no_length():
A = lltype.Array(lltype.Signed, hints={'nolength': True})
arraysize = llmemory.sizeof(A, 10)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit