OpenGL works! Was: Re: GCJ and OpenGL under Win32
Ranjit Mathew
rmathew@gmail.com
Wed Jan 12 14:18:00 GMT 2005
Ranjit Mathew wrote:
>> I *think* I know what the problem is - the arguments'
> size is not being computed correctly - it does not
> affect Linux, but it does Win32.
[...]
> I had written this a long time ago (GCC 3.2/3.3-ish)
> when it *did* work correctly. In the current mainline,
> I see that for an integer argument (i686-pc-linux-gnu),
> TYPE_SIZE is 32, but TYPE_SIZE_UNIT is 4.
My analysis was wrong, but at least it helped find a bug
in the current implementation. :-)
I will be installing the attached patch as obvious, but
I was still curious about how JNI on Win32 managed to work
so far with this bug present. It turns out that the padding
logic:
#ifdef PARM_BOUNDARY
arg_bits = (((arg_bits + PARM_BOUNDARY - 1) / PARM_BOUNDARY)
* PARM_BOUNDARY);
#endif
makes arg_bits equal 32 (on i686-pc-linux-gnu) irrespective
of whether it was computed earlier as '4' (with TYPE_SIZE_UNIT)
or '32' (with TYPE_SIZE). :-/
And I checked Mohan's current GCJ 4.0 snapshot and it *does*
work with MSVC-style JNI exports...
So Sal I think there's something else that's wrong here...
Unfortunately, I cannot at the moment shed any more
light on this issue.
Ranjit.
Index: ChangeLog
from Ranjit Mathew <rmathew@hotmail.com>
* expr.c (build_jni_stub): Replace mistaken use of TYPE_SIZE_UNIT
with TYPE_SIZE.
Index: expr.c
===================================================================
--- expr.c 2005年01月12日 16:36:07.000000000 +0530
+++ expr.c 2005年01月12日 17:00:25.000000000 +0530
@@ -2550,5 +2550,5 @@ build_jni_stub (tree method)
for (tem = method_args; tem != NULL_TREE; tem = TREE_CHAIN (tem))
{
- int arg_bits = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (tem)));
+ int arg_bits = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)));
#ifdef PARM_BOUNDARY
arg_bits = (((arg_bits + PARM_BOUNDARY - 1) / PARM_BOUNDARY)
More information about the Java
mailing list