[JAVA] Generate fconst_2 bytecode

Andrew Haley aph@redhat.com
Thu Sep 18 10:48:00 GMT 2003


Roger Sayle writes:
 > 
 > Whilst investigating optimal JVM bytecode sequences for min and max ...

The optimum sequence is  dup2 ;  if_icmplt ; swap ; drop

But I think you're barking up the wrong tree by trying to optimize
bytecode generation for min and max.  We just need to do something
that is straightforward and obviously correct.

Modern JVMs optimize code in the same way that ahead of time compilers
do, by doing semantic analysis and trying to generate optimal
instruction sequqnces.  Trying to generate better bytecode won't make
much difference to them.

Andrew.



More information about the Java-patches mailing list