Re: RFA: libjava seems to miss some files for win32

Andrew Haley <[email protected]>
Newsgroups gmane.comp.gcc.java.devel,gmane.comp.gcc.devel
Message-ID <[email protected]>
On 07/19/2009 02:29 PM, Dave Korn wrote:
> Kai Tietz wrote:
> 
>> There are a lot of issues about casting HANDLE values into jint types,
>> which is for x86 valid, but for x64 can lead potential to pointer
>> truncations. Those part need some review by libjava maintainers. My
>> patch simply casts those kind of pointers via __UINTPTR_TYPE__ into
>> integer scalar before casting it into jint. I put comments at those
>> places, where some rework is necessary.
> 
>   Argh.  You're replacing a bunch of warnings that draw attention to a real
> problem by a bunch of silent fixmes in the code.  That's a bit scary to me.

Me too.  That patch will not be accepted.

>> Index: gcc/libjava/gnu/java/net/natPlainSocketImplWin32.cc
>> ===================================================================
>> --- gcc.orig/libjava/gnu/java/net/natPlainSocketImplWin32.cc	2009-07-19 12:06:54.200476000 +0200
>> +++ gcc/libjava/gnu/java/net/natPlainSocketImplWin32.cc	2009-07-19 12:13:45.727476500 +0200
>> @@ -58,7 +58,8 @@
>>  
>>    // We use native_fd in place of fd here.  From leaving fd null we avoid
>>    // the double close problem in FileDescriptor.finalize.
>> -  native_fd = (jint) hSocket;
>> +  // Fixme, it isn't correct to cast a HANDLE to integer scalar here for x64
>> +  native_fd = (jint) (__UINTPTR_TYPE__) hSocket;
>>  }
> 
> 
>   Question is, can we change the sizes of the members of class objects, such
> as gnu::java::net::PlainSocketImpl::native_fd, or do these objects and their
> layout form part of an ABI, and/or do they ever get serialised?  The Java guys
> will be able to tell us.

Yes, you can change them.  Yes, they are part of an ABI.  native_fd should be
a jlong.

Andrew.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.