Incorrect Java methods called from CNI

Dave Menendez dave@sycamore.us
Mon May 10 23:23:00 GMT 2004


On Mon, 2004-05-10 at 18:12, Bryce McKinlay wrote:
> Dave Menendez wrote:
> 
> >	movl	(%eax), %edx
> >	addl	$56, %edx
> >	movl	-12(%ebp), %eax
> >	movl	%eax, (%esp)
> >	movl	(%edx), %eax
> >	call	*%eax
> >
> >  
> >
> Looks like this is the call in question. Its offseting the vtable 
> pointer by 56 bytes.
> 
> Heres the vtable, run through c++filt, cleaned up a bit, and with byte 
> offsets added:
> 
> -8    .long    0
> -4    .long    0
>  0    .long    Classification.class$
>  4    .long    -37748735
>  8    .long    java.lang.Object.finalize()
>  12    .long    hashCode()
>  16    .long    equals(java.lang.Object)
>  20    .long    toString()
>  24    .long    clone()
>  28    .long    addClassificationListener(ClassificationListener)
>  32    .long    fireClassificationChange()
>  36    .long    getNumberOfListeners()
>  40    .long    isImmutable()
>  44    .long    removeAllListeners()
>  48    .long    removeClassificationListener(ClassificationListener)
>  52    .long    getClassification()
>  56    .long    add(Marking)
>  60    .long    clear()
>  64    .long    clearMarkings()
>  68    .long    combine(Classification)
>  72    .long    compareTo(Classification)
>  76    .long    contains(java.lang.Object)
> 
> So, its obviously going to call add() - the offset to call clear() 
> should be 60. For some reason, the C++ compiler's idea of where the 
> method is in the vtable doesn't match the Java compiler's. Can you post 
> the relavent portions of the .h file for this class, and the method 
> declarations from the Java source code (not the code itself, just the 
> name & access modifiers etc)?
> 
> Bryce
> 

I've attached both the C++ header generated by gcjh and the declarations
from the original java source, cleaned up a bit, but in the same order
in which they appear in both files.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Classification.h
Type: text/x-c-header
Size: 6688 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040510/5a981417/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Classification.java
Type: text/x-java
Size: 6175 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040510/5a981417/attachment-0001.bin>


More information about the Java mailing list