Incorrect Java methods called from CNI

Bryce McKinlay mckinlay@redhat.com
Mon May 10 22:12:00 GMT 2004


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




More information about the Java mailing list