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; 24 25 import static jdk.vm.ci.common.InitTimer.timer; 26 import static org.graalvm.compiler.hotspot.HotSpotGraalOptionValues.GRAAL_OPTION_PROPERTY_PREFIX; 27 28 import java.io.PrintStream; 29 30 import org.graalvm.compiler.debug.MethodFilter; 31 import org.graalvm.compiler.options.Option; 32 import org.graalvm.compiler.options.OptionKey; 33 import org.graalvm.compiler.options.OptionType; 34 import org.graalvm.compiler.options.OptionValues; 35 import org.graalvm.compiler.options.OptionsParser; 36 import org.graalvm.compiler.phases.tiers.CompilerConfiguration; 37 38 import jdk.vm.ci.common.InitTimer; 39 import jdk.vm.ci.hotspot.HotSpotJVMCICompilerFactory; 40 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; 41 import jdk.vm.ci.hotspot.HotSpotSignature; 42 import jdk.vm.ci.runtime.JVMCIRuntime; 43 44 public final class HotSpotGraalCompilerFactory extends HotSpotJVMCICompilerFactory { 45 46 private static MethodFilter[] graalCompileOnlyFilter; 47 private static boolean compileGraalWithC1Only; 48 172 } 173 return checkGraalCompileOnlyFilter(declaringClass.getName(), name, signature, level); 174 } 175 176 public static CompilationLevel checkGraalCompileOnlyFilter(String declaringClassName, String name, String signature, CompilationLevel level) { 177 if (graalCompileOnlyFilter != null) { 178 if (level == CompilationLevel.FullOptimization) { 179 HotSpotSignature sig = null; 180 for (MethodFilter filter : graalCompileOnlyFilter) { 181 if (filter.hasSignature() && sig == null) { 182 sig = new HotSpotSignature(HotSpotJVMCIRuntime.runtime(), signature); 183 } 184 if (filter.matches(declaringClassName, name, sig)) { 185 return level; 186 } 187 } 188 return CompilationLevel.Simple; 189 } 190 } 191 return level; 192 } 193 } | 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; 24 25 import static jdk.vm.ci.common.InitTimer.timer; 26 import static org.graalvm.compiler.hotspot.HotSpotGraalOptionValues.GRAAL_OPTION_PROPERTY_PREFIX; 27 28 import java.io.PrintStream; 29 import java.util.Map; 30 import java.util.Collections; 31 32 import org.graalvm.compiler.debug.MethodFilter; 33 import org.graalvm.compiler.options.Option; 34 import org.graalvm.compiler.options.OptionKey; 35 import org.graalvm.compiler.options.OptionType; 36 import org.graalvm.compiler.options.OptionValues; 37 import org.graalvm.compiler.options.OptionsParser; 38 import org.graalvm.compiler.phases.tiers.CompilerConfiguration; 39 40 import jdk.vm.ci.common.InitTimer; 41 import jdk.vm.ci.hotspot.HotSpotJVMCICompilerFactory; 42 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; 43 import jdk.vm.ci.hotspot.HotSpotSignature; 44 import jdk.vm.ci.runtime.JVMCIRuntime; 45 46 public final class HotSpotGraalCompilerFactory extends HotSpotJVMCICompilerFactory { 47 48 private static MethodFilter[] graalCompileOnlyFilter; 49 private static boolean compileGraalWithC1Only; 50 174 } 175 return checkGraalCompileOnlyFilter(declaringClass.getName(), name, signature, level); 176 } 177 178 public static CompilationLevel checkGraalCompileOnlyFilter(String declaringClassName, String name, String signature, CompilationLevel level) { 179 if (graalCompileOnlyFilter != null) { 180 if (level == CompilationLevel.FullOptimization) { 181 HotSpotSignature sig = null; 182 for (MethodFilter filter : graalCompileOnlyFilter) { 183 if (filter.hasSignature() && sig == null) { 184 sig = new HotSpotSignature(HotSpotJVMCIRuntime.runtime(), signature); 185 } 186 if (filter.matches(declaringClassName, name, sig)) { 187 return level; 188 } 189 } 190 return CompilationLevel.Simple; 191 } 192 } 193 return level; 194 } 195 196 public Map<String, Object> mbeans() { 197 HotSpotGraalCompiler compiler = createCompiler(HotSpotJVMCIRuntime.runtime()); 198 String name = "org.graalvm.compiler.hotspot:type=Options"; 199 Object bean = ((HotSpotGraalRuntime) compiler.getGraalRuntime()).getMBean(); 200 return Collections.singletonMap(name, bean); 201 } 202 } |