From owner-freebsd-java@FreeBSD.ORG Wed Mar 19 05:57:34 2008 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A65C106566B for ; Wed, 19 Mar 2008 05:57:34 +0000 (UTC) (envelope-from glewis@eyesbeyond.com) Received: from misty.eyesbeyond.com (gerbercreations.com [71.39.140.16]) by mx1.freebsd.org (Postfix) with ESMTP id 1277B8FC13 for ; Wed, 19 Mar 2008 05:57:33 +0000 (UTC) (envelope-from glewis@eyesbeyond.com) Received: from misty.eyesbeyond.com (localhost.eyesbeyond.com [127.0.0.1]) by misty.eyesbeyond.com (8.13.1/8.13.3) with ESMTP id m2J5vWB8019920; Tue, 18 Mar 2008 22:57:32 -0700 (PDT) (envelope-from glewis@eyesbeyond.com) Received: (from glewis@localhost) by misty.eyesbeyond.com (8.13.1/8.13.3/Submit) id m2J5vWCu019919; Tue, 18 Mar 2008 22:57:32 -0700 (PDT) (envelope-from glewis@eyesbeyond.com) X-Authentication-Warning: misty.eyesbeyond.com: glewis set sender to glewis@eyesbeyond.com using -f Date: Tue, 18 Mar 2008 22:57:31 -0700 From: Greg Lewis To: Peter Jeremy Message-ID: <20080319055731.GA19887@misty.eyesbeyond.com> References: <20080316223054.GA46447@server.vk2pj.dyndns.org> <20080317133144.GA4473@misty.eyesbeyond.com> <20080318061525.GQ44676@server.vk2pj.dyndns.org> <20080318214106.GA69742@server.vk2pj.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080318214106.GA69742@server.vk2pj.dyndns.org> User-Agent: Mutt/1.4.2.2i Cc: freebsd-java@freebsd.org Subject: Re: jdk15/javaws on amd64 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Mar 2008 05:57:34 -0000 G'day Peter, On Wed, Mar 19, 2008 at 08:41:06AM +1100, Peter Jeremy wrote: > On Tue, Mar 18, 2008 at 05:15:25PM +1100, Peter Jeremy wrote: > >I've done some poking at it with both some printf()s and gdb and it > >appears to be a gcc bug - in fact, I'm surprised it works at all... > > > >The relevant function is GetBootClassPath(): > >char* GetBootClassPath(void) { > > static char bootclasspath[MAXPATHLEN]; > >#ifdef _DEBUG > > sprintf(bootclasspath, "%s%c%s%c%s%c%s", > > sysGetJarLib(), FILE_SEPARATOR, "javaws_g.jar", > > PATH_SEPARATOR, sysGetJarLib(), FILE_SEPARATOR, "deploy_g.jar"); > >#else > > sprintf(bootclasspath, "%s%c%s%c%s%c%s", > > sysGetJarLib(), FILE_SEPARATOR, "javaws.jar", > > PATH_SEPARATOR, sysGetJarLib(), FILE_SEPARATOR, "deploy.jar"); > >#endif > > return bootclasspath; > >} > > I've done a bit more investigating and the problem is that > sysGetJarLib() returns char*, and this is assumed by the above code. > But there is no prototype in scope for the above code so gcc assumes > that sysGetJarLib() returns int and passes it to sprintf as an int. > > Looking further, there is no prototype for sysGetJarLib() anywhere in > the source code - or, for that matter many of the other functions in > deploy/src/javaws/share/native/system.c that also return char*. > > This code can't work correctly on any platform where > sizeof(int) != sizeof(void*) so I'm not quite sure how Sun make it > work on Sun SPARC... I've had javaws work on amd64 for 1.5, so my guess would be that earlier versions of gcc have just been more lenient here. It wasn't enabled for amd64 without trying it :). Also, its quite possible that it wasn't working on Solaris/Sparc64 since we're the first OS to include the browser plugin and javaws on a 64 bit platform. > I'm currently trying to rebuild Java with -Wall to see how many of > these sorts of bugs exist. In the meantime, I would suggest that > java is broken on any 64-bit architecture. I suspect the number is very few in the main code which is solidly tested on 64 bit platforms. HotSpot is compiled with -Werror and much of the rest of the main code is compiled with -Wall. The plugin and javaws are a different matter though and if there are lurking bugs of this type they are most likely there. As above, we're the first ones to enable them on amd64, so its quite possible some bugs were missed in porting as the plugin in particular took a lot of work to get working on a 64 bit platform. -- Greg Lewis Email : glewis@eyesbeyond.com Eyes Beyond Web : http://www.eyesbeyond.com Information Technology FreeBSD : glewis@FreeBSD.org