Robert S. Thau
rst at ai.mit.edu
Wed May 14 16:52:24 PDT 1997
Nelson Minar writes:
> Does this mean that the JNI standardizes things like the memory layout
> of objects?
Not quite. It standardizes an API which contains functions which you
can use to get at the contents of objects, but since there is a layer
of functions between JNI code and the VM, that imposes very few
constraints on the layout of the objects themselves.
Needless to say, this interface will have somewhat higher overhead
than some other interface which actually was cognizant of the layout
of objects on a particular VM, and could generate inline code. There
are functions to try to reduce this overhead for at least one case
where it *really* bites (access to elements of primitive arrays ---
there are functions which give you a pointer to a block of memory
which actually contains the elements, but that may work by
copy-out/copy-back, at the option of the implementation).
Still, Sun suggest that some implementations might want to support two
APIs --- the JNI interface coexisting with, and perhaps implemented on
top of, a *really* native interface which was directly cognizant of
the layout of the objects and other internal details.
More information about the kaffe