native methods and static build

Godmar Back gback at cs.utah.edu
Sun Oct 25 17:52:28 PST 1998


 Hi Senthil,

>
> My understanding is that using native
> methods is not possible when doing a static compiler
> of Kaffe. Is this correct?

 No.  See, however, below.         

>
> I basically, built my .o, created a .so file. Everything
> is OK, when I try the dynamic linked Kaffe, but it fails
> with a static build.

 The dynamic linking mechanism is disabled in the static configuration.      
It's an either or thing at this point (feel free to fix that! ---
btw, if you feel like making your jit/intr mix available, that would be
great too!  I agree with Pat that it's excellent work.)

In order to use native methods in a static configuration, you have to
a) make sure the libraries are added to the kaffe link command line.
b) add entries to the external.h file.  Look at 
  libraries/clib/external_native.h, libraries/clib/external_wrappers.h
  and friends.

>
> Also, in the TODO section of Kaffe, it says that the
> linux/sparc ports are broken because of some problem
> with setjmp. What exaclty is the problem?

 This comment was removed by Tim because he fixed that problem.
Make sure you're looking at the latest CVS.

> 
> Basically, I still have some problems with exceptions
> when I selectively JIT/interpret methods and hte
> problem seems to be in the JNI code, it appears
> as if exceptions are not correctly propagating out of JNI code.
> 

 Yes, it is true that exceptions thrown in JNI code are passed to
the caller.  The caller has then the possibility to either rethrow
them or ignore and clear them.  Look at the JNI spec for details.
Secondly, look at Method.invoke in Method.c for an example of 
how exceptions are caught in JNI and then propagated.

Now it could certainly be that exceptions are not propagated properly:
it would be beneficial if you came up with a test case and described
how it should work, but does not.  However, exception handling in JNI
is different, it would be good if you looked at the JNI spec first 
and then said whether there is a bug or not.

	- Godmar



More information about the kaffe mailing list