Commits

Armin Rigo committed e2b4011

Fix the JIT too.

Comments (0)

Files changed (2)

rpython/jit/backend/arm/regalloc.py

             # 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
             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:

rpython/jit/backend/x86/assembler.py

             #     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]
             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)