|
From: <bc...@wo...> - 2001-10-18 16:08:17
|
[Alexandre Petit-Bianco] >I recently managed to compile jython natively on a linux/x86 box using >gcj (http://gc.gnu.org/java) the Gnu native Java compiler. Interesting! >We're interested in including jython into our RHUG project >(http://sources.redhat.com/rhug) That is an impressive list already. >I'm also hoping to hack jythonc to >wrap gcj so that native shared object can be generated from the class >files jythonc emits. These shared object could be loaded by the jython >binary to be executed instead of being interpreted (we can support >both seamlessly.) This would yield to a working native Python >compiler. > >I can build SimpleEmbedded and jython as standalone binaries, and they >seem to run: > > apbianco@venonat[~/.../jython]: ./test_SimpleEmbedded > Hello, brave new world > sys module > 42 > x: 4 > Goodbye, cruel world > apbianco@venonat[~/.../jython]: ./test_jython > Jython 2.1a3 on java0.0.7 (JIT: null) > >>> print "Hello world" > Hello world > >>> ^D > >pystone seems to run and yields to following results: > > apbianco@venonat[~/.../jython]: ./test_jython pystone.py > > Pystone(1.1) time for 10000 passes = 9.984 > This machine benchmarks at 1001.6 pystones/second > >It's on a PIII/450 with 384MB of RAM. The jdk1.1.8 interpreted jython >gave roughly 660 (a jdk1.2pre on a slightly faster machine yielded >700), the installed python interpreter (Python 1.5.2) gave 4400. Generally the pystone test is not sufficiently long running to take advantage of the JIT compilers in later JDKs. By tuning the number of passes to suite JIT compiler (and using the server hotspot), we have seen JDK1.4 produce pystone numbers around and above python-1.5.2. >I built the 2.1a3 and got the sources by first installing it >somewhere. I then imported the content of the install directory where >I wanted my sources to be and worked from there. > >The first successful build was based on a week old snapshot (I noted >that while 2.1a3 had only one entry in Lib/test, the snapshot had >several,) I then switched over 2.1a3. > >I got interested in running the tests in Lib/test from the snapshot >(using the single entry point testall.py and I ran into the following >problems: > >[standard modules can't be found] In normal operations, the python.path is initialised based on the python.home property. If python.home is not set, the classpath is searched for a jython.jar file and that directory is used as python.home. I would guess that you will have to set python.home in your startup script. >So despite the initialization of jython.path, I still can't see some >libraries, I have to start jython right where the libraries are. > >And then I hit an error I don't understand. unlink is seemingly >defined to be equivalent to remove in javaos.py. I tried to just >re-define unlink to be like remove, it didn't help. I tried to remove >the mention of `import unlink' in test_support.py:43, it didn't help. The os & javaos modules are very special. The "os" isn't a python module but a builtin java module which tries to import the javaos.py module. That may cause errors in javaos to be silently ignored and as a result the "os" might be empty. regards, finn |