review (S) for 6826261: class file dumping from SA is broken

John Coomes John.Coomes at sun.com
Fri Apr 3 14:03:53 PDT 2009


Tom Rodriguez (Thomas.Rodriguez at Sun.COM) wrote:
> http://cr.openjdk.java.net/~never/6826261

I'm a noob to the SA, but looks good to me.  One minor suggestion in
ClassWriter.java.  The common pattern for checking for
synthetic methods is

 364             boolean isSyn = isSynthetic(accessFlags);
 365             if (isSyn && _syntheticIndex != 0)
 366                 fieldAttributeCount++;

where you've added && _syntheticIndex != 0.  Can you fold this check
into isSyn?  E.g.:

  boolean isSyn = _syntheticIndex != 0 && isSynthetic(accessFlags);

The uses of isSyn (without the check for _syntheticIndex != 0) simply
guard a call to writeSynthetic(), and that does its own check for
_syntheticIndex != 0.  Except for this use in writeMethod():

 452         if (isSyn) {
 453             if (DEBUG) debugMessage("\tmethod is synthetic");
 454             writeSynthetic();
 455         }

Not sure if that debug message is still valid when _syntheticIndex ==
0, since writeSynthetic() won't write anything.

-John




More information about the hotspot-compiler-dev mailing list