001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.adaptive.util;
014
015import static org.jikesrvm.runtime.ExitStatus.*;
016
017import org.jikesrvm.VM;
018import org.jikesrvm.runtime.CommandLineArgs;
019
020/**
021 * Class to handle command-line arguments and options for the
022 * adaptive system.
023 * <p>
024 * Note: This file is mechanically generated from AOSOptions.template
025 *       and MasterOptions.template
026 * <p>
027 * Note: Boolean options are defined in /home/vagrant/rvm-trunk/rvm/src-generated/options/BooleanOptions.aos.dat
028 *       All other options are defined in /home/vagrant/rvm-trunk/rvm/src-generated/options/ValueOptions.aos.dat
029 *       (value, enumeration, bitmask)
030 *
031 **/
032public class AOSExternalOptions implements Cloneable {
033
034  private void printOptionsHeader() {
035    VM.sysWriteln("Current value of options:");
036  }
037
038// BEGIN CODE GENERATED FROM MasterOptions.template
039/*
040 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
041 *
042 *  This file is licensed to You under the Eclipse Public License (EPL);
043 *  You may not use this file except in compliance with the License. You
044 *  may obtain a copy of the License at
045 *
046 *      http://www.opensource.org/licenses/eclipse-1.0.php
047 *
048 *  See the COPYRIGHT.txt file distributed with this work for information
049 *  regarding copyright ownership.
050 */
051   // Begin template-specified options
052   /** Should the adaptive system recompile hot methods? */
053   public boolean ENABLE_RECOMPILATION          = true;
054   /** Do we need to generate advice files? */
055   public boolean ENABLE_ADVICE_GENERATION      = false;
056   /** Should the adaptive system be disabled, and methods given in the advice file compiled when BulkCompile.compileAllMethods() is called? */
057   public boolean ENABLE_BULK_COMPILE           = false;
058   /** Should bulk compilation be triggered before the user thread is started? */
059   public boolean ENABLE_PRECOMPILE             = false;
060   /** Should profile data be gathered and reported at the end of the run? */
061   public boolean GATHER_PROFILE_DATA           = false;
062   /** Should we use adaptive feedback-directed inlining? */
063   public boolean ADAPTIVE_INLINING             = true;
064   /** Should AOS exit when the controller clock reaches EARLY_EXIT_VALUE? */
065   public boolean EARLY_EXIT                    = false;
066   /** Should AOS promote baseline-compiled methods to opt? */
067   public boolean OSR_PROMOTION                 = true;
068   /** Should recompilation be done on a background thread or on next invocation? */
069   public boolean BACKGROUND_RECOMPILATION      = true;
070   /** Insert instrumentation in opt recompiled code to count yieldpoints executed? */
071   public boolean INSERT_YIELDPOINT_COUNTERS    = false;
072   /** Insert intrusive method counters in opt recompiled code? */
073   public boolean INSERT_METHOD_COUNTERS_OPT    = false;
074   /** Insert counters on all instructions in opt recompiled code? */
075   public boolean INSERT_INSTRUCTION_COUNTERS   = false;
076   /** Enable easy insertion of (debugging) counters in opt recompiled code. */
077   public boolean INSERT_DEBUGGING_COUNTERS     = false;
078   /** Report stats related to timer interrupts and AOS listeners on exit */
079   public boolean REPORT_INTERRUPT_STATS        = false;
080   /** Disable the ability for an app to request all methods to be recompiled */
081   public boolean DISABLE_RECOMPILE_ALL_METHODS = false;
082    /** How many timer ticks of method samples to take before reporting method hotness to controller */
083    public int METHOD_SAMPLE_SIZE                = 3;
084    /** Selection of initial compiler */
085    public byte INITIAL_COMPILER                 = IRC_BASE;
086    /** Selection of mechanism for identifying methods for optimizing recompilation */
087    public byte RECOMPILATION_STRATEGY           = RS_SAMPLING;
088    /** What triggers us to take a method sample? */
089    public byte METHOD_LISTENER_TRIGGER          = ML_TIMER;
090    /** What triggers us to take a method sample? */
091    public byte CALL_GRAPH_LISTENER_TRIGGER      = CGL_CBS;
092    /** Name of log file */
093    public String LOGFILE_NAME                   = "AOSLog.txt";
094    /** Name of advice file */
095    public String COMPILATION_ADVICE_FILE_OUTPUT = "aosadvice.ca";
096    /** Name of dynamic call graph file */
097    public String DYNAMIC_CALL_FILE_OUTPUT       = "aosadvice.dc";
098    /** Name of compiler DNA file (default DNA will be used if no name is given).  Discussed in a comment at the head of CompilerDNA.java */
099    public String COMPILER_DNA_FILE_NAME         = "";
100    /** File containing information about the methods to Opt compile */
101    public String COMPILER_ADVICE_FILE_INPUT     = null;
102    /** File containing information about the hot call sites */
103    public String DYNAMIC_CALL_FILE_INPUT        = null;
104    /** Control amount of verbosity for bulk compilation (larger means more) */
105    public int BULK_COMPILATION_VERBOSITY        = 0;
106    /** Control amount of event logging (larger means more) */
107    public int LOGGING_LEVEL                     = 0;
108    /** Control amount of info reported on exit (larger means more) */
109    public int FINAL_REPORT_LEVEL                = 0;
110    /** After how many clock ticks should we decay */
111    public int DECAY_FREQUENCY                   = 100;
112    /** What factor should we decay call graph edges hotness by */
113    public double DCG_DECAY_RATE                 = 1.1;
114    /** After how many timer interrupts do we update the weights in the dynamic call graph? */
115    public int DCG_SAMPLE_SIZE                   = 20;
116    /** Initial edge weight of call graph is set to AI_SEED_MULTIPLER * (1/AI_CONTROL_POINT) */
117    public double INLINE_AI_SEED_MULTIPLIER      = 3;
118    /** What percentage of the total weight of the dcg demarcates warm/hot edges  */
119    public double INLINE_AI_HOT_CALLSITE_THRESHOLD= 0.01;
120    /** Name of offline inline plan to be read and used for inlining */
121    public String OFFLINE_INLINE_PLAN_NAME       = "AI_plan";
122    /** Value of controller clock at which AOS should exit if EARLY_EXIT is true */
123    public int EARLY_EXIT_TIME                   = 1000;
124    /** Invocation count at which a baseline compiled method should be recompiled */
125    public int INVOCATION_COUNT_THRESHOLD        = 1000;
126    /** Opt level for recompilation in invocation count based system */
127    public int INVOCATION_COUNT_OPT_LEVEL        = 1;
128    /** What is the sample interval for counter-based sampling */
129    public int COUNTER_BASED_SAMPLE_INTERVAL     = 1000;
130    /** The maximum optimization level to enable. */
131    public int MAX_OPT_LEVEL                     = 2;
132   // End template-specified options
133
134   // Begin generated support for "Enumeration" options
135   // INITIAL_COMPILER
136   public static final byte IRC_BASE = 0;
137   /**
138    * Is INITIAL_COMPILER set to IRC_BASE?
139    *
140    * @return {@code true} when IRC_BASE is set to INITIAL_COMPILER,
141    *   {@code false} otherwise
142    */
143   public final boolean baseIRC() {
144     return INITIAL_COMPILER == IRC_BASE;
145   }
146   public static final byte IRC_OPT = 1;
147   /**
148    * Is INITIAL_COMPILER set to IRC_OPT?
149    *
150    * @return {@code true} when IRC_OPT is set to INITIAL_COMPILER,
151    *   {@code false} otherwise
152    */
153   public final boolean optIRC() {
154     return INITIAL_COMPILER == IRC_OPT;
155   }
156
157   // RECOMPILATION_STRATEGY
158   public static final byte RS_SAMPLING = 0;
159   /**
160    * Is RECOMPILATION_STRATEGY set to RS_SAMPLING?
161    *
162    * @return {@code true} when RS_SAMPLING is set to RECOMPILATION_STRATEGY,
163    *   {@code false} otherwise
164    */
165   public final boolean sampling() {
166     return RECOMPILATION_STRATEGY == RS_SAMPLING;
167   }
168   public static final byte RS_COUNTERS = 1;
169   /**
170    * Is RECOMPILATION_STRATEGY set to RS_COUNTERS?
171    *
172    * @return {@code true} when RS_COUNTERS is set to RECOMPILATION_STRATEGY,
173    *   {@code false} otherwise
174    */
175   public final boolean counters() {
176     return RECOMPILATION_STRATEGY == RS_COUNTERS;
177   }
178
179   // METHOD_LISTENER_TRIGGER
180   public static final byte ML_TIMER = 0;
181   /**
182    * Is METHOD_LISTENER_TRIGGER set to ML_TIMER?
183    *
184    * @return {@code true} when ML_TIMER is set to METHOD_LISTENER_TRIGGER,
185    *   {@code false} otherwise
186    */
187   public final boolean mlTimer() {
188     return METHOD_LISTENER_TRIGGER == ML_TIMER;
189   }
190   public static final byte ML_CBS = 1;
191   /**
192    * Is METHOD_LISTENER_TRIGGER set to ML_CBS?
193    *
194    * @return {@code true} when ML_CBS is set to METHOD_LISTENER_TRIGGER,
195    *   {@code false} otherwise
196    */
197   public final boolean mlCBS() {
198     return METHOD_LISTENER_TRIGGER == ML_CBS;
199   }
200
201   // CALL_GRAPH_LISTENER_TRIGGER
202   public static final byte CGL_TIMER = 0;
203   /**
204    * Is CALL_GRAPH_LISTENER_TRIGGER set to CGL_TIMER?
205    *
206    * @return {@code true} when CGL_TIMER is set to CALL_GRAPH_LISTENER_TRIGGER,
207    *   {@code false} otherwise
208    */
209   public final boolean cgTimer() {
210     return CALL_GRAPH_LISTENER_TRIGGER == CGL_TIMER;
211   }
212   public static final byte CGL_CBS = 1;
213   /**
214    * Is CALL_GRAPH_LISTENER_TRIGGER set to CGL_CBS?
215    *
216    * @return {@code true} when CGL_CBS is set to CALL_GRAPH_LISTENER_TRIGGER,
217    *   {@code false} otherwise
218    */
219   public final boolean cgCBS() {
220     return CALL_GRAPH_LISTENER_TRIGGER == CGL_CBS;
221   }
222
223   // End generated support for "Enumeration" options
224
225   // Begin generated support for "Set" options
226   // End generated support for "Set" options
227
228   @Override
229   @SuppressWarnings("unchecked")
230   public Object clone() throws CloneNotSupportedException {
231     AOSExternalOptions clone = (AOSExternalOptions)super.clone();
232     return clone;
233   }
234
235  public AOSExternalOptions dup() {
236    try {
237      return (AOSExternalOptions) clone();
238    }
239    catch (CloneNotSupportedException e) {
240      final InternalError error = new InternalError("Unexpected CloneNotSupportedException.");
241      error.initCause(e);
242      throw error;
243    }
244  }
245
246  /**
247   * Take a string (most likely a command-line argument) and try to proccess it
248   * as an option command.  Return true if the string was understood, false
249   * otherwise.
250   *
251   * @param prefix a Sring to use as a command prefix when printing help.
252   * @param arg a String to try to process as an option command
253   * @return true if successful, false otherwise
254   */
255  @org.vmmagic.pragma.NoOptCompile
256  public boolean processAsOption(String prefix, String arg) {
257
258    // First handle the "option commands"
259    if (arg.equals("help")) {
260       printHelp(prefix);
261       return true;
262    }
263    if (arg.equals("printOptions")) {
264       printOptions();
265       return true;
266    }
267    if (arg.length() == 0) {
268      printHelp(prefix);
269      return true;
270    }
271    // Make sure only process O? option if initial runtime compiler!
272    if ((prefix.indexOf("irc")!=-1 ||
273         prefix.indexOf("bc")!=-1 ||
274         prefix.indexOf("eoc")!=-1) &&
275        instanceProcessAsOption(arg)) {
276      return true;
277    }
278
279    // Required format of arg is 'name=value'
280    // Split into 'name' and 'value' strings
281    int split = arg.indexOf('=');
282    if (split == -1) {
283      if (!(arg.equals("O0") || arg.equals("O1") || arg.equals("O2") || arg.equals("O3"))) {
284        VM.sysWrite("  Illegal option specification!\n  \""+arg+
285                      "\" must be specified as a name-value pair in the form of option=value\n");
286      }
287      return false;
288    }
289    String name = arg.substring(0,split);
290    String value = arg.substring(split+1);
291
292    //Begin generated command-line processing
293    if (name.equals("enable_recompilation")) {
294      if (value.equals("true")) {
295        ENABLE_RECOMPILATION = true;
296        return true;
297      } else if (value.equals("false")) {
298        ENABLE_RECOMPILATION = false;
299        return true;
300      } else
301        return false;
302    }
303    if (name.equals("enable_advice_generation")) {
304      if (value.equals("true")) {
305        ENABLE_ADVICE_GENERATION = true;
306        return true;
307      } else if (value.equals("false")) {
308        ENABLE_ADVICE_GENERATION = false;
309        return true;
310      } else
311        return false;
312    }
313    if (name.equals("enable_bulk_compile")) {
314      if (value.equals("true")) {
315        ENABLE_BULK_COMPILE = true;
316        return true;
317      } else if (value.equals("false")) {
318        ENABLE_BULK_COMPILE = false;
319        return true;
320      } else
321        return false;
322    }
323    if (name.equals("enable_precompile")) {
324      if (value.equals("true")) {
325        ENABLE_PRECOMPILE = true;
326        return true;
327      } else if (value.equals("false")) {
328        ENABLE_PRECOMPILE = false;
329        return true;
330      } else
331        return false;
332    }
333    if (name.equals("gather_profile_data")) {
334      if (value.equals("true")) {
335        GATHER_PROFILE_DATA = true;
336        return true;
337      } else if (value.equals("false")) {
338        GATHER_PROFILE_DATA = false;
339        return true;
340      } else
341        return false;
342    }
343    if (name.equals("adaptive_inlining")) {
344      if (value.equals("true")) {
345        ADAPTIVE_INLINING = true;
346        return true;
347      } else if (value.equals("false")) {
348        ADAPTIVE_INLINING = false;
349        return true;
350      } else
351        return false;
352    }
353    if (name.equals("early_exit")) {
354      if (value.equals("true")) {
355        EARLY_EXIT = true;
356        return true;
357      } else if (value.equals("false")) {
358        EARLY_EXIT = false;
359        return true;
360      } else
361        return false;
362    }
363    if (name.equals("osr_promotion")) {
364      if (value.equals("true")) {
365        OSR_PROMOTION = true;
366        return true;
367      } else if (value.equals("false")) {
368        OSR_PROMOTION = false;
369        return true;
370      } else
371        return false;
372    }
373    if (name.equals("background_recompilation")) {
374      if (value.equals("true")) {
375        BACKGROUND_RECOMPILATION = true;
376        return true;
377      } else if (value.equals("false")) {
378        BACKGROUND_RECOMPILATION = false;
379        return true;
380      } else
381        return false;
382    }
383    if (name.equals("insert_yieldpoint_counters")) {
384      if (value.equals("true")) {
385        INSERT_YIELDPOINT_COUNTERS = true;
386        return true;
387      } else if (value.equals("false")) {
388        INSERT_YIELDPOINT_COUNTERS = false;
389        return true;
390      } else
391        return false;
392    }
393    if (name.equals("insert_method_counters_opt")) {
394      if (value.equals("true")) {
395        INSERT_METHOD_COUNTERS_OPT = true;
396        return true;
397      } else if (value.equals("false")) {
398        INSERT_METHOD_COUNTERS_OPT = false;
399        return true;
400      } else
401        return false;
402    }
403    if (name.equals("insert_instruction_counters")) {
404      if (value.equals("true")) {
405        INSERT_INSTRUCTION_COUNTERS = true;
406        return true;
407      } else if (value.equals("false")) {
408        INSERT_INSTRUCTION_COUNTERS = false;
409        return true;
410      } else
411        return false;
412    }
413    if (name.equals("insert_debugging_counters")) {
414      if (value.equals("true")) {
415        INSERT_DEBUGGING_COUNTERS = true;
416        return true;
417      } else if (value.equals("false")) {
418        INSERT_DEBUGGING_COUNTERS = false;
419        return true;
420      } else
421        return false;
422    }
423    if (name.equals("report_interrupt_stats")) {
424      if (value.equals("true")) {
425        REPORT_INTERRUPT_STATS = true;
426        return true;
427      } else if (value.equals("false")) {
428        REPORT_INTERRUPT_STATS = false;
429        return true;
430      } else
431        return false;
432    }
433    if (name.equals("disable_recompile_all_methods")) {
434      if (value.equals("true")) {
435        DISABLE_RECOMPILE_ALL_METHODS = true;
436        return true;
437      } else if (value.equals("false")) {
438        DISABLE_RECOMPILE_ALL_METHODS = false;
439        return true;
440      } else
441        return false;
442    }
443    if (name.equals("method_sample_size")) {
444       METHOD_SAMPLE_SIZE = CommandLineArgs.primitiveParseInt(value);
445       return true;
446     }
447    if (name.equals("initial_compiler")) {
448       if (value.equals("base")) {
449         INITIAL_COMPILER = IRC_BASE;
450         return true;
451       }
452       if (value.equals("opt")) {
453         INITIAL_COMPILER = IRC_OPT;
454         return true;
455       }
456       return false;
457     }
458    if (name.equals("recompilation_strategy")) {
459       if (value.equals("sampling")) {
460         RECOMPILATION_STRATEGY = RS_SAMPLING;
461         return true;
462       }
463       if (value.equals("counters")) {
464         RECOMPILATION_STRATEGY = RS_COUNTERS;
465         return true;
466       }
467       return false;
468     }
469    if (name.equals("method_listener_trigger")) {
470       if (value.equals("timer")) {
471         METHOD_LISTENER_TRIGGER = ML_TIMER;
472         return true;
473       }
474       if (value.equals("cbs")) {
475         METHOD_LISTENER_TRIGGER = ML_CBS;
476         return true;
477       }
478       return false;
479     }
480    if (name.equals("call_graph_listener_trigger")) {
481       if (value.equals("timer")) {
482         CALL_GRAPH_LISTENER_TRIGGER = CGL_TIMER;
483         return true;
484       }
485       if (value.equals("cbs")) {
486         CALL_GRAPH_LISTENER_TRIGGER = CGL_CBS;
487         return true;
488       }
489       return false;
490     }
491    if (name.equals("lf")) {
492       LOGFILE_NAME = value;
493       return true;
494     }
495    if (name.equals("cafo")) {
496       COMPILATION_ADVICE_FILE_OUTPUT = value;
497       return true;
498     }
499    if (name.equals("dcfo")) {
500       DYNAMIC_CALL_FILE_OUTPUT = value;
501       return true;
502     }
503    if (name.equals("dna")) {
504       COMPILER_DNA_FILE_NAME = value;
505       return true;
506     }
507    if (name.equals("cafi")) {
508       COMPILER_ADVICE_FILE_INPUT = value;
509       return true;
510     }
511    if (name.equals("dcfi")) {
512       DYNAMIC_CALL_FILE_INPUT = value;
513       return true;
514     }
515    if (name.equals("bulk_compilation_verbosity")) {
516       BULK_COMPILATION_VERBOSITY = CommandLineArgs.primitiveParseInt(value);
517       return true;
518     }
519    if (name.equals("logging_level")) {
520       LOGGING_LEVEL = CommandLineArgs.primitiveParseInt(value);
521       return true;
522     }
523    if (name.equals("final_report_level")) {
524       FINAL_REPORT_LEVEL = CommandLineArgs.primitiveParseInt(value);
525       return true;
526     }
527    if (name.equals("decay_frequency")) {
528       DECAY_FREQUENCY = CommandLineArgs.primitiveParseInt(value);
529       return true;
530     }
531    if (name.equals("dcg_decay_rate")) {
532       DCG_DECAY_RATE = CommandLineArgs.primitiveParseFloat(value);
533       return true;
534     }
535    if (name.equals("dcg_sample_size")) {
536       DCG_SAMPLE_SIZE = CommandLineArgs.primitiveParseInt(value);
537       return true;
538     }
539    if (name.equals("inline_ai_seed_multiplier")) {
540       INLINE_AI_SEED_MULTIPLIER = CommandLineArgs.primitiveParseFloat(value);
541       return true;
542     }
543    if (name.equals("inline_ai_hot_callsite_threshold")) {
544       INLINE_AI_HOT_CALLSITE_THRESHOLD = CommandLineArgs.primitiveParseFloat(value);
545       return true;
546     }
547    if (name.equals("offlinePlan")) {
548       OFFLINE_INLINE_PLAN_NAME = value;
549       return true;
550     }
551    if (name.equals("early_exit_time")) {
552       EARLY_EXIT_TIME = CommandLineArgs.primitiveParseInt(value);
553       return true;
554     }
555    if (name.equals("invocation_count_threshold")) {
556       INVOCATION_COUNT_THRESHOLD = CommandLineArgs.primitiveParseInt(value);
557       return true;
558     }
559    if (name.equals("invocation_count_opt_level")) {
560       INVOCATION_COUNT_OPT_LEVEL = CommandLineArgs.primitiveParseInt(value);
561       return true;
562     }
563    if (name.equals("counter_based_sample_interval")) {
564       COUNTER_BASED_SAMPLE_INTERVAL = CommandLineArgs.primitiveParseInt(value);
565       return true;
566     }
567    if (name.equals("max_opt_level")) {
568       MAX_OPT_LEVEL = CommandLineArgs.primitiveParseInt(value);
569       return true;
570     }
571       //End generated command-line processing
572
573    // None of the above tests matched, so this wasn't an option
574    return false;
575  }
576
577  /**
578   * Prints a short description of every option
579   *
580   * @param prefix the prefix for the option
581   */
582  public static void printHelp(String prefix) {
583
584    instancePrintHelpHeader(prefix);
585
586    //Begin generated help messages
587    VM.sysWrite("Boolean Options ("+prefix+"<option>=true or "+prefix+":<option>=false)\n");
588    VM.sysWrite("Option                                 Description\n");
589    VM.sysWrite("enable_recompilation                   Should the adaptive system recompile hot methods?\n");
590    VM.sysWrite("enable_advice_generation               Do we need to generate advice files?\n");
591    VM.sysWrite("enable_bulk_compile                    Should the adaptive system be disabled, and methods given in the advice file compiled when BulkCompile.compileAllMethods() is called?\n");
592    VM.sysWrite("enable_precompile                      Should bulk compilation be triggered before the user thread is started?\n");
593    VM.sysWrite("gather_profile_data                    Should profile data be gathered and reported at the end of the run?\n");
594    VM.sysWrite("adaptive_inlining                      Should we use adaptive feedback-directed inlining?\n");
595    VM.sysWrite("early_exit                             Should AOS exit when the controller clock reaches EARLY_EXIT_VALUE?\n");
596    VM.sysWrite("osr_promotion                          Should AOS promote baseline-compiled methods to opt?\n");
597    VM.sysWrite("background_recompilation               Should recompilation be done on a background thread or on next invocation?\n");
598    VM.sysWrite("insert_yieldpoint_counters             Insert instrumentation in opt recompiled code to count yieldpoints executed?\n");
599    VM.sysWrite("insert_method_counters_opt             Insert intrusive method counters in opt recompiled code?\n");
600    VM.sysWrite("insert_instruction_counters            Insert counters on all instructions in opt recompiled code?\n");
601    VM.sysWrite("insert_debugging_counters              Enable easy insertion of (debugging) counters in opt recompiled code.\n");
602    VM.sysWrite("report_interrupt_stats                 Report stats related to timer interrupts and AOS listeners on exit\n");
603    VM.sysWrite("disable_recompile_all_methods          Disable the ability for an app to request all methods to be recompiled\n");
604    VM.sysWrite("\nValue Options ("+prefix+"<option>=<value>)\n");
605    VM.sysWrite("Option                         Type    Description\n");
606    VM.sysWrite("method_sample_size             int     How many timer ticks of method samples to take before reporting method hotness to controller\n");
607    VM.sysWrite("lf                             String  Name of log file\n");
608    VM.sysWrite("cafo                           String  Name of advice file\n");
609    VM.sysWrite("dcfo                           String  Name of dynamic call graph file\n");
610    VM.sysWrite("dna                            String  Name of compiler DNA file (default DNA will be used if no name is given).  Discussed in a comment at the head of CompilerDNA.java\n");
611    VM.sysWrite("cafi                           String  File containing information about the methods to Opt compile\n");
612    VM.sysWrite("dcfi                           String  File containing information about the hot call sites\n");
613    VM.sysWrite("bulk_compilation_verbosity     int     Control amount of verbosity for bulk compilation (larger means more)\n");
614    VM.sysWrite("logging_level                  int     Control amount of event logging (larger means more)\n");
615    VM.sysWrite("final_report_level             int     Control amount of info reported on exit (larger means more)\n");
616    VM.sysWrite("decay_frequency                int     After how many clock ticks should we decay\n");
617    VM.sysWrite("dcg_decay_rate                 double  What factor should we decay call graph edges hotness by\n");
618    VM.sysWrite("dcg_sample_size                int     After how many timer interrupts do we update the weights in the dynamic call graph?\n");
619    VM.sysWrite("inline_ai_seed_multiplier      double  Initial edge weight of call graph is set to AI_SEED_MULTIPLER * (1/AI_CONTROL_POINT)\n");
620    VM.sysWrite("inline_ai_hot_callsite_threshold double  What percentage of the total weight of the dcg demarcates warm/hot edges \n");
621    VM.sysWrite("offlinePlan                    String  Name of offline inline plan to be read and used for inlining\n");
622    VM.sysWrite("early_exit_time                int     Value of controller clock at which AOS should exit if EARLY_EXIT is true\n");
623    VM.sysWrite("invocation_count_threshold     int     Invocation count at which a baseline compiled method should be recompiled\n");
624    VM.sysWrite("invocation_count_opt_level     int     Opt level for recompilation in invocation count based system\n");
625    VM.sysWrite("counter_based_sample_interval  int     What is the sample interval for counter-based sampling\n");
626    VM.sysWrite("max_opt_level                  int     The maximum optimization level to enable.\n");
627    VM.sysWrite("\nSelection Options (set option to one of an enumeration of possible values)\n");
628    VM.sysWrite("\t\tSelection of initial compiler\n");
629    VM.sysWrite("initial_compiler              ");
630    VM.sysWrite("base ");
631    VM.sysWrite("opt ");
632    VM.sysWrite("\n");
633    VM.sysWrite("\t\tSelection of mechanism for identifying methods for optimizing recompilation\n");
634    VM.sysWrite("recompilation_strategy        ");
635    VM.sysWrite("sampling ");
636    VM.sysWrite("counters ");
637    VM.sysWrite("\n");
638    VM.sysWrite("\t\tWhat triggers us to take a method sample?\n");
639    VM.sysWrite("method_listener_trigger       ");
640    VM.sysWrite("timer ");
641    VM.sysWrite("cbs ");
642    VM.sysWrite("\n");
643    VM.sysWrite("\t\tWhat triggers us to take a method sample?\n");
644    VM.sysWrite("call_graph_listener_trigger   ");
645    VM.sysWrite("timer ");
646    VM.sysWrite("cbs ");
647    VM.sysWrite("\n");
648    VM.sysWrite("\nSet Options (option is a set of values)\n");
649    instancePrintHelpFooter(prefix);
650
651    VM.sysExit(EXIT_STATUS_PRINTED_HELP_MESSAGE);
652  }
653
654  /** @return a String representing the options values */
655  @Override
656  @org.vmmagic.pragma.NoOptCompile
657  public String toString() {
658    StringBuilder result = new StringBuilder();
659
660    // Begin generated option value printing
661    result.append("\tenable_recompilation           = ").append(ENABLE_RECOMPILATION).append("\n");
662    result.append("\tenable_advice_generation       = ").append(ENABLE_ADVICE_GENERATION).append("\n");
663    result.append("\tenable_bulk_compile            = ").append(ENABLE_BULK_COMPILE).append("\n");
664    result.append("\tenable_precompile              = ").append(ENABLE_PRECOMPILE).append("\n");
665    result.append("\tgather_profile_data            = ").append(GATHER_PROFILE_DATA).append("\n");
666    result.append("\tadaptive_inlining              = ").append(ADAPTIVE_INLINING).append("\n");
667    result.append("\tearly_exit                     = ").append(EARLY_EXIT).append("\n");
668    result.append("\tosr_promotion                  = ").append(OSR_PROMOTION).append("\n");
669    result.append("\tbackground_recompilation       = ").append(BACKGROUND_RECOMPILATION).append("\n");
670    result.append("\tinsert_yieldpoint_counters     = ").append(INSERT_YIELDPOINT_COUNTERS).append("\n");
671    result.append("\tinsert_method_counters_opt     = ").append(INSERT_METHOD_COUNTERS_OPT).append("\n");
672    result.append("\tinsert_instruction_counters    = ").append(INSERT_INSTRUCTION_COUNTERS).append("\n");
673    result.append("\tinsert_debugging_counters      = ").append(INSERT_DEBUGGING_COUNTERS).append("\n");
674    result.append("\treport_interrupt_stats         = ").append(REPORT_INTERRUPT_STATS).append("\n");
675    result.append("\tdisable_recompile_all_methods  = ").append(DISABLE_RECOMPILE_ALL_METHODS).append("\n");
676    result.append("\tmethod_sample_size             = ").append(METHOD_SAMPLE_SIZE).append("\n");
677    result.append("\tlf                             = ").append(LOGFILE_NAME).append("\n");
678    result.append("\tcafo                           = ").append(COMPILATION_ADVICE_FILE_OUTPUT).append("\n");
679    result.append("\tdcfo                           = ").append(DYNAMIC_CALL_FILE_OUTPUT).append("\n");
680    result.append("\tdna                            = ").append(COMPILER_DNA_FILE_NAME).append("\n");
681    result.append("\tcafi                           = ").append(COMPILER_ADVICE_FILE_INPUT).append("\n");
682    result.append("\tdcfi                           = ").append(DYNAMIC_CALL_FILE_INPUT).append("\n");
683    result.append("\tbulk_compilation_verbosity     = ").append(BULK_COMPILATION_VERBOSITY).append("\n");
684    result.append("\tlogging_level                  = ").append(LOGGING_LEVEL).append("\n");
685    result.append("\tfinal_report_level             = ").append(FINAL_REPORT_LEVEL).append("\n");
686    result.append("\tdecay_frequency                = ").append(DECAY_FREQUENCY).append("\n");
687    result.append("\tdcg_decay_rate                 = ").append(DCG_DECAY_RATE).append("\n");
688    result.append("\tdcg_sample_size                = ").append(DCG_SAMPLE_SIZE).append("\n");
689    result.append("\tinline_ai_seed_multiplier      = ").append(INLINE_AI_SEED_MULTIPLIER).append("\n");
690    result.append("\tinline_ai_hot_callsite_threshold = ").append(INLINE_AI_HOT_CALLSITE_THRESHOLD).append("\n");
691    result.append("\tofflinePlan                    = ").append(OFFLINE_INLINE_PLAN_NAME).append("\n");
692    result.append("\tearly_exit_time                = ").append(EARLY_EXIT_TIME).append("\n");
693    result.append("\tinvocation_count_threshold     = ").append(INVOCATION_COUNT_THRESHOLD).append("\n");
694    result.append("\tinvocation_count_opt_level     = ").append(INVOCATION_COUNT_OPT_LEVEL).append("\n");
695    result.append("\tcounter_based_sample_interval  = ").append(COUNTER_BASED_SAMPLE_INTERVAL).append("\n");
696    result.append("\tmax_opt_level                  = ").append(MAX_OPT_LEVEL).append("\n");
697    if (INITIAL_COMPILER == IRC_BASE)
698       result.append("\tinitial_compiler               = IRC_BASE\n");
699    if (INITIAL_COMPILER == IRC_OPT)
700       result.append("\tinitial_compiler               = IRC_OPT\n");
701    if (RECOMPILATION_STRATEGY == RS_SAMPLING)
702       result.append("\trecompilation_strategy         = RS_SAMPLING\n");
703    if (RECOMPILATION_STRATEGY == RS_COUNTERS)
704       result.append("\trecompilation_strategy         = RS_COUNTERS\n");
705    if (METHOD_LISTENER_TRIGGER == ML_TIMER)
706       result.append("\tmethod_listener_trigger        = ML_TIMER\n");
707    if (METHOD_LISTENER_TRIGGER == ML_CBS)
708       result.append("\tmethod_listener_trigger        = ML_CBS\n");
709    if (CALL_GRAPH_LISTENER_TRIGGER == CGL_TIMER)
710       result.append("\tcall_graph_listener_trigger    = CGL_TIMER\n");
711    if (CALL_GRAPH_LISTENER_TRIGGER == CGL_CBS)
712       result.append("\tcall_graph_listener_trigger    = CGL_CBS\n");
713    return result.toString();
714    //End generated toString()
715  }
716
717  /** print a String value of this options object */
718  @org.vmmagic.pragma.NoOptCompile
719  public void printOptions() {
720    printOptionsHeader();
721
722    // Begin generated option value printing
723    VM.sysWriteln("\tenable_recompilation           = ",ENABLE_RECOMPILATION);
724    VM.sysWriteln("\tenable_advice_generation       = ",ENABLE_ADVICE_GENERATION);
725    VM.sysWriteln("\tenable_bulk_compile            = ",ENABLE_BULK_COMPILE);
726    VM.sysWriteln("\tenable_precompile              = ",ENABLE_PRECOMPILE);
727    VM.sysWriteln("\tgather_profile_data            = ",GATHER_PROFILE_DATA);
728    VM.sysWriteln("\tadaptive_inlining              = ",ADAPTIVE_INLINING);
729    VM.sysWriteln("\tearly_exit                     = ",EARLY_EXIT);
730    VM.sysWriteln("\tosr_promotion                  = ",OSR_PROMOTION);
731    VM.sysWriteln("\tbackground_recompilation       = ",BACKGROUND_RECOMPILATION);
732    VM.sysWriteln("\tinsert_yieldpoint_counters     = ",INSERT_YIELDPOINT_COUNTERS);
733    VM.sysWriteln("\tinsert_method_counters_opt     = ",INSERT_METHOD_COUNTERS_OPT);
734    VM.sysWriteln("\tinsert_instruction_counters    = ",INSERT_INSTRUCTION_COUNTERS);
735    VM.sysWriteln("\tinsert_debugging_counters      = ",INSERT_DEBUGGING_COUNTERS);
736    VM.sysWriteln("\treport_interrupt_stats         = ",REPORT_INTERRUPT_STATS);
737    VM.sysWriteln("\tdisable_recompile_all_methods  = ",DISABLE_RECOMPILE_ALL_METHODS);
738    VM.sysWriteln("\tmethod_sample_size             = ",METHOD_SAMPLE_SIZE);
739    VM.sysWriteln("\tlf                             = ",LOGFILE_NAME);
740    VM.sysWriteln("\tcafo                           = ",COMPILATION_ADVICE_FILE_OUTPUT);
741    VM.sysWriteln("\tdcfo                           = ",DYNAMIC_CALL_FILE_OUTPUT);
742    VM.sysWriteln("\tdna                            = ",COMPILER_DNA_FILE_NAME);
743    VM.sysWriteln("\tcafi                           = ",COMPILER_ADVICE_FILE_INPUT);
744    VM.sysWriteln("\tdcfi                           = ",DYNAMIC_CALL_FILE_INPUT);
745    VM.sysWriteln("\tbulk_compilation_verbosity     = ",BULK_COMPILATION_VERBOSITY);
746    VM.sysWriteln("\tlogging_level                  = ",LOGGING_LEVEL);
747    VM.sysWriteln("\tfinal_report_level             = ",FINAL_REPORT_LEVEL);
748    VM.sysWriteln("\tdecay_frequency                = ",DECAY_FREQUENCY);
749    VM.sysWriteln("\tdcg_decay_rate                 = ",DCG_DECAY_RATE);
750    VM.sysWriteln("\tdcg_sample_size                = ",DCG_SAMPLE_SIZE);
751    VM.sysWriteln("\tinline_ai_seed_multiplier      = ",INLINE_AI_SEED_MULTIPLIER);
752    VM.sysWriteln("\tinline_ai_hot_callsite_threshold = ",INLINE_AI_HOT_CALLSITE_THRESHOLD);
753    VM.sysWriteln("\tofflinePlan                    = ",OFFLINE_INLINE_PLAN_NAME);
754    VM.sysWriteln("\tearly_exit_time                = ",EARLY_EXIT_TIME);
755    VM.sysWriteln("\tinvocation_count_threshold     = ",INVOCATION_COUNT_THRESHOLD);
756    VM.sysWriteln("\tinvocation_count_opt_level     = ",INVOCATION_COUNT_OPT_LEVEL);
757    VM.sysWriteln("\tcounter_based_sample_interval  = ",COUNTER_BASED_SAMPLE_INTERVAL);
758    VM.sysWriteln("\tmax_opt_level                  = ",MAX_OPT_LEVEL);
759    if (INITIAL_COMPILER == IRC_BASE)
760       VM.sysWriteln("\tinitial_compiler               = IRC_BASE");
761    if (INITIAL_COMPILER == IRC_OPT)
762       VM.sysWriteln("\tinitial_compiler               = IRC_OPT");
763    if (RECOMPILATION_STRATEGY == RS_SAMPLING)
764       VM.sysWriteln("\trecompilation_strategy         = RS_SAMPLING");
765    if (RECOMPILATION_STRATEGY == RS_COUNTERS)
766       VM.sysWriteln("\trecompilation_strategy         = RS_COUNTERS");
767    if (METHOD_LISTENER_TRIGGER == ML_TIMER)
768       VM.sysWriteln("\tmethod_listener_trigger        = ML_TIMER");
769    if (METHOD_LISTENER_TRIGGER == ML_CBS)
770       VM.sysWriteln("\tmethod_listener_trigger        = ML_CBS");
771    if (CALL_GRAPH_LISTENER_TRIGGER == CGL_TIMER)
772       VM.sysWriteln("\tcall_graph_listener_trigger    = CGL_TIMER");
773    if (CALL_GRAPH_LISTENER_TRIGGER == CGL_CBS)
774       VM.sysWriteln("\tcall_graph_listener_trigger    = CGL_CBS");
775    //End generated option value printing
776  }
777// END CODE GENERATED FROM MasterOptions.template
778
779  private boolean instanceProcessAsOption(String arg) {
780    return false;
781  }
782
783  private static void instancePrintHelpHeader(String prefix) {
784    VM.sysWrite("Commands\n");
785    VM.sysWrite(prefix+"[:help]       Print a brief description of AOS command-line options\n");
786    VM.sysWrite(prefix+":printOptions Print the current option values of AOS\n");
787    VM.sysWrite(prefix+":o=v          Pass the option-value pair, o=v, to AOS\n");
788    VM.sysWrite("\n");
789  }
790
791  private static void instancePrintHelpFooter(String prefix) {
792  }
793}