[pypy-commit] lang-smalltalk default: changed return type of unwrap positive 32 bit int from int to r_uint
lwassermann
noreply at buildbot.pypy.org
Fri Jul 19 13:57:03 CEST 2013
Author: Lars Wassermann <lars.wassermann at gmail.com>
Branch:
Changeset: r505:cb9c370c7dae
Date: 2013-07-19 11:52 +0000
http://bitbucket.org/pypy/lang-smalltalk/changeset/cb9c370c7dae/
Log: changed return type of unwrap positive 32 bit int from int to r_uint
diff --git a/spyvm/interpreter_proxy.py b/spyvm/interpreter_proxy.py
--- a/spyvm/interpreter_proxy.py
+++ b/spyvm/interpreter_proxy.py
@@ -81,7 +81,8 @@
else:
return result
except error.PrimitiveFailedError:
- print '\t-> failed'
+ if IProxy.trace_proxy:
+ print '\t-> failed'
IProxy.failed()
from rpython.rlib.objectmodel import we_are_translated
if not we_are_translated():
@@ -417,7 +418,8 @@
@expose_on_virtual_machine_proxy([oop], int)
def positive32BitValueOf(n):
- return IProxy.space.unwrap_positive_32bit_int(n)
+ from rpython.rlib.rarithmetic import intmask
+ return intmask(IProxy.space.unwrap_positive_32bit_int(n))
# /* InterpreterProxy methodsFor: 'special objects' */
diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -287,9 +287,9 @@
def unwrap_positive_32bit_int(self, w_value):
if isinstance(w_value, model.W_SmallInteger):
if w_value.value >= 0:
- return w_value.value
+ return r_uint(w_value.value)
elif isinstance(w_value, model.W_LargePositiveInteger1Word):
- return w_value.value
+ return r_uint(w_value.value)
raise UnwrappingError("Wrong types or negative SmallInteger.")
def unwrap_char(self, w_char):
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -204,7 +204,7 @@
@expose_primitive(code, unwrap_spec=[pos_32bit_int, pos_32bit_int])
def func(interp, s_frame, receiver, argument):
res = op(receiver, argument)
- return interp.space.wrap_positive_32bit_int(res)
+ return interp.space.wrap_positive_32bit_int(rarithmetic.intmask(res))
make_func(op)
# #/ -- return the result of a division, only succeed if the division is exact
More information about the pypy-commit
mailing list