Author: Armin Rigo <[email protected]>
Branch: gcremovetypeptr-32bit
Changeset: r67095:e2b401122f09
Date: 2013-09-25 16:40 +0200
http://bitbucket.org/pypy/pypy/changeset/e2b401122f09/

Log:    Fix the JIT too.

diff --git a/rpython/jit/backend/arm/regalloc.py 
b/rpython/jit/backend/arm/regalloc.py
--- a/rpython/jit/backend/arm/regalloc.py
+++ b/rpython/jit/backend/arm/regalloc.py
@@ -723,7 +723,7 @@
             # we use the following algorithm:
             #   - read the typeid from mem(locs[0]), i.e. at offset 0
             #   - keep the lower 16 bits read there
-            #   - multiply by 4 and use it as an offset in type_info_group
+            #   - multiply by 8 and use it as an offset in type_info_group
             #   - add 16 bytes, to go past the TYPE_INFO structure
             classptr = y_val
             # here, we have to go back from 'classptr' to the value expected
@@ -733,7 +733,8 @@
             type_info_group = llop.gc_get_type_info_group(llmemory.Address)
             type_info_group = rffi.cast(lltype.Signed, type_info_group)
             expected_typeid = classptr - sizeof_ti - type_info_group
-            expected_typeid >>= 2
+            assert (expected_typeid & 7) == 0
+            expected_typeid >>= 3
             if check_imm_arg(expected_typeid):
                 arglocs[1] = imm(expected_typeid)
             else:
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
@@ -1669,7 +1669,7 @@
             #     64-bits)
             #   - keep the lower half of what is read there (i.e.
             #     truncate to an unsigned 'N / 2' bytes value)
-            #   - multiply by 4 (on 32-bits only) and use it as an
+            #   - multiply by 8 (on 32-bits only) and use it as an
             #     offset in type_info_group
             #   - add 16/32 bytes, to go past the TYPE_INFO structure
             loc = locs[1]
@@ -1685,7 +1685,8 @@
             type_info_group = rffi.cast(lltype.Signed, type_info_group)
             expected_typeid = classptr - sizeof_ti - type_info_group
             if IS_X86_32:
-                expected_typeid >>= 2
+                assert (expected_typeid & 7) == 0
+                expected_typeid >>= 3
                 self.mc.CMP16(mem(locs[0], 0), ImmedLoc(expected_typeid))
             elif IS_X86_64:
                 self.mc.CMP32_mi((locs[0].value, 0), expected_typeid)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to