[pypy-svn] r72557 - in pypy/branch/fix-64/pypy: jit/backend/llsupport rpython/lltypesystem rpython/lltypesystem/test
arigo at codespeak.net
arigo at codespeak.net
Mon Mar 22 14:59:14 CET 2010
Author: arigo
Date: Mon Mar 22 14:59:13 2010
New Revision: 72557
Modified:
pypy/branch/fix-64/pypy/jit/backend/llsupport/gc.py
pypy/branch/fix-64/pypy/rpython/lltypesystem/llgroup.py
pypy/branch/fix-64/pypy/rpython/lltypesystem/test/test_llgroup.py
Log:
More test fixes.
Modified: pypy/branch/fix-64/pypy/jit/backend/llsupport/gc.py
==============================================================================
--- pypy/branch/fix-64/pypy/jit/backend/llsupport/gc.py (original)
+++ pypy/branch/fix-64/pypy/jit/backend/llsupport/gc.py Mon Mar 22 14:59:13 2010
@@ -2,6 +2,7 @@
from pypy.rlib.objectmodel import we_are_translated
from pypy.rlib.debug import fatalerror
from pypy.rpython.lltypesystem import lltype, llmemory, rffi, rclass, rstr
+from pypy.rpython.lltypesystem import llgroup
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rpython.annlowlevel import llhelper
from pypy.translator.tool.cbuild import ExternalCompilationInfo
@@ -309,7 +310,7 @@
# if convenient for the backend, we also compute the info about
# the flag as (byte-offset, single-byte-flag).
import struct
- value = struct.pack("i", self.jit_wb_if_flag)
+ value = struct.pack("l", self.jit_wb_if_flag)
assert value.count('\x00') == len(value) - 1 # only one byte is != 0
i = 0
while value[i] == '\x00': i += 1
@@ -372,8 +373,8 @@
# make a malloc function, with three arguments
def malloc_basic(size, tid):
- type_id = llop.extract_ushort(rffi.USHORT, tid)
- has_finalizer = bool(tid & (1<<16))
+ type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
+ has_finalizer = bool(tid & (1<<llgroup.HALFSHIFT))
_check_typeid(type_id)
try:
res = llop1.do_malloc_fixedsize_clear(llmemory.GCREF,
@@ -393,7 +394,7 @@
self.write_barrier_descr = WriteBarrierDescr(self)
#
def malloc_array(itemsize, tid, num_elem):
- type_id = llop.extract_ushort(rffi.USHORT, tid)
+ type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
_check_typeid(type_id)
try:
return llop1.do_malloc_varsize_clear(
@@ -483,7 +484,7 @@
type_id = self.layoutbuilder.get_type_id(S)
assert not self.layoutbuilder.is_weakref(type_id)
has_finalizer = bool(self.layoutbuilder.has_finalizer(S))
- flags = int(has_finalizer) << 16
+ flags = int(has_finalizer) << llgroup.HALFSHIFT
descr.tid = llop.combine_ushort(lltype.Signed, type_id, flags)
def init_array_descr(self, A, descr):
@@ -599,7 +600,7 @@
def can_inline_malloc(self, descr):
assert isinstance(descr, BaseSizeDescr)
if descr.size < self.max_size_of_young_obj:
- has_finalizer = bool(descr.tid & (1<<16))
+ has_finalizer = bool(descr.tid & (1<<llgroup.HALFSHIFT))
if has_finalizer:
return False
return True
Modified: pypy/branch/fix-64/pypy/rpython/lltypesystem/llgroup.py
==============================================================================
--- pypy/branch/fix-64/pypy/rpython/lltypesystem/llgroup.py (original)
+++ pypy/branch/fix-64/pypy/rpython/lltypesystem/llgroup.py Mon Mar 22 14:59:13 2010
@@ -50,9 +50,11 @@
if LONG_BIT == 32:
+ HALFSHIFT = 16
HALFWORD = rffi.USHORT
r_halfword = rffi.r_ushort
else:
+ HALFSHIFT = 32
HALFWORD = rffi.UINT
r_halfword = rffi.r_uint
@@ -97,8 +99,7 @@
'&~0xFFFF' or with a direct masking like '&0x10000' (resp. on 64-bit
platform, with '&~0xFFFFFFFF' or '&0x100000000').
"""
- SHIFT = LONG_BIT//2
- MASK = (1<<SHIFT)-1 # 0xFFFF or 0xFFFFFFFF
+ MASK = (1<<HALFSHIFT)-1 # 0xFFFF or 0xFFFFFFFF
def annotation(self):
from pypy.annotation import model
Modified: pypy/branch/fix-64/pypy/rpython/lltypesystem/test/test_llgroup.py
==============================================================================
--- pypy/branch/fix-64/pypy/rpython/lltypesystem/test/test_llgroup.py (original)
+++ pypy/branch/fix-64/pypy/rpython/lltypesystem/test/test_llgroup.py Mon Mar 22 14:59:13 2010
@@ -67,12 +67,11 @@
test.build()
grpptr = test.grpptr
g1x = [test.g1a, test.g1b]
- SHIFT = CombinedSymbolic.SHIFT
- MASK = CombinedSymbolic.MASK
- cs1 = CombinedSymbolic(test.g1b, 0x45 << SHIFT)
- cs2 = CombinedSymbolic(test.g1b, 0x41 << SHIFT)
+ MASK = CombinedSymbolic.MASK
+ cs1 = CombinedSymbolic(test.g1b, 0x45 << HALFSHIFT)
+ cs2 = CombinedSymbolic(test.g1b, 0x41 << HALFSHIFT)
assert llop.extract_ushort(HALFWORD, cs1) is test.g1b
- assert cs1 & ~MASK == 0x45 << SHIFT
+ assert cs1 & ~MASK == 0x45 << HALFSHIFT
cslist = [cs1, cs2]
#
def f():
@@ -104,8 +103,8 @@
s = llop.extract_ushort(HALFWORD, cslist[i])
p = llop.get_group_member(lltype.Ptr(test.S1), grpptr, s)
assert p == test.p1b
- assert cslist[0] & ~MASK == 0x45 << SHIFT
- assert cslist[1] & ~MASK == 0x41 << SHIFT
+ assert cslist[0] & ~MASK == 0x45 << HALFSHIFT
+ assert cslist[1] & ~MASK == 0x41 << HALFSHIFT
#
return 42
return f
More information about the Pypy-commit
mailing list