1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.graalvm.compiler.hotspot.replacements;
  24 
  25 import org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.ProfileContext;
  26 import org.graalvm.compiler.options.EnumOptionValue;
  27 import org.graalvm.compiler.options.Option;
  28 import org.graalvm.compiler.options.OptionType;
  29 import org.graalvm.compiler.options.OptionValue;
  30 
  31 /**
  32  * Options related to HotSpot snippets in this package.
  33  *
  34  * Note: This must be a top level class to work around for
  35  * <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=477597">Eclipse bug 477597</a>.
  36  */
  37 public class HotspotSnippetsOptions {
  38 
  39     // @formatter:off
  40     @Option(help = "If the probability that a type check will hit one the profiled types (up to " +
  41                    "TypeCheckMaxHints) is below this value, the type check will be compiled without profiling info", type = OptionType.Expert)
  42     public static final OptionValue<Double> TypeCheckMinProfileHitProbability = new OptionValue<>(0.5);
  43 
  44     @Option(help = "The maximum number of profiled types that will be used when compiling a profiled type check. " +
  45                     "Note that TypeCheckMinProfileHitProbability also influences whether profiling info is used in compiled type checks.", type = OptionType.Expert)
  46     public static final OptionValue<Integer> TypeCheckMaxHints = new OptionValue<>(2);
  47 
  48     @Option(help = "Use a VM runtime call to load and clear the exception object from the thread at the start of a compiled exception handler.", type = OptionType.Debug)
  49     public static final OptionValue<Boolean> LoadExceptionObjectInVM = new OptionValue<>(false);
  50 
  51     @Option(help = "Enable profiling of allocation sites.", type = OptionType.Debug)
  52     public static final OptionValue<Boolean> ProfileAllocations = new OptionValue<>(false);
  53 
  54     @Option(help = "Control the naming of the counters when using ProfileAllocations.", type = OptionType.Debug)
  55     public static final EnumOptionValue<ProfileContext> ProfileAllocationsContext = new EnumOptionValue<>(ProfileContext.AllocatingMethod);
  56 
  57     @Option(help = "Enable profiling of monitor operations.", type = OptionType.Debug)
  58     public static final OptionValue<Boolean> ProfileMonitors = new OptionValue<>(false);
  59 
  60     @Option(help = "Trace monitor operations on objects whose type contains this substring.", type = OptionType.Debug)
  61     public static final OptionValue<String> TraceMonitorsTypeFilter = new OptionValue<>(null);
  62 
  63     @Option(help = "Trace monitor operations in methods whose fully qualified name contains this substring.", type = OptionType.Debug)
  64     public static final OptionValue<String> TraceMonitorsMethodFilter = new OptionValue<>(null);
  65 
  66     @Option(help = "Emit extra code to dynamically check monitor operations are balanced.", type = OptionType.Debug)
  67     public static final OptionValue<Boolean> VerifyBalancedMonitors = new OptionValue<>(false);
  68     //@formatter:on
  69 }