This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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


Sal wrote:
> Tom Tromey wrote:
> 
> 
>>Sal> I finally figured the problem out.  I rebuilt the SWT OpenGL dll with
>>Sal> mingw32, for some reason Sun's VM loads mangled names in JNI dlls and
>>Sal> GCJ doesn't.
>>
>>That is strange, since we have special Windows code in our JNI
>>implementation to do the mangling.  That is, if you mean mangling like
>>appending "@NNN" to the function name.  Can you describe more what is
>>going wrong?  What you expected, what the symbol names are, and what
>>they are after you recompiled?

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.

The relevant code in gcc/java/expr.c is:

  for (tem = method_args; tem != NULL_TREE; tem = TREE_CHAIN (tem))
    {
      int arg_bits = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (tem)));
#ifdef PARM_BOUNDARY
      arg_bits = (((arg_bits + PARM_BOUNDARY - 1) / PARM_BOUNDARY)
                  * PARM_BOUNDARY);
#endif
      args_size += (arg_bits / BITS_PER_UNIT);

      args = tree_cons (NULL_TREE, tem, args);
    }

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.

Have TYPE_SIZE and TYPE_SIZE_UNIT reversed their meanings
in recent times or was the original code wrong to
begin with?

I was an utter newbie to GCC at that time, so I could
very well have been grossly mistaken:

  http://gcc.gnu.org/ml/java/2002-11/msg00373.html

Thanks,
Ranjit.

-- 
Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA.    Web: http://ranjitmathew.hostingzero.com/


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