[JSR308] Java compilers that perform common subexpression elimination

Neal Gafter gafter at google.com
Mon May 21 16:23:15 EDT 2007


By the way, I should point out that javac and other compilers generate
multiple live ranges for the same statement.  For example, if you compile
the following class (in JDK 1.6 or later) you'll find the invocation of g()
repeated multiple times in the code.  This is forced on compilers by the
structure of the bytecode.

class J {
  public static void f(boolean b1, boolean b2) {
    try {
      if (b1) return;
      h();
      if (b2) return;
      h();
    } finally {
      g();
    }
  }
  public static void g() {
  }
  public static void h() {
  }
}



On May 18, 2007 8:57 PM, Michael Ernst <mernst at csail.mit.edu> wrote:
>
> If a compiler performs common subexpression elimination on two
> (incompatibly-annotated) expressions or statements, then there is no good
> choice for how to annotate the generated classfile.  I am not sure whether
> this is a purely hypothetical problem or a real one.
>
> As a first step in determining this, can someone, or some group of people,
> volunteer to create a catalog of widely used Java-to-bytecode compilers
> and
> whether they perform this or other problematic optimizations?  (A list of
> other problematic optimizations would also be helpful.)  Even if you can
> only report the results for one compiler, that would be helpful.
>
>                    -Mike
>
> _______________________________________________
> JSR308 mailing list
> JSR308 at lists.csail.mit.edu
> https://lists.csail.mit.edu/mailman/listinfo/jsr308
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/pipermail/jsr308/attachments/20070521/4e7f41f2/attachment.htm


More information about the JSR308 mailing list