------- Additional Comments From green at redhat dot com 2005-04-20 05:06 ------- I think I see the problem here. The call in Test.java...
t.test(false, "FALSE"); ...gets compiled into: mov %eax,0x8(%esp) ; movb $0x0,0x4(%esp) ; false boolean value mov %edx,(%esp) ; call *%ecx Notice that we're only storing a byte into the word here at 0x4(%esp). The "raw" libffi interface assumes that the call stack from the native code is exactly what we'd see on the bytecode stack. This obviously isn't the case, since, IIRC, booleans are represented as full words on the stack. And, indeed, when we get the value of the boolean argument we're doing a LOADI from memory copied from the 0x4(%esp). Three quarters of that word are complete garbage, so the value of our LOADI is unknown (and, for those of us seeing failures, non-zero). Possible fixes include: - promoting booleans to words for function calls - "fixing up" boolean args for raw calls - don't use the raw call mechanis I like the first option, but will it cause problems with CNI code? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21115