Question
Ted Neward
ted at tedneward.com
Tue Aug 7 18:57:37 PDT 2007
Lest there be any doubt, I'm in favor of a longer-term strategy, such as Volker's #2 option below, that both makes it easier for people to build the disassembler and for Sun (and later the OpenJDK community) to maintain the disassembler. Having said that, though, I'm also in favor of getting something into the build stream sooner rather than later, and if #1 is what's necessary to make that happen, then I'd see it as a step forward, even if (hopefully) it's only an interim step.
Having said that, I've never built a disassembler, and I'm only marginally aware of what "building against the binutils" means. Can somebody give me some resources on what this would look like? (I'm curious not just from a "building one for Java" perspective, but also just a generalized "how does the whole thing work" perspective.)
Ted Neward
Java, .NET, XML Services
Consulting, Teaching, Speaking, Writing
http://www.tedneward.com
> -----Original Message-----
> From: Volker Simonis [mailto:volker.simonis at gmail.com]
> Sent: Tuesday, August 07, 2007 10:24 AM
> To: Ted Neward
> Cc: Chuck.Rasbold at sun.com; hotspot-compiler-dev at openjdk.dev.java.net
> Subject: Re: Question
>
> Hi Ted, Chuck,
>
> some time ago I compiled a disassembler library for our internal use.
> Unfortunately it was build to work with the 1.5 JDK and contains some
> minor changes to the original SUN interface, so it wouldn't help you
> if I'd send it to you.
>
> But as a reaction to Chucks mail, I would strongly vote against the
> proposed proceeding of releasing only diffs against the latest GNU
> binutils. In my eys this would unneccesarily compilcate the build. And
> in some years it would be hard to get this 'latest' version of the GNU
> binutils.
>
> I see two alternatives:
>
> 1.) Quick and dirty: just incorporate a current version into OpenJDK.
> Now that OpenJDK is GPL, this shouldn't be that much of a problem.
> This approach isn't the cleanest from a software engineering point of
> view because of the code duplication. But fortunately, the opcodes of
> the CPUs won't change that much in the future, so I think, the problem
> will be manageable.
>
> 2.) Silver bullet: why not doing it right and just depend on
> 'libopcodes' from binutilities. This would need some minor hacking of
> the interface to the disassembler, but it would solve all the problems
> once and forever: support for virtually any architecture supported by
> binutils, always up to date (as long as the user has an up to date
> binutils installation) and no unnecessary code duplication.
>
> Any comments?
> Regards,
> Volker
>
>
> On 8/4/07, Ted Neward <ted at tedneward.com> wrote:
> > I'm not a great resource for advice on how to distribute and package
> things
> > in the open source world, but I'll certainly test whatever drops you
> make.
> > :-)
> >
> > Meanwhile, speaking simply for what would be easiest from my
> position, it
> > would be nice if you could instead, pull the GNU binutils bits
> necessary
> > into the OpenJDK source repositories (SVN or Mercurial or whatever),
> then
> > add your diffs and just merge in changes to binutils as they occur.
> > (Frankly, I don't see that there'd be all that many changes you'd
> need to
> > make, once the disassembler was in place, but maybe I'm shortsighted
> here.)
> >
> > Ted Neward
> > Java, .NET, XML Services
> > Consulting, Teaching, Speaking, Writing
> > http://www.tedneward.com
> >
> >
> > > -----Original Message-----
> > > From: Chuck.Rasbold at Sun.COM [mailto:Chuck.Rasbold at Sun.COM]
> > > Sent: Thursday, August 02, 2007 3:39 PM
> > > To: Ted Neward
> > > Cc: hotspot-compiler-dev at openjdk.dev.java.net
> > > Subject: Re: Question
> > >
> > > Ted -
> > >
> > > In early July, Sun's legal department gave the OK to open source a
> > > disassembler based on GNU binutils 2.17. Any delay in progress
> since
> > > then is purely my own fault, as I have been attending to other
> > > engineering duties.
> > >
> > > Based on advice I received so far, the plan is to start an OpenJDK
> > > subproject, and distribute the disassembler as a set of diffs and
> > > additions to the latest GNU binutils. To use with +PrintAssembly,
> one
> > > would get binutils, apply the source patches, build using the
> supplied
> > > makefile into a .dll or .so, and install the library into a known
> > > location.
> > >
> > > Internally, I still need to do some cleanup and testing of the
> > > disassembler...hopefully I haven't broken it moving it forward to
> > > 2.17.
> > >
> > > Externally, I need to figure out how the OpenJDK process works, and
> > > make sure the distribution and packaging method is reasonable. I am
> a
> > > novice in the open source world, and recommendations from those
> more
> > > experienced than me are welcome.
> > >
> > > -- Chuck
> > >
> > > Ted Neward wrote:
> > > > Two questions:
> > > > (*) Are we any further on this?
> > > > (*) What about disassembly under Linux or Solaris? Anybody have
> good
> > > > suggestions for a disassembler to use for -XX:+PrintAssembly?
> > > >
> > > > Ted Neward
> > > > Java, .NET, XML Services
> > > > Consulting, Teaching, Speaking, Writing
> > > > http://www.tedneward.com
> > > >
> > > >
> > > >
> > > >>-----Original Message-----
> > > >>From: Chuck.Rasbold at Sun.COM [mailto:Chuck.Rasbold at Sun.COM]
> > > >>Sent: Tuesday, April 17, 2007 3:25 PM
> > > >>To: Ted Neward
> > > >>Cc: hotspot-compiler-dev at openjdk.dev.java.net
> > > >>Subject: Re: Question
> > > >>
> > > >>I can't apologize enough on how long this is taking. We still
> working
> > > on
> > > >>it.
> > > >>
> > > >>-- Chuck
> > > >>
> > > >>Ted Neward wrote:
> > > >>
> > > >>>Any followup here? I'm still hoping to get the one that Sun
> uses,
> > > rather
> > > >>>than spend the energy/time/effort to write my own....
> > > >>>
> > > >>>Ted Neward
> > > >>>Java, .NET, XML Services
> > > >>>Consulting, Teaching, Speaking, Writing
> > > >>>http://www.tedneward.com
> > > >>>
> > > >>>
> > > >>>
> > > >>>>-----Original Message-----
> > > >>>>From: Ted Neward [mailto:ted at tedneward.com]
> > > >>>>Sent: Monday, January 15, 2007 4:30 PM
> > > >>>>To: hotspot-compiler-dev at openjdk.dev.java.net
> > > >>>>Subject: RE: Question
> > > >>>>
> > > >>>>Any word on getting this thing open-sourced? I know it's
> probably
> > > >>
> > > >>possible
> > > >>
> > > >>>>to build one for myself, but.... Oy. Would *much* rather not
> have to
> > > do
> > > >>>>that.
> > > >>>>
> > > >>>>Ted Neward
> > > >>>>Java, .NET, XML Services
> > > >>>>Consulting, Teaching, Speaking, Writing
> > > >>>>http://www.tedneward.com
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>>-----Original Message-----
> > > >>>>>From: Chuck.Rasbold at Sun.COM [mailto:Chuck.Rasbold at Sun.COM]
> > > >>>>>Sent: Thursday, December 07, 2006 2:44 PM
> > > >>>>>To: hotspot-compiler-dev at openjdk.dev.java.net
> > > >>>>>Subject: Re: Question
> > > >>>>>
> > > >>>>>Sun has a disassembler which is based on the disassembler
> source code
> > > >>>>
> > > >>>>from
> > > >>>>
> > > >>>>
> > > >>>>>a gdb
> > > >>>>>of many years past.
> > > >>>>>
> > > >>>>>The disassembler is built into a .so or .dll. Typically, I
> place that
> > > >>>>>disassembler.so file in the same directory as the libjvm.so of
> > > >>
> > > >>interest.
> > > >>
> > > >>>>>Other
> > > >>>>>times, on Solaris, I will set my LD_LIBRARY_PATH to include
> the
> > > >>>>
> > > >>>>directory
> > > >>>>
> > > >>>>
> > > >>>>>where
> > > >>>>>the .so resides. I'm not much of a Windows guy, so I can't
> advise
> > > you
> > > >>>>>there.
> > > >>>>>
> > > >>>>>Until now, the disassembler source has been kept separate from
> the
> > > >>>>
> > > >>>>HotSpot
> > > >>>>
> > > >>>>
> > > >>>>>source tree and the binary not distributed to customers in
> order to
> > > >>>>
> > > >>>>avoid
> > > >>>>
> > > >>>>
> > > >>>>>the
> > > >>>>>complications that would be incurred by Sun due to the GPL.
> > > >>>>>
> > > >>>>>Of course, the world is now different and due to an oversight,
> it was
> > > >>>>
> > > >>>>not
> > > >>>>
> > > >>>>
> > > >>>>>included when HotSpot was open sourced. We're currently
> working on
> > > >>>>>getting it
> > > >>>>>distributed with HotSpot.
> > > >>>>>
> > > >>>>>Hopefully, I've made things a bit clearer.
> > > >>>>>
> > > >>>>>-- Chuck
> > > >>>>>
> > > >>>>>Ted Neward wrote:
> > > >>>>>
> > > >>>>>
> > > >>>>>>So help me out here, if you don't mind--when you say I will
> "need
> > > the
> > > >>>>>>disassembler", you're saying I have to download (what?) and
> put it
> > > >>>>>
> > > >>>>>(where?)?
> > > >>>>>
> > > >>>>>
> > > >>>>>>Unfortunately, the link you sent, Steve, doesn't say much
> beyond
> > > that
> > > >>>>>
> > > >>>>>fact
> > > >>>>>
> > > >>>>>
> > > >>>>>>that the poster hacked it--I'm not sure what to do with it
> once I
> > > find
> > > >>>>>
> > > >>>>>it.
> > > >>>>>
> > > >>>>>
> > > >>>>>>Can I grab the GNU disassembler and use it, since I'm not in
> the
> > > same
> > > >>>>>
> > > >>>>>boat
> > > >>>>>
> > > >>>>>
> > > >>>>>>as Sun re: licensning and distribution issues?
> > > >>>>>>
> > > >>>>>>Bear in mind, I want to do this under Windows if I can; I
> dunno if
> > > >>>>
> > > >>>>that
> > > >>>>
> > > >>>>
> > > >>>>>>makes a difference.
> > > >>>>>>
> > > >>>>>>Sorry for being such the noob, but one hope I have is to sort
> > > through
> > > >>>>>
> > > >>>>>all
> > > >>>>>
> > > >>>>>
> > > >>>>>>this and put it into an article or paper or presentation and
> help
> > > >>>>
> > > >>>>others
> > > >>>>
> > > >>>>
> > > >>>>>to
> > > >>>>>
> > > >>>>>
> > > >>>>>>get into seeing all this stuff without having to wade through
> the
> > > same
> > > >>>>>
> > > >>>>>steps
> > > >>>>>
> > > >>>>>
> > > >>>>>>by hand. :-)
> > > >>>>>>
> > > >>>>>>Ted Neward
> > > >>>>>>Java, .NET, XML Services
> > > >>>>>>Consulting, Teaching, Speaking, Writing
> > > >>>>>>http://www.tedneward.com
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>>-----Original Message-----
> > > >>>>>>>From: Peter.Kessler at Sun.COM [mailto:Peter.Kessler at Sun.COM]
> > > >>>>>>>Sent: Tuesday, December 05, 2006 11:57 AM
> > > >>>>>>>To: hotspot-compiler-dev at openjdk.dev.java.net
> > > >>>>>>>Subject: Re: Question
> > > >>>>>>>
> > > >>>>>>>steve goldman wrote:
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>>Ted Neward wrote:
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>>>So one thing I'd like to see (via console output or some
> other
> > > >>>>>>>>>out-of-band
> > > >>>>>>>>>form of view) is the code generated by the JIT compiler
> when it
> > > >>
> > > >>JITs
> > > >>
> > > >>>>a
> > > >>>>
> > > >>>>
> > > >>>>>>>>>method. What's the best way for doing so?
> > > >>>>>>>>>
> > > >>>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>>You need two things, a "develop" version of hotspot and the
> > > >>>>>>>>disassembler. There is a flag -XX:+PrintAssembly which will
> > > attempt
> > > >>>>
> > > >>>>to
> > > >>>>
> > > >>>>
> > > >>>>>>>>dynamically load the disassembler and as various code blobs
> are
> > > >>>>>>>>generated will invoke the disassembler. The product version
> of
> > > >>>>
> > > >>>>hotspot
> > > >>>>
> > > >>>>
> > > >>>>>>>>doesn't enable this flag so you need to build a version
> that isn't
> > > >>>>
> > > >>>>the
> > > >>>>
> > > >>>>
> > > >>>>>>>>product (or convert the switch from "develop" to
> "product"). In
> > > any
> > > >>>>>
> > > >>>>>case
> > > >>>>>
> > > >>>>>
> > > >>>>>>>>I think you'll have to build the jvm. Additionally you need
> the
> > > >>>>>>>>disassembler. Unfortunately that got left out of the
> initial
> > > source
> > > >>>>>>>>release. The disassembler we use is based on the gnu
> disassembler
> > > >>
> > > >>and
> > > >>
> > > >>>>>>>>because it was gpl before hotspot was gpl'd it was kept
> separate
> > > >>
> > > >>from
> > > >>
> > > >>>>>>>>the hotspot code. That should be fixed soon I'd guess.
> There was a
> > > >>>>
> > > >>>>note
> > > >>>>
> > > >>>>
> > > >>>>>>>>here
> > > >>>>>>>>http://c1.complang.tuwien.ac.at/pipermail/cacao/2006-
> > > >>>>>>>
> > > >>>>>>>November/000195.html
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>>where someone hacked the cacao disassembler to get around
> this.
> > > The
> > > >>>>>>>>disassembler you build (.dll or .so) needs to go into the
> jvm (or
> > > >>>>>>>>somewhere in your LD_LIBRARY_PATH or equivalent) were it
> will get
> > > >>>>>>>
> > > >>>>>>>loaded.
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>>With the server version of hotspot there is another develop
> flag
> > > >>>>>>>>-XX:+PrintOptoAssembly which will print a very stylized
> version of
> > > >>>>
> > > >>>>the
> > > >>>>
> > > >>>>
> > > >>>>>>>>code the jit produces. It will do this without the
> disassembler
> > > >>
> > > >>being
> > > >>
> > > >>>>>>>>present.
> > > >>>>>>>
> > > >>>>>>>You can also use the "fastdebug" version of HotSpot to get
> > > >>>>>>>access to the -XX:+PrintAssembly flag. The fastdebug
> version
> > > >>>>>>>is built as part of the "make world" target. You still need
> > > >>>>>>>the dissassembler, as Steve says.
> > > >>>>>>>
> > > >>>>>>> ... peter
> > > >>>>>>>
> > > >>>>>>>--
> > > >>>>>>>No virus found in this incoming message.
> > > >>>>>>>Checked by AVG Free Edition.
> > > >>>>>>>Version: 7.5.432 / Virus Database: 268.15.9/573 - Release
> Date:
> > > >>>>>
> > > >>>>>12/5/2006
> > > >>>>>
> > > >>>>>
> > > >>>>>>>4:07 PM
> > > >>>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>--
> > > >>>>>No virus found in this incoming message.
> > > >>>>>Checked by AVG Free Edition.
> > > >>>>>Version: 7.5.432 / Virus Database: 268.15.15/579 - Release
> Date:
> > > >>>>
> > > >>>>12/7/2006
> > > >>>>
> > > >>>>
> > > >>>>>1:31 PM
> > > >>>>>
> > > >>>>
> > > >>>>--
> > > >>>>No virus found in this outgoing message.
> > > >>>>Checked by AVG Free Edition.
> > > >>>>Version: 7.5.432 / Virus Database: 268.16.12/628 - Release
> Date:
> > > >>
> > > >>1/15/2007
> > > >>
> > > >>>>11:04 AM
> > > >>>>
> > > >>>>
> > > >>>>--
> > > >>>>No virus found in this incoming message.
> > > >>>>Checked by AVG Free Edition.
> > > >>>>Version: 7.5.432 / Virus Database: 268.16.12/628 - Release
> Date:
> > > >>
> > > >>1/15/2007
> > > >>
> > > >>>>11:04 AM
> > > >>>>
> > > >>>
> > > >>>
> > > >>--
> > > >>No virus found in this incoming message.
> > > >>Checked by AVG Free Edition.
> > > >>Version: 7.5.446 / Virus Database: 269.4.0/762 - Release Date:
> 4/15/2007
> > > >>4:22 PM
> > > >>
> > > >
> > > >
> > > > No virus found in this outgoing message.
> > > > Checked by AVG Free Edition.
> > > > Version: 7.5.476 / Virus Database: 269.11.0/929 - Release Date:
> > > 7/31/2007
> > > > 5:26 PM
> > > >
> > > >
> > >
> > > No virus found in this incoming message.
> > > Checked by AVG Free Edition.
> > > Version: 7.5.476 / Virus Database: 269.11.2/933 - Release Date:
> 8/2/2007
> > > 2:22 PM
> > >
> >
> > No virus found in this outgoing message.
> > Checked by AVG Free Edition.
> > Version: 7.5.476 / Virus Database: 269.11.2/933 - Release Date:
> 8/2/2007
> > 2:22 PM
> >
> >
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.476 / Virus Database: 269.11.8/940 - Release Date:
> 8/6/2007 4:53 PM
>
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.11.8/940 - Release Date: 8/6/2007 4:53 PM
More information about the hotspot-compiler-dev
mailing list