Hi Niko, hi all! I've read in the IRC logs that there has been a bit of discussion about what genjvm still lacks in order to translate pypy. Some weeks ago I also tried to translate pypy-jvm; it seems that the two most important missing features are r_dict and weakrefs. The good news is that with some hacks it's possible to get a pypy version that doesn't make use of r_dict or weakrefs: have a look at this IRC log: http://tismerysoft.de/pypy/irc-logs/pypy/%23pypy.log.20070307 The bad news is that even with those changes, jvm crashed because of a failed assertion, then I gave up. I've no clue what it's going wrong, but maybe it's not something terribly wrong to fix. I hope that this infos can help you in some way :-). ciao Anto
The bad news is that even with those changes, jvm crashed because of a failed assertion, then I gave up. I've no clue what it's going wrong, but maybe it's not something terribly wrong to fix.
I hope that this infos can help you in some way :-).
I'll look into it, thanks! I think implementing rdicts and weakrefs would probably be pretty easy, so maybe I will just do that. I've been itching to get back to PyPy-hacking anyhow! Niko
Niko Matsakis wrote:
The bad news is that even with those changes, jvm crashed because of a failed assertion, then I gave up. I've no clue what it's going wrong, but maybe it's not something terribly wrong to fix.
I hope that this infos can help you in some way :-).
I'll look into it, thanks! I think implementing rdicts and weakrefs would probably be pretty easy, so maybe I will just do that. I've been itching to get back to PyPy-hacking anyhow!
Ok, good to know :-). The last time I checked what java's Hasttable offers and I saw you can't pass to it custom hashing and equality functions, but maybe there is a simple way to do it that I don't know. Btw, good work on genjvm :-). ciao Anto
The last time I checked what java's Hasttable offers and I saw you can't pass to it custom hashing and equality functions, but maybe there is a simple way to do it that I don't know.
No, there isn't, but it shouldn't be too hard to cook up some kind of Hashtable substitute that uses small wrapper classes to handle that. I think that's what you did for C#, right? Niko
Niko Matsakis wrote:
The last time I checked what java's Hasttable offers and I saw you can't pass to it custom hashing and equality functions, but maybe there is a simple way to do it that I don't know.
No, there isn't, but it shouldn't be too hard to cook up some kind of Hashtable substitute that uses small wrapper classes to handle that. I think that's what you did for C#, right?
No, for .NET it was simpler because the standard Dictionary type also accepts an optional class that implements the custom functions, so all I need to do is to create a class for each unique pair of equality and hashing functions (see cli/comparer.py). ciao Anto
Hey guys, (and everyone else) I was working on an autonomic computing project using JDK6, and in the middle decided to switch up to hacking on PyPy and seeing if I could get a semi-functioning JSR-223 bindings by the end of the week. I svn uped, and wanted know if this release has any of the work the at you guys did? If not, let me know, and i'll get working so we can get a JVM translated PyPy Paul On 4/1/07, Antonio Cuni <anto.cuni@gmail.com> wrote:
Niko Matsakis wrote:
The last time I checked what java's Hasttable offers and I saw you can't pass to it custom hashing and equality functions, but maybe there is a simple way to do it that I don't know.
No, there isn't, but it shouldn't be too hard to cook up some kind of Hashtable substitute that uses small wrapper classes to handle that. I think that's what you did for C#, right?
No, for .NET it was simpler because the standard Dictionary type also accepts an optional class that implements the custom functions, so all I need to do is to create a class for each unique pair of equality and hashing functions (see cli/comparer.py).
ciao Anto _______________________________________________ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
No, for .NET it was simpler because the standard Dictionary type also accepts an optional class that implements the custom functions, so all I need to do is to create a class for each unique pair of equality and hashing functions (see cli/comparer.py).
So, on a whim I implemented a "RDict" class for the JVM that does the necessary adaptation. (It consists almost entirely of generic type declarations and no actual code ;) I haven't integrated it into the Python code yet, looking to see where best to do that. Are most of the tests for custom dicts in test_objectmodel? Also, why are they called "rdicts" in some places, and "custom dicts" in others? Or is there a distinction I am missing? Niko
Some weeks ago I also tried to translate pypy-jvm; it seems that the two most important missing features are r_dict and weakrefs.
Ok, I implemented r_dicts now and checked it in. Not too much work, actually, ended up fitting fairly naturally into the existing code. I guess I'll look at weakrefs next, though no promises as to when that will be. :) Niko
Niko Matsakis wrote:
Some weeks ago I also tried to translate pypy-jvm; it seems that the two most important missing features are r_dict and weakrefs.
Ok, I implemented r_dicts now and checked it in. Not too much work, actually, ended up fitting fairly naturally into the existing code. I
Hi Niko! This is very cool! :-) Most of r_dict tests are in test_objectmodel, though you may want to have also a look at rpython/test/test_rconstantdict. About the distinction between r_dict and "custom dict": do you find any place where they are used interchangeably? I would say that r_dict referes so the rpython-level type (objectmodel.r_dict), while "custom dict" should refer to the low level type used by the rtyper (ootype.CustomDict). Also, probably CustomDict would be a better name than RDict for your java class, I guess.
guess I'll look at weakrefs next, though no promises as to when that will be. :)
Adding weakrefs to gencli was very simple: I just needed to map lltypesystem.llmemory.WeakGcAddress to 'System.WeakReference', add the straightforward support for constants to cli/constant.py and add the also straightforward 'cast_ptr_to_weakadr' and 'cast_weakadr_to_ptr' operations in opcodes.py. I don't know for jvm, but I guess it would not be much more complicate. ciao Anto
Most of r_dict tests are in test_objectmodel, though you may want to have also a look at rpython/test/test_rconstantdict.
Ah, ok.
About the distinction between r_dict and "custom dict": do you find any place where they are used interchangeably?
I guess not. I just wasn't clear if they should be usable interchangeably or not. As it happens, I renamed my Java class to CustomDict anyhow, because it was an implementation of the ootype.CustomDict, so it seemed right.
Adding weakrefs to gencli was very simple: I just needed to map lltypesystem.llmemory.WeakGcAddress to 'System.WeakReference', add the straightforward support for constants to cli/constant.py and add the also straightforward 'cast_ptr_to_weakadr' and 'cast_weakadr_to_ptr' operations in opcodes.py. I don't know for jvm, but I guess it would not be much more complicate.
Cool, I'll check it out. Niko
participants (3)
-
Antonio Cuni
-
Niko Matsakis
-
Paul deGrandis