[pypy-dev] Does PyPy supports Java ME?

Antonio Cuni anto.cuni at gmail.com
Thu Oct 8 14:37:09 CEST 2009


Jan Wedel wrote:
> Hi Anto!
> 
> Thanks for your answer.

Hi Jan,
(I'm cc-ing pypy-dev again)


> Although it's now made by Sun, it shows the key points:
> - No class loading
> - No JNI
> - No reflection
> 
> Which means you cannot load dynamic code during run-time. On top, there 
> are a lot of libraries missing (XML parsing, Regex, logging...)

so far pypy-jvm doesn't use any of those, so it should not be a problem. 
However, in the future reflection will be surely needed to access java 
libraries (but you don't seem to be interested in it) and class loading for 
the jit.

> THAT might be a problem since we are working on memory constrained 
> systems with a maximum of a few MB of flash and approx. 200kB RAM. Are 
> there any estimations about the RAM usage of PyPy using classes and 
> other memory-consuming features?

I think that 200kB are definitely not enough for pypy-jvm.

I don't know for sure how to measure memory usage of java programs, but if I 
just launch pypy-jvm and measure the amount of memory used on linux, I get 
something like ~400 MB: this also includes the overhead of the jvm itself, but 
it's still a lot.

> And is this 8-10MB including only the core interpreter? Or are there any 
> ways to strip it down by excluding unnecessary libs?

it includes the core interpreter and the builtin modules; some of them can be 
stripped down, but I don't know how much you can save.

> I didn't make myself clear. I meant python libs/modules. E.g. sys, 
> socket, sre etc... Because if these modules are supported I won't need a 
> lot of Java Libraries. As I explained, I already ported PyMite to Java 
> and I discovered that numerous python modules have a C counterpart such 
> as _socket, _sre etc. So If you want to run these libs, you need to 
> translate these C files.

ah, now I understand. This is the complete list of builtin modules that are 
enabled for pypy-jvm:

[translation]     [usemodules]
[translation]         __pypy__ = True
[translation]         _ast = True
[translation]         _codecs = True
[translation]         _pickle_support = True
[translation]         _random = True
[translation]         _sre = True
[translation]         _testing = True
[translation]         _weakref = True
[translation]         cStringIO = True
[translation]         errno = True
[translation]         gc = True
[translation]         itertools = True
[translation]         marshal = True
[translation]         math = True
[translation]         md5 = True
[translation]         operator = True
[translation]         parser = True
[translation]         posix = True
[translation]         rbench = True
[translation]         sha = True
[translation]         symbol = True
[translation]         time = True
[translation]         token = True

As you can see, _socket is missing. It's surely possible to write a version of 
it that works for the jvm, but as usual it takes some time and nobody cared 
enough to implement it.


ciao,
Anto



More information about the Pypy-dev mailing list