Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / May 2005

Tip: Looking for answers? Try searching our database.

Peephole optimizer for Java class files

Thread view: 
napi - 23 May 2005 13:41 GMT
Is there any peephole optimizer for Java, be it for .class files
or assembly files (e.g., Jasmin or Oolong)?

Thanks.

Napi
Paul Cager - 25 May 2005 09:25 GMT
> Is there any peephole optimizer for Java, be it for .class files
> or assembly files (e.g., Jasmin or Oolong)?
>
> Thanks.
>
> Napi

The Bytecode Engineering Library (BCEL, now part of
http://jakarta.apache.org/ ) had an example of a peephole optmizer that
improved the bytecode generated for boolean expressions by early
compilers (although I believe later versions of javac generate improved
code). You may want to have a look at this as it could be easily
extended for other optimisations - in any case I would recommend BCEL
as a useful package for the manipulation of class files.

By the way, do you mind me asking why you want an optimizer? In most
cirumstances a JVM will "JIT" the bytecode to native code, performing
its own optimizations - so optimising the bytecode may not be
beneficial.

I've heard rumours that optimising bytecode could cause a performance
degredation as the JIT might miss opportunities to do its own
optimisation. I hope and suspect this rumour is not true, as it would
imply that a JVM implementation might not optimise code compiled with a
competitor's compiler.

Paul
Mohd Hanafiah Abdullah - 25 May 2005 09:58 GMT
>> Is there any peephole optimizer for Java, be it for .class files
>> or assembly files (e.g., Jasmin or Oolong)?
[quoted text clipped - 21 lines]
>imply that a JVM implementation might not optimise code compiled with a
>competitor's compiler.

I would like to use it on .class files produced by a C compiler that generates
Java bytecode.  The peephole optimizer should help improve the code.

Thanks.

Napi
Signature

http://www.axiomsol.com
http://www.cs.indiana.edu/hyplan/napi.html

Paul Cager - 31 May 2005 10:01 GMT
Yes, the peephole optimiser should certainly improve the bytecode.  But
unless you are running on a JVM without a JIT I think it is unlikely to
improve the performance of the program you are running - the JITing
process performs some aggressive optimisation.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.