JNIPort for VisualWorks update

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

JNIPort for VisualWorks update

Joachim Geidel
Hello world,

I have uploaded an update of JNIPort for VisualWorks to the Cincom
Public Repository. JNIPort lets you call Java from VisualWorks.

I am a bit more confident now that I can publish version 1.0 before
reaching 0.99. ;-)

Best regards,
Joachim Geidel

What you need to load:
----------------------
From the public repository, load the latest versions of:
  Registry
  FastCMethodPointers
  Weaklings
  JNIPort Prerequisites
  JNIPort
  JNIPort Tests
  JNIPort Tools
You will also need the files in the Extras directory contained in the
complete download of the Dolphin Smalltalk version of JNIPort:
  http://www.metagnostic.org/DolphinSmalltalk/JNIPort-Complete.zip
Documentation:
  http://www.metagnostic.org/DolphinSmalltalk/JNIPort.html
There is a JNIPort Settings Tool which can be opened from the
VisualLauncher's Tools menu, and a help window with instructions for a
quick start and an example for using the java.util.logging package.

Bug fixes:
----------
- Finalization of JavaClassInstances is working. Earlier versions never
released references to Java objects, i.e. they leaked memory.
- WeakSets - like normal Sets - relied on being able to compare their
elements and compute their hash values when removing dead instances
during finalization, after garbage collection. This does not work for
JavaClassInstances, as comparison and hash value computation would call
JNI functions, and at finalization time, the references to the Java
objects had already been released. WeakSets have been modified such that
they can finalize elements without comparing them or computing their
hash value.
- The previous version ran into a weird NonBooleanReceiver
error when starting a JVMWithCallbacks with lazy ghost class generation
- this does not happen any more. It seems that it was not really caused
by a bug of JNIPort, but by a configuration problem which resulted in
starting a Java 6 VM, but loading the Java classes from my JRE 1.5. This
somehow corrupted memory.
- Improvements for Inspectors opened on dead Java objects.

Limitations:
------------
- Due to a bug of Sun's Java 5 VM, using the Java VM option
"-Xcheck:jni" will lead to fatal errors in the Java VM. If you use the
JVM abort hook, it will be reported to VisualWorks before the JVM exits.
Unfortunately, this will terminate the VisualWorks process as well. The
problem is fixed in Java 6. See
  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6221510
for details. (This one took me days to find...) So, if you are using
Sun's Java 5 VM, don't use -Xcheck:jni.

Known bugs:
-----------
- Callbacks from Java to Smalltalk do not work yet (but the JVM hooks
for vfprintf, abort and exit do).
- I have not yet been able to produce loadable parcels from JNIPort
packages / bundles which contain the subclasses of ExternalInterface due
to problems with parcel loading and ExternalInterfaces. This means that
for the time being, you will not be able to deploy JNIPort as parcels,
but must load it into the image before creating a runtime image.
- There could be a race condition when finalization and shutdown of a
JVM attempt to release the same JavaClassInstance at the same time.

Missing features:
-----------------
- If you want to use the DolphinJNIHelper on platforms other than
Windows, you have to compile it yourself. There are no makefiles or
instructions for doing this.
- The tools which Chris Uppal has written for the Dolphin Smalltalk
version of JNIPort, from which JNIPort for VisualWorks is derived, are
not available in VisualWorks. To get an impression, have a look at the
documentation at
http://www.metagnostic.org/DolphinSmalltalk/JNIPort.html. In particular,
tools for browsing the wrapper classes which are generated, and for
creating "real" wrapper classes from dynamically generated ghost classes
should be added. Monitoring tools would be useful, too.
- Documentation for using the JVM hooks and handling events triggered by
different components of JNIPort.
- It might be a good idea to add the non-Smalltalk files (jar files and
their source code, documentation, DolphinJNIHelper) to the JNIPort
bundle such that they are versioned in synch with the Smalltalk code.