Author: Tim Felgentreff <[email protected]>
Branch: 64bit
Changeset: r579:b7958e74bdbe
Date: 2014-01-14 17:12 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/b7958e74bdbe/

Log:    WIP/HACK: fix more tests

diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -15,7 +15,7 @@
 that create W_PointersObjects of correct size with attached shadows.
 """
 import sys, weakref
-from spyvm import constants, error
+from spyvm import constants, error, system
 
 from rpython.rlib import rrandom, objectmodel, jit, signature
 from rpython.rlib.rarithmetic import intmask, r_uint32, r_uint
@@ -24,6 +24,13 @@
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rsdl import RSDL, RSDL_helper
 
+if system.IS_64BIT:
+    from rpython.rlib.rarithmetic import widen
+else:
+    def widen(x):
+        return x
+
+
 class W_Object(object):
     """Root of Squeak model, abstract."""
     _attrs_ = []    # no RPython-level instance variables allowed in W_Object
@@ -881,8 +888,8 @@
         self.setword(index0, word)
 
     def getword(self, n):
-        # if n < 0:
-        #     import pdb; pdb.set_trace()
+        if self.size() <= n:
+            return r_uint(0)
         assert self.size() > n >= 0
         if self.words is not None:
             return self.words[n]
@@ -890,6 +897,8 @@
             return r_uint(self.c_words[n])
 
     def setword(self, n, word):
+        if self.size() <= n:
+            return
         if self.words is not None:
             self.words[n] = r_uint(word)
         else:
@@ -906,7 +915,7 @@
         return space.wrap_int(intmask(r_uint32(short)))
 
     def short_atput0(self, space, index0, w_value):
-        from rpython.rlib.rarithmetic import int_between, widen
+        from rpython.rlib.rarithmetic import int_between
         i_value = space.unwrap_int(w_value)
         if constants.LONG_BIT == 64:
             if (not int_between(0, i_value, 0x8000) and
@@ -1036,10 +1045,14 @@
         return w_result
 
     def getword(self, n):
+        if self.size() <= n:
+            return r_uint(0)
         assert self.size() > n >= 0
         return self._real_depth_buffer[n]
 
     def setword(self, n, word):
+        if self.size() <= n:
+            return
         self._real_depth_buffer[n] = word
         self.pixelbuffer[n] = r_uint32(word)
 
diff --git a/spyvm/plugins/bitblt.py b/spyvm/plugins/bitblt.py
--- a/spyvm/plugins/bitblt.py
+++ b/spyvm/plugins/bitblt.py
@@ -329,7 +329,7 @@
             dstShiftInc = -dstShiftInc
             dstShiftLeft = 32 - self.dest.depth
 
-        for i in range(self.bbH):
+        for i in range(self.bbH + 1):
             if self.halftone:
                 halftoneWord = r_uint(self.halftone[(self.dy + i) % 
len(self.halftone)])
             else:
@@ -355,7 +355,7 @@
                     self.dest.w_bits.setword(self.destIndex, destWord)
 
                 self.destIndex += 1
-                if (self.nWords == 2): # is the next word the last word?
+                if (word + 2 == self.nWords): # is the next word the last word?
                     self.destMask = self.mask2
                     nPix = endBits
                 else: # use fullword mask for inner loop
@@ -438,7 +438,7 @@
 
         # now loop over all lines
         y = self.dy
-        for i in range(1, self.bbH + 1):
+        for i in range(self.bbH + 1):
             if (halftoneHeight > 1):
                 halftoneWord = r_uint(self.halftone[y % halftoneHeight])
                 y += self.vDir
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -565,6 +565,9 @@
 
 @expose_primitive(SOME_INSTANCE, unwrap_spec=[object])
 def func(interp, s_frame, w_class):
+    # XXX: finding Symbols via someInstance is broken
+    if w_class.is_same_object(interp.image.w_asSymbol.getclass(interp.space)):
+        raise PrimitiveFailedError()
     match_w = get_instances_array(interp.space, s_frame, w_class)
     try:
         return match_w[0]
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
@@ -40,10 +40,7 @@
     return s_frame.pop()
 
 def w_l(largeInteger):
-    if largeInteger >= 0 and largeInteger <= constants.TAGGED_MAXINT:
-        return space.wrap_int(intmask(largeInteger))
-    else:
-        return model.W_LargePositiveInteger1Word(intmask(largeInteger))
+    return model.W_LargePositiveInteger1Word(intmask(largeInteger))
 
 # test that using W_LargePositiveInteger1Word yields the correct results.
 # we use this way of testing to have multiple different test which may fail
@@ -53,7 +50,7 @@
     try:
         w_selector = space.get_special_selector(selector)
     except Exception:
-        w_selector = find_symbol_in_methoddict_of(selector, 
w(intmask(candidates[0])).getclass(space)._shadow)
+        w_selector = find_symbol_in_methoddict_of(selector, 
w_l(intmask(candidates[0])).getclass(space)._shadow)
 
     interp.trace=trace
     for i, v in enumerate(candidates):
diff --git a/spyvm/test/test_zin_squeak_4_5_image.py 
b/spyvm/test/test_zin_squeak_4_5_image.py
--- a/spyvm/test/test_zin_squeak_4_5_image.py
+++ b/spyvm/test/test_zin_squeak_4_5_image.py
@@ -16,8 +16,8 @@
     s_methoddict.sync_cache()
     methoddict_w = s_methoddict.methoddict
     for each in methoddict_w.keys():
-        if each.as_string() == string:
-            return each
+        if each == string:
+            return w(each)
 
 def test_all_pointers_are_valid():
     tools.test_all_pointers_are_valid()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to