Re: Question on how JNI spec & you (+others?) conform to it.

[email protected] Mon, 17 Oct 2005 10:02:50 GMT
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <[email protected]>
> Hi John,
> 
> We implemented the JNI interface based on Liang's book (at least, I
> did), but only using the "specification" section of this book.  I have
> not really thought deeply about the matter of pending exception for each
> of the 11.8.2 list, though. 

But at least you are *aware* of it, so in you're case it's an implementation
issue rather than speccing one. My original question was, speaking as
experienced JVM implementors, do you think it reasonably likely that someone
would implement a fully-working JVM & runtime and remain unaware (as I was
unaware until very recently) that the online JNI Specification is not, in fact,
the *actual* Specification? (And that believing that it is will cause
"Liang-book-correct" JNI programs to go into Undefined Behaviour?)

> You could actually test SableVM's behavior

Sorry, I'm only set up with MSVC.

> The thing is that, if it fails, I see no easy way to implement
> Liang's book specified behavior, in which case, the online specification
> would actually make more sense.

I think it's taken as a given that if one encounters an exception in the process
of creating another one, then the former gets thrown (e.g. if you run out of
memory), so in the code for MonitorExit, if you've determined an illegal state,
you could have something along the lines of:

if (env->ExceptionCheck()) {
   env->ThrowNew(cls_IllegalMonitorStateException, "some message goes here");
}

(ThrowNew is specced to throw *something* no matter what, even if the
constructor fails.)

> It's not easy to find out what is the real specification of Java... More
> often than not, it would seem that Sun considers that their "reference"
> implementation is the specification, and the role of the books and
> online documents is simply to serve a guide to that "specification".

Nuts.

> Have fun!

Thanks!

John