This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: OpenGL works! Was: Re: GCJ and OpenGL under Win32


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]