Fixes for 'pep', the Java VM in Self

Chris Double chris.double at double.co.nz
Wed Sep 18 09:40:38 UTC 2013


I've done a pull request with some bitrot fixes for 'applications/pep':

<https://github.com/russellallen/self/pull/14>

These changes allow loading some Java class files that have been
compiled with recent JVM's. Simple test cases work but I've been unable
to get java.lang.System.out to work. This seems to require calling
'initializeSystemClass' and I've added this where I think it should go
but I get an infinite loop when using it. I'm still debugging this but
thought I'd make what works at the moment available.

When testing, ensure that before starting Self you have your CLASSPATH
environment variable set to the location of the Java class library
.class files and the 'objects/applications/pep' directory. Something
like:

    export CLASSPATH=/home/me/self/objects/applications/pep:/home/me/jvm/classes'

I obtained the Java library classes by extracting the contents of
'rt.jar' from a local java installation.

To test 'SimpleTest1' and 'SimpleTest2' make sure they're compiled:

    cd objects/applications/pep
    javac SimpleTest1
    javac SimpleTest2

To load 'pep' in self:

    bootstrap read: 'pep' From: 'applications/pep'

To test SimpleTest1 and SimpleTest2:

    pep tests testSimpleTest1
    pep tests testSimpleTest1

To test an arbitary Java class file:

    pep tests testClassNamed: 'Foo'

To view loaded classes and drill down to see their methods and converted Self code, etc:

    pep loadedClasses class_java_lang_System

Chris.
-- 
http://www.bluishcoder.co.nz



More information about the Self-interest mailing list