Author: Tim Felgentreff <[email protected]>
Branch: 64bit
Changeset: r572:1ebcd9bf1944
Date: 2014-01-10 21:19 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/1ebcd9bf1944/

Log:    support 64bit target with 32bit images

diff --git a/spyvm/display.py b/spyvm/display.py
--- a/spyvm/display.py
+++ b/spyvm/display.py
@@ -1,4 +1,4 @@
-from rpython.rlib.rarithmetic import r_uint
+from rpython.rlib.rarithmetic import r_uint32 as r_uint
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.rlib.runicode import unicode_encode_utf_8
 from rpython.rlib import jit
@@ -71,7 +71,7 @@
             self.set_squeak_colormap(self.screen)
 
     def get_pixelbuffer(self):
-        return rffi.cast(rffi.ULONGP, self.screen.c_pixels)
+        return rffi.cast(rffi.UINTP, self.screen.c_pixels)
 
     def defer_updates(self, flag):
         self._defer_updates = flag
diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -18,7 +18,7 @@
 from spyvm import constants, error
 
 from rpython.rlib import rrandom, objectmodel, jit, signature
-from rpython.rlib.rarithmetic import intmask, r_uint
+from rpython.rlib.rarithmetic import intmask, r_uint32, r_uint
 from rpython.tool.pairtype import extendabletype
 from rpython.rlib.objectmodel import instantiate, compute_hash
 from rpython.rtyper.lltypesystem import lltype, rffi
@@ -187,7 +187,6 @@
         return space.wrap_int(self.value >> shift)
 
     def unwrap_uint(self, space):
-        from rpython.rlib.rarithmetic import r_uint
         val = self.value
         if val < 0:
             raise error.UnwrappingError("got negative integer")
@@ -295,7 +294,6 @@
         return space.wrap_int((self.value >> shift) & mask)
 
     def unwrap_uint(self, space):
-        from rpython.rlib.rarithmetic import r_uint
         return r_uint(self.value)
 
     def clone(self, space):
@@ -397,11 +395,11 @@
         from rpython.rlib.rstruct.ieee import float_pack
         r = float_pack(self.value, 8) # C double
         if n0 == 0:
-            return space.wrap_uint(r_uint(intmask(r >> 32)))
+            return space.wrap_uint(r_uint32(intmask(r >> 32)))
         else:
             # bounds-check for primitive access is done in the primitive
             assert n0 == 1
-            return space.wrap_uint(r_uint(intmask(r)))
+            return space.wrap_uint(r_uint32(intmask(r)))
 
     def store(self, space, n0, w_obj):
         from rpython.rlib.rstruct.ieee import float_unpack, float_pack
@@ -940,7 +938,7 @@
         if self.words is None:
             return self.c_words
         else:
-            from spyvm.interpreter_proxy import sqIntArrayPtr
+            from spyvm.iproxy import sqIntArrayPtr
             size = self.size()
             old_words = self.words
             c_words = self.c_words = lltype.malloc(sqIntArrayPtr.TO, size, 
flavor='raw')
@@ -991,7 +989,8 @@
 
     def __init__(self, space, w_class, size, depth, display):
         W_AbstractObjectWithClassReference.__init__(self, space, w_class)
-        self._real_depth_buffer = lltype.malloc(rffi.CArray(rffi.UINT), size, 
flavor='raw')
+        # self._real_depth_buffer = lltype.malloc(rffi.CArray(rffi.UINT), 
size, flavor='raw')
+        self._real_depth_buffer = [r_uint(0)] * size
         self.pixelbuffer = display.get_pixelbuffer()
         self._realsize = size
         self.display = display
@@ -1003,7 +1002,7 @@
 
     def atput0(self, space, index0, w_value):
         word = space.unwrap_uint(w_value)
-        self.setword(index0, word)
+        self.setword(index0, r_uint(word))
 
     def flush_to_screen(self):
         self.display.flip()
@@ -1028,7 +1027,7 @@
 
     def setword(self, n, word):
         self._real_depth_buffer[n] = word
-        self.pixelbuffer[n] = word
+        self.pixelbuffer[n] = r_uint32(word)
 
     def is_array_object(self):
         return True
@@ -1062,17 +1061,18 @@
             ((msb & mask) << 11)
         )
 
