-XX:CompileOnly command: how should it look like?

John Rose john.r.rose at oracle.com
Fri Oct 12 16:45:48 PDT 2012


On Oct 12, 2012, at 4:00 PM, Vladimir Kozlov wrote:

> From what I remember originally we only accepted format ("," on command line to separate method and " " in .hotspot_compiler file):
> 
> /c1/c2/c3,m
> 
> Then Tom added next format to match PrintCompilation output:
> 
> c1.c2.c3::m

The original command form was three blank-separated fields, command classname methodname.

We added ',' as an alias for ' ' (everywhere) to make it easy to pass CC options through various shells.  The parser turns ',' to ' ', then separates into fields.

We also added support for '::' as Vladimir said, to allow cut-and-paste of PrintC output names.  Once again, the '::' turns into a field separator.

The ',' does not mean "here is another part of a command", so CompileOnly=String.length,List.size is nonsense.

Multiple commands are separated by newlines '\n'.  This is most obvious in the .hotspot_compiler file, but is also true on the command line, because multiple accumulating string options are also glued together with newline '\n'.  Thus, -XX:CompileCommand=foo -XX:CompileCommand=bar is the same as -XX:CompileCommand="foo${n}bar" where ${n} is a newline character.

Here's the embedded comment from CompilerOracle::parse_from_line:
    // Allow '.' to separate the class name from the method name.
    // This is the preferred spelling of methods:
    //      exclude java/lang/String.indexOf(I)I
    // Allow ',' for spaces (eases command line quoting).
    //      exclude,java/lang/String.indexOf
    // For backward compatibility, allow space as separator also.
    //      exclude java/lang/String indexOf
    //      exclude,java/lang/String,indexOf
    // For easy cut-and-paste of method names, allow VM output format
    // as produced by Method::print_short_name:
    //      exclude java.lang.String::indexOf

(I admit it's kludgey stuff.)

— John


More information about the hotspot-compiler-dev mailing list