[pypy-dev] Work on the JVM backend
Antonio Cuni
anto.cuni at gmail.com
Mon Jan 16 12:09:36 CET 2012
Hello Michał,
On 01/16/2012 01:00 AM, Michał Bendowski wrote:
> longlong2float and float2longlong turn out to be pretty straightforward in Java, so I implemented them and added tests. I tried to update the pull request to include this commit, but that crashed BitBucket :/ Maybe you can just pull it from my repo?
I reviewed your pull request. A few notes:
1. float2longlong & longlong2float can be implemented in a more direct way by
using Double.doubleToRawLongBits and Double.longBitsToDouble
2. in revision 25d4d323cb5f, you implemented _identityhash of builtin types by
returning hash(self). This is wrong, because as the name suggests, it needs to
return different hashes for objects which are not identical. For example, look
at the following code:
>>> from pypy.rlib import objectmodel
>>> a = 'foo'
>>> b = 'f'; b += 'oo'
>>> a == b
True
>>> a is b
False
>>> objectmodel.compute_identity_hash(a)
192311087
>>> objectmodel.compute_identity_hash(b)
-1955336075
The test should probably try to compute_unique_id of two strings which are
equal but not identical, and check that they are different
3. could you please transplant your checkins to some branch other than
default, e.g. jvm-improvements? This way I could just merge the pull request
and then run the test on buildbot, before doing the actual merge to default.
Apart from this, your patch looks very good :-)
ciao&thanks,
Antonio
More information about the pypy-dev
mailing list