001/* 002 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. 008 * 009 * This code is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 012 * version 2 for more details (a copy is included in the LICENSE file that 013 * accompanied this code). 014 * 015 * You should have received a copy of the GNU General Public License version 016 * 2 along with this work; if not, write to the Free Software Foundation, 017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 018 * 019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 020 * or visit www.oracle.com if you need additional information or have any 021 * questions. 022 */ 023package com.oracle.graal.truffle; 024 025import jdk.internal.jvmci.options.*; 026 027/** 028 * Options for the Truffle compiler. 029 */ 030public class TruffleCompilerOptions { 031 032 // @formatter:off 033 // configuration 034 /** 035 * Instructs the Truffle Compiler to compile call targets only if their name contains at least one element of a comma-separated list of includes. 036 * Excludes are prefixed with a tilde (~). 037 * 038 * The format in EBNF: 039 * <pre> 040 * CompileOnly = Element, { ',', Element } ; 041 * Element = Include | '~' Exclude ; 042 * </pre> 043 */ 044 @Option(help = "Restrict compilation to comma-separated list of includes (or excludes prefixed with tilde)", type = OptionType.Debug) 045 public static final OptionValue<String> TruffleCompileOnly = new OptionValue<>(null); 046 047 @Option(help = "Exclude assertion code from Truffle compilations", type = OptionType.Debug) 048 public static final OptionValue<Boolean> TruffleExcludeAssertions = new StableOptionValue<>(true); 049 050 @Option(help = "Compile call target when call count exceeds this threshold", type = OptionType.User) 051 public static final OptionValue<Integer> TruffleCompilationThreshold = new OptionValue<>(1000); 052 053 @Option(help = "Defines the maximum timespan in milliseconds that is required for a call target to be queued for compilation.", type = OptionType.User) 054 public static final OptionValue<Integer> TruffleTimeThreshold = new OptionValue<>(25000); 055 056 @Option(help = "Minimum number of calls before a call target is compiled", type = OptionType.Expert) 057 public static final OptionValue<Integer> TruffleMinInvokeThreshold = new OptionValue<>(3); 058 059 @Option(help = "Delay compilation after an invalidation to allow for reprofiling", type = OptionType.Expert) 060 public static final OptionValue<Integer> TruffleInvalidationReprofileCount = new OptionValue<>(3); 061 062 @Option(help = "Delay compilation after a node replacement", type = OptionType.Expert) 063 public static final OptionValue<Integer> TruffleReplaceReprofileCount = new OptionValue<>(10); 064 065 @Option(help = "Enable automatic inlining of call targets", type = OptionType.Debug) 066 public static final OptionValue<Boolean> TruffleFunctionInlining = new OptionValue<>(true); 067 068 @Option(help = "Stop inlining if caller's cumulative tree size would exceed this limit", type = OptionType.Expert) 069 public static final OptionValue<Integer> TruffleInliningMaxCallerSize = new OptionValue<>(2250); 070 071 @Option(help = "Maximum level of recursive inlining", type = OptionType.Expert) 072 public static final OptionValue<Integer> TruffleMaximumRecursiveInlining = new OptionValue<>(4); 073 074 @Option(help = "Enable call target splitting", type = OptionType.Expert) 075 public static final OptionValue<Boolean> TruffleSplitting = new OptionValue<>(true); 076 077 @Option(help = "Experimental: Enable the new version of truffle splitting.", type = OptionType.Debug) 078 public static final OptionValue<Boolean> TruffleSplittingNew = new OptionValue<>(false); 079 080 @Option(help = "Experimental. New splitting only: Whether or not splitting should be based instance comparisons of non TypedObjects", type = OptionType.Debug) 081 public static final OptionValue<Boolean> TruffleSplittingClassInstanceStamps = new OptionValue<>(false); 082 083 @Option(help = "Experimental. New splitting only: Whether or not splitting should be based instance comparisons of TypedObjects", type = OptionType.Debug) 084 public static final OptionValue<Boolean> TruffleSplittingTypeInstanceStamps = new OptionValue<>(true); 085 086 @Option(help = "Experimental. New splitting only: The number of calls until splitting is performed. ", type = OptionType.Debug) 087 public static final OptionValue<Integer> TruffleSplittingStartCallCount = new OptionValue<>(3); 088 089 @Option(help = "Experimental. New splitting only: Split everything aggressively. ", type = OptionType.Debug) 090 public static final OptionValue<Boolean> TruffleSplittingAggressive = new OptionValue<>(false); 091 092 @Option(help = "Enable on stack replacement for Truffle loops.", type = OptionType.Debug) 093 public static final OptionValue<Boolean> TruffleOSR = new OptionValue<>(true); 094 095 @Option(help = "Number of loop iterations until on-stack-replacement compilation is triggered.", type = OptionType.Debug) 096 public static final OptionValue<Integer> TruffleOSRCompilationThreshold = new OptionValue<>(10000); 097 098 @Option(help = "Disable call target splitting if tree size exceeds this limit", type = OptionType.Debug) 099 public static final OptionValue<Integer> TruffleSplittingMaxCalleeSize = new OptionValue<>(100); 100 101 @Option(help = "Enable asynchronous truffle compilation in background thread", type = OptionType.Expert) 102 public static final OptionValue<Boolean> TruffleBackgroundCompilation = new OptionValue<>(true); 103 104 @Option(help = "Manually set the number of compiler threads", type = OptionType.Expert) 105 public static final OptionValue<Integer> TruffleCompilerThreads = new StableOptionValue<>(0); 106 107 @Option(help = "Enable inlining across Truffle boundary", type = OptionType.Expert) 108 public static final OptionValue<Boolean> TruffleInlineAcrossTruffleBoundary = new OptionValue<>(false); 109 110 @Option(help = "", type = OptionType.Debug) 111 public static final OptionValue<Boolean> TruffleReturnTypeSpeculation = new StableOptionValue<>(true); 112 113 @Option(help = "", type = OptionType.Debug) 114 public static final OptionValue<Boolean> TruffleArgumentTypeSpeculation = new StableOptionValue<>(true); 115 116 @Option(help = "", type = OptionType.Debug) 117 public static final OptionValue<Boolean> TruffleUseFrameWithoutBoxing = new StableOptionValue<>(true); 118 119 // tracing 120 @Option(help = "Print potential performance problems", type = OptionType.Debug) 121 public static final OptionValue<Boolean> TraceTrufflePerformanceWarnings = new OptionValue<>(false); 122 123 @Option(help = "Print information for compilation results", type = OptionType.Debug) 124 public static final OptionValue<Boolean> TraceTruffleCompilation = new OptionValue<>(false); 125 126 @Option(help = "Print information for compilation queuing", type = OptionType.Debug) 127 public static final OptionValue<Boolean> TraceTruffleCompilationDetails = new OptionValue<>(false); 128 129 @Option(help = "Print all polymorphic and generic nodes after each compilation", type = OptionType.Debug) 130 public static final OptionValue<Boolean> TraceTruffleCompilationPolymorphism = new OptionValue<>(false); 131 132 @Option(help = "Print all polymorphic and generic nodes after each compilation", type = OptionType.Debug) 133 public static final OptionValue<Boolean> TraceTruffleCompilationAST = new OptionValue<>(false); 134 135 @Option(help = "Print the inlined call tree for each compiled method", type = OptionType.Debug) 136 public static final OptionValue<Boolean> TraceTruffleCompilationCallTree = new OptionValue<>(false); 137 138 @Option(help = "Print source secions for printed expansion trees", type = OptionType.Debug) 139 public static final OptionValue<Boolean> TraceTruffleExpansionSource = new OptionValue<>(false); 140 141 @Option(help = "Prints a histogram of all expanded Java methods.", type = OptionType.Debug) 142 public static final OptionValue<Boolean> PrintTruffleExpansionHistogram = new OptionValue<>(false); 143 144 @Option(help = "Treat compilation exceptions as fatal exceptions that will exit the application", type = OptionType.Debug) 145 public static final OptionValue<Boolean> TruffleCompilationExceptionsAreFatal = new OptionValue<>(false); 146 147 @Option(help = "Treat compilation exceptions as thrown runtime exceptions", type = OptionType.Debug) 148 public static final OptionValue<Boolean> TruffleCompilationExceptionsAreThrown = new OptionValue<>(false); 149 150 @Option(help = "Print information for inlining for each compilation.", type = OptionType.Debug) 151 public static final OptionValue<Boolean> TraceTruffleInlining = new OptionValue<>(false); 152 153 @Option(help = "Print information for each splitted call site.", type = OptionType.Debug) 154 public static final OptionValue<Boolean> TraceTruffleSplitting = new OptionValue<>(false); 155 156 @Option(help = "Print stack trace on transfer to interpreter", type = OptionType.Debug) 157 public static final OptionValue<Boolean> TraceTruffleTransferToInterpreter = new StableOptionValue<>(false); 158 159 @Option(help = "Print stack trace on assumption invalidation", type = OptionType.Debug) 160 public static final OptionValue<Boolean> TraceTruffleAssumptions = new StableOptionValue<>(false); 161 162 @Option(help = "Number of stack trace elements printed by TraceTruffleTransferToInterpreter and TraceTruffleAssumptions", type = OptionType.Debug) 163 public static final OptionValue<Integer> TraceTruffleStackTraceLimit = new OptionValue<>(20); 164 165 @Option(help = "Print a summary of execution counts for all executed CallTargets. Introduces counter overhead for each call.", type = OptionType.Debug) 166 public static final OptionValue<Boolean> TruffleCallTargetProfiling = new StableOptionValue<>(false); 167 168 @Option(help = "Print Truffle compilation statistics at the end of a run.", type = OptionType.Debug) 169 public static final OptionValue<Boolean> TruffleCompilationStatistics = new OptionValue<>(false); 170 171 @Option(help = "Print additional more verbose Truffle compilation statistics at the end of a run.", type = OptionType.Debug) 172 public static final OptionValue<Boolean> TruffleCompilationStatisticDetails = new OptionValue<>(false); 173 174 @Option(help = "Enable support for simple infopoints in truffle partial evaluations.", type = OptionType.Expert) 175 public static final OptionValue<Boolean> TruffleEnableInfopoints = new OptionValue<>(false); 176 // @formatter:on 177}