JPL/Kaffe changes committed (was Re: Making JPL work with Kaffe)

[email protected] ("Bradley M. Kuhn") Mon, 18 Dec 2000 15:45:53 -0500
Newsgroups perl.jpl
Message-ID <[email protected]>
I have committed the changes to make JPL work with Kaffe.  I only got the
JNI part (calling Java from Perl) working.

The key changes were to the configuration scripts in JNI/; few changes to
JNI.xs were needed.

Note that support is fragile---some exceptions do odd things, like cause
deadlocks.  I am not sure where these bugs are (i.e., Kaffe or perl), but
the JNI.xs code is so simple, that I don't think the bug is there.

I noticed it most when I try to call methods that don't exist (due to a typo
or something like that).  Does doing that sort of thing work correctly under
the proprietary software Java implementations?
 

Anyway, despite this minor "fragility", I am now using this JNI-Kaffe
support to bootstrap perljvm.  I am instantiating large Java data structures
via Kaffe without a problem.  So, it seems that as long as you are careful
to avoid typos and check JNI::ExceptionOcccured in the right places, there
are no problems.

BTW, feel free to check out the perljvm project
(http://www.ebb.org/perljvm/) to see how I am using JPL there.  I will have
a commit to perljvm's CVS (which is mostly empty right now) later today.


Finally, I have a few suggestions for JPL if someone feels like hacking:

    * It would be nice if there were more support via JPL::Class for static
      fields and methods.  Really the only way to play with public static
      fields and methods is to go directly to JNI::*.  Also, this same
      problem happens for setting non-static fields.

    * The build and configuration process needs to be cleaned up more.  This
      "JAVA_HOME"-centric method simply doesn't fit anymore with the way
      Java environments are typically installed these days (at least the
      free software ones).  If you are interested in this, please take a
      look at what I did with JNI::Config, which I think is a good start.

    * Get Kaffe support for calling Perl from Java.

    * Find out why Kaffe deadlocks sometimes if you aren't very careful (see
      above).

    * The support for Java arrays <=> Perl arrays isn't that good.  It would
      be nice if you could just:

               use JPL::Class '[java.something'; 

      And be able to make tied arrays of some sort that contained objects
      blessed into java.something.

-- 
Bradley M. Kuhn  -  http://www.ebb.org/bkuhn
signature.asc (application/pgp-signature, 232 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6PneA53XjJNtBs4cRAtfxAKC7hhTBJ6xgpc/MPoLGMCDGERICDQCgtH5S
YXD34cU6k4Q62yDRpfJCKA0=
=Ft/H
-----END PGP SIGNATURE-----