Author: Lars Wassermann <[email protected]>
Branch: 
Changeset: r253:26ab2618ed58
Date: 2013-04-10 21:30 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/26ab2618ed58/

Log:    (cfbolz, lwassermann): refactored wrap_uint to enable inlining the
        general case added hint to unwrap_array to enable unrolling for
        common case of constant array

diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -193,11 +193,14 @@
         if bytes_len <= 4:
             return self.wrap_positive_32bit_int(intmask(val))
         else:
-            w_result = model.W_BytesObject(self, 
-                        self.classtable['w_LargePositiveInteger'], bytes_len)
-            for i in range(bytes_len):
-                w_result.setchar(i, chr(intmask((val >> i*8) & 255)))
-            return w_result
+            return self._wrap_uint_loop(val, bytes_len)
+
+    def _wrap_uint_loop(self, val, bytes_len):
+        w_result = model.W_BytesObject(self,
+                    self.classtable['w_LargePositiveInteger'], bytes_len)
+        for i in range(bytes_len):
+            w_result.setchar(i, chr(intmask((val >> i*8) & 255)))
+        return w_result
 
     def wrap_positive_32bit_int(self, val):
         # This will always return a positive value.
@@ -298,6 +301,8 @@
         if not isinstance(w_v, model.W_PointersObject):
             raise UnwrappingError()
         return w_v
+
+    @jit.look_inside_iff(lambda self, w_array: jit.isconstant(w_array.size()))
     def unwrap_array(self, w_array):
         # Check that our argument has pointers format and the class:
         if not w_array.getclass(self).is_same_object(self.w_Array):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to