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