-        self.pixelbuffer[n] = r_uint(lsb | (msb << 16))
+        self.pixelbuffer[n] = r_uint32(lsb | (msb << 16))
 
 
 class W_8BitDisplayBitmap(W_DisplayBitmap):
     def setword(self, n, word):
         self._real_depth_buffer[n] = word
-        self.pixelbuffer[n] = r_uint(
-            (word >> 24) |
-            ((word >> 8) & 0x0000ff00) |
-            ((word << 8) & 0x00ff0000) |
-            (word << 24)
+        nWord = r_uint(word)
+        self.pixelbuffer[n] = r_uint32(
+            (nWord >> 24) |
+            ((nWord >> 8) & 0x0000ff00) |
+            ((nWord << 8) & 0x00ff0000) |
+            (nWord << 24)
         )
 
 
@@ -1081,7 +1081,7 @@
     @jit.unroll_safe
     def setword(self, n, word):
         self._real_depth_buffer[n] = word
-        word = r_uint(word)
+        nWord = r_uint(word)
         pos = self.compute_pos(n)
         assert self._depth <= 4
         rshift = 32 - self._depth
@@ -1092,8 +1092,8 @@
             for i in xrange(4):
                 pixel = r_uint(word) >> rshift
                 mapword |= (r_uint(pixel) << (i * 8))
-                word <<= self._depth
-            self.pixelbuffer[pos] = mapword
+                nWord <<= self._depth
+            self.pixelbuffer[pos] = r_uint32(mapword)
             pos += 1
 
     def compute_pos(self, n):
diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -1,10 +1,11 @@
 import os
 
-from spyvm import constants, model, shadow, wrapper
+from spyvm import constants, model, shadow, wrapper, system
 from spyvm.error import UnwrappingError, WrappingError, PrimitiveFailedError
 from rpython.rlib import jit, rpath
 from rpython.rlib.objectmodel import instantiate, specialize
-from rpython.rlib.rarithmetic import intmask, r_uint, int_between
+from rpython.rlib.rarithmetic import intmask, int_between, r_uint
+
 
 class ObjSpace(object):
     def __init__(self):
@@ -15,7 +16,7 @@
         self.make_bootstrap_objects()
 
     def find_executable(self, executable):
-        if os.sep in executable or (os.name == "nt" and ":" in executable):
+        if os.sep in executable or (system.IS_WINDOWS and ":" in executable):
             return executable
         path = os.environ.get("PATH")
         if path:
@@ -226,6 +227,7 @@
         else:
             return self._wrap_uint_loop(val, bytes_len)
 
+    @jit.unroll_safe
     def _wrap_uint_loop(self, val, bytes_len):
         w_result = model.W_BytesObject(self,
                     self.classtable['w_LargePositiveInteger'], bytes_len)
diff --git a/spyvm/plugins/bitblt.py b/spyvm/plugins/bitblt.py
--- a/spyvm/plugins/bitblt.py
+++ b/spyvm/plugins/bitblt.py
@@ -4,7 +4,7 @@
 from spyvm.plugins.plugin import Plugin
 
 from rpython.rlib import jit, objectmodel
-from rpython.rlib.rarithmetic import r_uint, intmask
+from rpython.rlib.rarithmetic import intmask, r_uint32, r_uint
 
 
 BitBltPlugin = Plugin()
@@ -17,7 +17,7 @@
         raise PrimitiveFailedError("BitBlt primitive not called in BitBlt 
object!")
 
     # only allow combinationRules 0-41
-    combinationRule = 
interp.space.unwrap_positive_32bit_int(w_rcvr.fetch(interp.space, 3))
+    combinationRule = interp.space.unwrap_int(w_rcvr.fetch(interp.space, 3))
     if combinationRule > 41:
         raise PrimitiveFailedError("Missing combinationRule %d" % 
combinationRule)
 
@@ -264,19 +264,19 @@
             destWord = self.dest.w_bits.getword(self.destIndex)
             mergeWord = self.mergeFn(halftoneWord, destWord)
             destWord = (destMask & mergeWord) | (destWord & (~destMask))
-            self.dest.w_bits.setword(self.destIndex, destWord)
+            self.dest.w_bits.setword(self.destIndex, r_uint32(destWord))
             self.destIndex += 1
             destMask = BitBltShadow.AllOnes
             # the central horizontal loop requires no store masking
             if self.combinationRule == 3: # store rule requires no dest merging
                 for word in range(2, self.nWords):
-                    self.dest.w_bits.setword(self.destIndex, halftoneWord)
+                    self.dest.w_bits.setword(self.destIndex, 
r_uint32(halftoneWord))
                     self.destIndex += 1
             else:
                 for word in range(2, self.nWords):
                     destWord = self.dest.w_bits.getword(self.destIndex)
                     mergeWord = self.mergeFn(halftoneWord, destWord)
-                    self.dest.w_bits.setword(self.destIndex, mergeWord)
+                    self.dest.w_bits.setword(self.destIndex, 
r_uint32(mergeWord))
                     self.destIndex += 1
             # last word in row is masked
             if self.nWords > 1:
@@ -284,7 +284,7 @@
                 destWord = self.dest.w_bits.getword(self.destIndex)
                 mergeWord = self.mergeFn(halftoneWord, destWord)
                 destWord = (destMask & mergeWord) | (destWord & (~destMask))
-                self.dest.w_bits.setword(self.destIndex, destWord)
+                self.dest.w_bits.setword(self.destIndex, r_uint32(destWord))
                 self.destIndex += 1
             self.destIndex += self.destDelta
 
@@ -346,13 +346,13 @@
                 if self.destMask == BitBltShadow.AllOnes: # avoid 
read-modify-write
                     self.dest.w_bits.setword(
                         self.destIndex,
-                        self.mergeFn(skewWord & halftoneWord, 
self.dest.w_bits.getword(self.destIndex))
+                        r_uint32(self.mergeFn(skewWord & halftoneWord, 
self.dest.w_bits.getword(self.destIndex)))
                     )
                 else: # General version using dest masking
                     destWord = self.dest.w_bits.getword(self.destIndex)
                     mergeWord = self.mergeFn(skewWord & halftoneWord, destWord 
& self.destMask)
                     destWord = (self.destMask & mergeWord) | (destWord & 
(~self.destMask))
-                    self.dest.w_bits.setword(self.destIndex, destWord)
+                    self.dest.w_bits.setword(self.destIndex, 
r_uint32(destWord))
 
                 self.destIndex += 1
                 if (self.nWords == 2): # is the next word the last word?
@@ -458,7 +458,7 @@
             destWord = self.dest.w_bits.getword(self.destIndex)
             mergeWord = self.mergeFn(skewWord & halftoneWord, destWord)
             destWord = (destMask & mergeWord) | (destWord & (~destMask))
-            self.dest.w_bits.setword(self.destIndex, destWord)
+            self.dest.w_bits.setword(self.destIndex, r_uint32(destWord))
             # The central horizontal loop requires no store masking
             self.destIndex += hInc
             destMask = BitBltShadow.AllOnes
@@ -468,12 +468,12 @@
                     if (self.hDir == -1):
                         for word in range(2, self.nWords):
                             thisWord = 
self.source.w_bits.getword(self.sourceIndex)
-                            self.dest.w_bits.setword(self.destIndex, thisWord)
+                            self.dest.w_bits.setword(self.destIndex, 
r_uint32(thisWord))
                             self.sourceIndex += hInc
                             self.destIndex += hInc
                     else:
                         for word in range(2, self.nWords):
-                            self.dest.w_bits.setword(self.destIndex, prevWord)
+                            self.dest.w_bits.setword(self.destIndex, 
r_uint32(prevWord))
                             prevWord = 
self.source.w_bits.getword(self.sourceIndex)
                             self.destIndex += hInc
                             self.sourceIndex += hInc
@@ -484,7 +484,7 @@
                         self.sourceIndex += hInc
                         skewWord = self.rotate32bit(thisWord, prevWord, 
skewMask, notSkewMask, unskew)
                         prevWord = thisWord
-                        self.dest.w_bits.setword(self.destIndex, skewWord & 
halftoneWord)
+                        self.dest.w_bits.setword(self.destIndex, 
r_uint32(skewWord & halftoneWord))
                         self.destIndex += hInc
             else: # Dest merging here...
                 for word in range(2, self.nWords):
@@ -493,7 +493,7 @@
                     skewWord = self.rotate32bit(thisWord, prevWord, skewMask, 
notSkewMask, unskew)
                     prevWord = thisWord
                     mergeWord = self.mergeFn(skewWord & halftoneWord, 
self.dest.w_bits.getword(self.destIndex))
-                    self.dest.w_bits.setword(self.destIndex, mergeWord)
+                    self.dest.w_bits.setword(self.destIndex, 
r_uint32(mergeWord))
                     self.destIndex += hInc
             # last word with masking and all
             if (self.nWords > 1):
@@ -507,7 +507,7 @@
                 destWord = self.dest.w_bits.getword(self.destIndex)
                 mergeWord = self.mergeFn(skewWord & halftoneWord, destWord)
                 destWord = (destMask & mergeWord) | (destWord & (~destMask))
-                self.dest.w_bits.setword(self.destIndex, destWord)
+                self.dest.w_bits.setword(self.destIndex, r_uint32(destWord))
                 self.destIndex += hInc
             self.sourceIndex += self.sourceDelta
             self.destIndex += self.destDelta
@@ -521,7 +521,7 @@
 
     @objectmodel.specialize.arg_or_var(3)
     def merge(self, source_word, dest_word, combinationRule):
-        assert isinstance(source_word, r_uint) and isinstance(dest_word, 
r_uint)
+        # assert isinstance(source_word, r_uint) and isinstance(dest_word, 
r_uint)
         if combinationRule == 0:
             return 0
         elif combinationRule == 1:
diff --git a/spyvm/plugins/fileplugin.py b/spyvm/plugins/fileplugin.py
--- a/spyvm/plugins/fileplugin.py
+++ b/spyvm/plugins/fileplugin.py
@@ -154,6 +154,6 @@
 def smalltalk_timestamp(space, sec_since_epoch):
     import time
     from spyvm.primitives import secs_between_1901_and_1970
-    from rpython.rlib.rarithmetic import r_uint
-    sec_since_1901 = r_uint(sec_since_epoch + secs_between_1901_and_1970)
+    from rpython.rlib.rarithmetic import r_uint32 as r_uint
+    sec_since_1901 = r_uint(int(sec_since_epoch + secs_between_1901_and_1970))
     return space.wrap_uint(sec_since_1901)
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -9,6 +9,7 @@
 from spyvm import wrapper
 
 from rpython.rlib import rarithmetic, rfloat, unroll, jit
+from rpython.rlib.rarithmetic import r_uint32, r_uint
 
 def assert_bounds(n0, minimum, maximum):
     if not minimum <= n0 < maximum:
@@ -246,7 +247,9 @@
 # #bitShift: -- return the shifted value
 @expose_primitive(BIT_SHIFT, unwrap_spec=[object, int])
 def func(interp, s_frame, receiver, argument):
-    from rpython.rlib.rarithmetic import LONG_BIT
+    # from rpython.rlib.rarithmetic import LONG_BIT
+    # XXX: 32-bit images only!
+    LONG_BIT = 32
     if -LONG_BIT < argument < LONG_BIT:
         # overflow-checking done in lshift implementations
         if argument > 0:
@@ -293,10 +296,19 @@
             return w_res
     make_func(op)
 
+# XXX: 32-bit only
+def ovfcheck_float_to_int(x):
+    from rpython.rlib.rfloat import isnan
+    if isnan(x):
+        raise OverflowError
+    if -2147483649.0 < x < 2147483648.0:
+        return int(x)
+    raise OverflowError
+
 @expose_primitive(FLOAT_TRUNCATED, unwrap_spec=[float])
 def func(interp, s_frame, f):
     try:
-        return interp.space.wrap_int(rarithmetic.ovfcheck_float_to_int(f))
+        return interp.space.wrap_int(ovfcheck_float_to_int(f))
     except OverflowError:
         raise PrimitiveFailedError
 
@@ -883,7 +895,7 @@
         from spyvm.plugins.vmdebugging import DebuggingPlugin
         return DebuggingPlugin.call(signature[1], interp, s_frame, argcount, 
s_method)
     else:
-        from spyvm.interpreter_proxy import IProxy
+        from spyvm.iproxy import IProxy
         return IProxy.call(signature, interp, s_frame, argcount, s_method)
     raise PrimitiveFailedError
 
@@ -1023,15 +1035,15 @@
 
 
 
-secs_between_1901_and_1970 = rarithmetic.r_uint((69 * 365 + 17) * 24 * 3600)
+secs_between_1901_and_1970 = r_uint((69 * 365 + 17) * 24 * 3600)
 
 @expose_primitive(SECONDS_CLOCK, unwrap_spec=[object])
 def func(interp, s_frame, w_arg):
     import time
-    sec_since_epoch = rarithmetic.r_uint(time.time())
+    sec_since_epoch = r_uint(int(time.time()))
     # XXX: overflow check necessary?
     sec_since_1901 = sec_since_epoch + secs_between_1901_and_1970
-    return interp.space.wrap_uint(sec_since_1901)
+    return interp.space.wrap_uint(r_uint32(sec_since_1901))
 
 
 #____________________________________________________________________________
@@ -1073,9 +1085,12 @@
             raise PrimitiveFailedError
         for i in xrange(w_arg.size()):
             w_arg.setchar(i, chr(new_value))
-    elif isinstance(w_arg, model.W_WordsObject) or isinstance(w_arg, 
model.W_DisplayBitmap):
+    elif isinstance(w_arg, model.W_WordsObject):
         for i in xrange(w_arg.size()):
             w_arg.setword(i, new_value)
+    elif isinstance(w_arg, model.W_DisplayBitmap):
+        for i in xrange(w_arg.size()):
+            w_arg.setword(i, r_uint32(new_value))
     else:
         raise PrimitiveFailedError
     return w_arg
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -2,6 +2,8 @@
 from spyvm import model, constants, error, wrapper
 from rpython.tool.pairtype import extendabletype
 from rpython.rlib import rarithmetic, jit
+from rpython.rlib.rarithmetic import r_uint
+
 
 def make_elidable_after_versioning(func):
     @jit.elidable
@@ -648,7 +650,7 @@
         self._temps_and_stack = [None] * (stacksize + tempsize)
         for i in range(tempsize):
             self._temps_and_stack[i] = self.space.w_nil
-        self._stack_ptr = rarithmetic.r_uint(tempsize) # we point after the 
last element
+        self._stack_ptr = r_uint(tempsize) # we point after the last element
 
     # ______________________________________________________________________
     # Stack Manipulation
@@ -681,11 +683,11 @@
         return self.peek(0)
 
     def set_top(self, value, position=0):
-        rpos = rarithmetic.r_uint(position)
+        rpos = r_uint(position)
         self._temps_and_stack[self._stack_ptr + ~rpos] = value
 
     def peek(self, idx):
-        rpos = rarithmetic.r_uint(idx)
+        rpos = r_uint(idx)
         return self._temps_and_stack[jit.promote(self._stack_ptr) + ~rpos]
 
     @jit.unroll_safe
diff --git a/spyvm/squeakimage.py b/spyvm/squeakimage.py
--- a/spyvm/squeakimage.py
+++ b/spyvm/squeakimage.py
@@ -380,11 +380,11 @@
 
     def run_spy_hacks(self, space):
         pass
-        # w_display = space.objtable["w_display"]
-        # if w_display is not None and w_display is not space.w_nil:
-        #     if space.unwrap_int(w_display.fetch(space, 3)) < 8:
-        #         # non-native indexed color depth not well supported
-        #         w_display.store(space, 3, space.wrap_int(8))
+        w_display = space.objtable["w_display"]
+        if w_display is not None and w_display is not space.w_nil:
+            if space.unwrap_int(w_display.fetch(space, 3)) < 8:
+                # non-native indexed color depth not well supported
+                w_display.store(space, 3, space.wrap_int(32))
 
     def find_symbol(self, space, reader, symbol):
         w_dnu = self.special(constants.SO_DOES_NOT_UNDERSTAND)
@@ -558,7 +558,7 @@
         return bytes[:stop] # omit odd bytes
 
     def get_ruints(self, required_len=-1):
-        from rpython.rlib.rarithmetic import r_uint
+        from rpython.rlib.rarithmetic import r_uint32 as r_uint
         words = [r_uint(x) for x in self.chunk.data]
         if required_len != -1 and len(words) != required_len:
             raise CorruptImageError("Expected %d words, got %d" % 
(required_len, len(words)))
diff --git a/spyvm/test/test_bitblt.py b/spyvm/test/test_bitblt.py
--- a/spyvm/test/test_bitblt.py
+++ b/spyvm/test/test_bitblt.py
@@ -1,4 +1,5 @@
 from spyvm import model, shadow, constants, interpreter, objspace
+from spyvm.plugins import bitblt
 
 space = objspace.ObjSpace()
 
@@ -37,7 +38,7 @@
 def test_bitBlt_values():
 
     w_bb = model.W_PointersObject(space, space.w_Array, 15)
-    w_bb.store(space, 0, make_form([], 1230, 20, 1))
+    w_bb.store(space, 0, make_form([0] * 1230 * 20, 1230, 20, 1))
     w_bb.store(space, 1, w_bb.fetch(space, 0))
 
     w_bb.store(space, 2, space.w_nil)
@@ -54,25 +55,26 @@
     w_bb.store(space, 13, w(15))   # clip height
     w_bb.store(space, 14, model.W_PointersObject(space, space.w_Array, 5)) # 
color map
 
-    s_bb = w_bb.as_bitblt_get_shadow(space)
-    s_bb.clip_range()
-    assert not (s_bb.w <= 0 or s_bb.h <= 0)
-    s_bb.compute_masks()
-    s_bb.check_overlap()
-    s_bb.calculate_offsets()
+    s_bb = w_bb.as_special_get_shadow(space, bitblt.BitBltShadow)
+    s_bb.loadBitBlt()
+    s_bb.clipRange()
+    assert not (s_bb.width <= 0 or s_bb.height <= 0)
+    s_bb.destMaskAndPointerInit()
+    s_bb.checkSourceOverlap()
+    s_bb.sourceSkewAndPointerInit()
 
-    assert s_bb.dest_x == 1
-    assert s_bb.dest_y == 0
+    assert s_bb.destX == 1
+    assert s_bb.destY == 0
     assert s_bb.sx == 1218
     assert s_bb.sy == 0
     assert s_bb.dx == 1219
     assert s_bb.dy == 0
-    assert s_bb.w == 1219
-    assert s_bb.h == 15
-    assert s_bb.h_dir == -1
-    assert s_bb.v_dir == 1
-    assert s_bb.source_delta == 79
-    assert s_bb.dest_delta == 78
+    assert s_bb.width == 1220
+    assert s_bb.height == 15
+    assert s_bb.hDir == -1
+    assert s_bb.vDir == 1
+    assert s_bb.sourceDelta == 79
+    assert s_bb.destDelta == 78
     assert s_bb.skew == 31
-    assert s_bb.source_index == 38
-    assert s_bb.dest_index == 38
\ No newline at end of file
+    assert s_bb.sourceIndex == 38
+    assert s_bb.destIndex == 38
diff --git a/spyvm/test/test_bootstrappedimage.py 
b/spyvm/test/test_bootstrappedimage.py
--- a/spyvm/test/test_bootstrappedimage.py
+++ b/spyvm/test/test_bootstrappedimage.py
@@ -13,7 +13,7 @@
     s_methoddict.sync_cache()
     methoddict_w = s_methoddict.methoddict
     for each in methoddict_w.keys():
-        if each.as_string() == string:
+        if each == string:
             return each
 
 def initialize_class(w_class):
diff --git a/spyvm/test/test_largeinteger.py b/spyvm/test/test_largeinteger.py
--- a/spyvm/test/test_largeinteger.py
+++ b/spyvm/test/test_largeinteger.py
@@ -6,7 +6,8 @@
 from spyvm.test.test_miniimage import perform, w
 from spyvm.test.test_primitives import MockFrame
 
-from rpython.rlib.rarithmetic import intmask, r_uint
+from rpython.rlib.rarithmetic import intmask, r_uint32 as r_uint
+
 
 space, interp = tools.setup_module(tools, filename='bootstrapped.image')
 
@@ -16,11 +17,11 @@
     s_methoddict.sync_cache()
     methoddict_w = s_methoddict.methoddict
     for each in methoddict_w.keys():
-        if each.as_string() == string:
+        if each == string:
             return each
 
 def initialize_class(w_class):
-    initialize_symbol = find_symbol_in_methoddict_of("initialize", 
+    initialize_symbol = find_symbol_in_methoddict_of("initialize",
                         w_class.shadow_of_my_class(tools.space))
     perform(w_class, initialize_symbol)
 
@@ -78,7 +79,7 @@
 
 def test_bitXor():
     do_primitive("bitXor:", operator.xor)
-    do_primitive("bitXor:", operator.xor, i=[0xFFFFFFFF, 0x0F0F0F0F, 
0xFFFFFF], 
+    do_primitive("bitXor:", operator.xor, i=[0xFFFFFFFF, 0x0F0F0F0F, 0xFFFFFF],
                                           j=[0xF0F0F0F0, 0xFFFEFCF8, 
4294967295])
 
 def test_bitShift():
@@ -97,4 +98,3 @@
 #     do_primitive("-", operator.sub, j=[0xFF, 0xFFFF, 0xF0E0D0C0], i=[-1, -1, 
-1])
 #     do_primitive("-", operator.sub)
     # do_primitive("-", operator.sub, i=[0xFF], j=0x3FFFFFFF)
-
diff --git a/spyvm/test/test_model.py b/spyvm/test/test_model.py
--- a/spyvm/test/test_model.py
+++ b/spyvm/test/test_model.py
@@ -4,7 +4,8 @@
 from spyvm import model, shadow
 from spyvm.shadow import MethodNotFound
 from spyvm import objspace, error, display
-from rpython.rlib.rarithmetic import intmask, r_uint
+from rpython.rlib.rarithmetic import intmask, r_uint32 as r_uint
+
 
 mockclass = objspace.bootstrap_class
 
@@ -376,20 +377,6 @@
     for i in xrange(24, 32):
         assert target.pixelbuffer[i] == 0xffffffff
 
-def test_display_offset_computation():
-
-    def get_pixelbuffer(self):
-        from rpython.rtyper.lltypesystem import lltype, rffi
-        return lltype.malloc(rffi.ULONGP.TO, self.width * self.height * 32, 
flavor='raw')
-    display.SDLDisplay.get_pixelbuffer = get_pixelbuffer
-    d = display.SDLDisplay("test")
-    d.set_video_mode(18, 5, 1)
-
-    dbitmap = model.W_DisplayBitmap.create(space, space.w_Array, 5, 1, d)
-
-    assert dbitmap.compute_pos_and_line_end(0, 1) == (0, 18)
-    assert dbitmap.compute_pos_and_line_end(1, 1) == (18, 36)
-    assert dbitmap.size() == 5
 
 @py.test.mark.skipif("socket.gethostname() == 'precise32'")
 def test_weak_pointers():
diff --git a/spyvm/test/test_objectspace.py b/spyvm/test/test_objectspace.py
--- a/spyvm/test/test_objectspace.py
+++ b/spyvm/test/test_objectspace.py
@@ -40,7 +40,7 @@
     => 27670116110564327424
     """
 
-    from rpython.rlib.rarithmetic import r_uint
+    from rpython.rlib.rarithmetic import r_uint32 as r_uint
     for num in [0, 1, 41, 100, 2**31, sys.maxint + 1, -1]:
         num = r_uint(num)
         assert space.unwrap_uint(space.wrap_uint(num)) == num
diff --git a/targetimageloadingsmalltalk.py b/targetimageloadingsmalltalk.py
--- a/targetimageloadingsmalltalk.py
+++ b/targetimageloadingsmalltalk.py
@@ -5,9 +5,8 @@
 from rpython.rlib import jit, rpath
 
 from spyvm import model, interpreter, squeakimage, objspace, wrapper,\
-    error, shadow
+    error, shadow, system
 from spyvm.tool.analyseimage import create_image
-from spyvm.interpreter_proxy import VirtualMachine
 
 
 def _run_benchmark(interp, number, benchmark, arg):
@@ -224,6 +223,9 @@
     if hasattr(rgc, "stm_is_enabled"):
         driver.config.translation.stm = True
         driver.config.translation.thread = True
+    driver.exe_name = "rsqueakvm"
+    if system.IS_64BIT:
+        driver.exe_name += "-64"
     return entry_point, None
 
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to