comparison graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java @ 20116:674a81af7992

removed IntrinsificationsEnabled and IntrinsificationsDisabled options
author Doug Simon <doug.simon@oracle.com>
date Wed, 01 Apr 2015 13:59:01 +0200
parents cc3131ff7ce2
children 0e5a0403729c
comparison
equal deleted inserted replaced
20115:67507ee4e8d6 20116:674a81af7992
21 * questions. 21 * questions.
22 */ 22 */
23 package com.oracle.graal.compiler; 23 package com.oracle.graal.compiler;
24 24
25 import static com.oracle.graal.compiler.GraalCompiler.Options.*; 25 import static com.oracle.graal.compiler.GraalCompiler.Options.*;
26 import static com.oracle.graal.compiler.MethodFilter.*;
27 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*; 26 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
28 27
29 import java.util.*; 28 import java.util.*;
30 29
31 import com.oracle.graal.api.code.*; 30 import com.oracle.graal.api.code.*;
64 private static final DebugTimer FrontEnd = Debug.timer("FrontEnd"); 63 private static final DebugTimer FrontEnd = Debug.timer("FrontEnd");
65 private static final DebugTimer BackEnd = Debug.timer("BackEnd"); 64 private static final DebugTimer BackEnd = Debug.timer("BackEnd");
66 private static final DebugTimer EmitLIR = Debug.timer("EmitLIR"); 65 private static final DebugTimer EmitLIR = Debug.timer("EmitLIR");
67 private static final DebugTimer EmitCode = Debug.timer("EmitCode"); 66 private static final DebugTimer EmitCode = Debug.timer("EmitCode");
68 67
69 /**
70 * The set of positive filters specified by the {@code -G:IntrinsificationsEnabled} option. To
71 * enable a fast path in {@link #shouldIntrinsify(JavaMethod)}, this field is {@code null} when
72 * no enabling/disabling filters are specified.
73 */
74 private static final MethodFilter[] positiveIntrinsificationFilter;
75
76 /**
77 * The set of negative filters specified by the {@code -G:IntrinsificationsDisabled} option.
78 */
79 private static final MethodFilter[] negativeIntrinsificationFilter;
80
81 static class Options { 68 static class Options {
82 69
83 // @formatter:off 70 // @formatter:off
84 /**
85 * @see MethodFilter
86 */
87 @Option(help = "Pattern for method(s) to which intrinsification (if available) will be applied. " +
88 "By default, all available intrinsifications are applied except for methods matched " +
89 "by IntrinsificationsDisabled. See MethodFilter class for pattern syntax.", type = OptionType.Debug)
90 public static final OptionValue<String> IntrinsificationsEnabled = new OptionValue<>(null);
91 /**
92 * @see MethodFilter
93 */
94 @Option(help = "Pattern for method(s) to which intrinsification will not be applied. " +
95 "See MethodFilter class for pattern syntax.", type = OptionType.Debug)
96 public static final OptionValue<String> IntrinsificationsDisabled = new OptionValue<>(null);
97
98 @Option(help = "Repeatedly run the LIR code generation pass to improve statistical profiling results.", type = OptionType.Debug) 71 @Option(help = "Repeatedly run the LIR code generation pass to improve statistical profiling results.", type = OptionType.Debug)
99 public static final OptionValue<Integer> EmitLIRRepeatCount = new OptionValue<>(0); 72 public static final OptionValue<Integer> EmitLIRRepeatCount = new OptionValue<>(0);
100 // @formatter:on 73 // @formatter:on
101 74
102 }
103
104 static {
105 if (IntrinsificationsDisabled.getValue() != null) {
106 negativeIntrinsificationFilter = parse(IntrinsificationsDisabled.getValue());
107 } else {
108 negativeIntrinsificationFilter = null;
109 }
110
111 if (Options.IntrinsificationsEnabled.getValue() != null) {
112 positiveIntrinsificationFilter = parse(IntrinsificationsEnabled.getValue());
113 } else if (negativeIntrinsificationFilter != null) {
114 positiveIntrinsificationFilter = new MethodFilter[0];
115 } else {
116 positiveIntrinsificationFilter = null;
117 }
118 }
119
120 /**
121 * Determines if a given method should be intrinsified based on the values of
122 * {@link Options#IntrinsificationsEnabled} and {@link Options#IntrinsificationsDisabled}.
123 */
124 public static boolean shouldIntrinsify(JavaMethod method) {
125 if (positiveIntrinsificationFilter == null) {
126 return true;
127 }
128 if (positiveIntrinsificationFilter.length == 0 || matches(positiveIntrinsificationFilter, method)) {
129 return negativeIntrinsificationFilter == null || !matches(negativeIntrinsificationFilter, method);
130 }
131 return false;
132 } 75 }
133 76
134 /** 77 /**
135 * Encapsulates all the inputs to a {@linkplain GraalCompiler#compile(Request) compilation}. 78 * Encapsulates all the inputs to a {@linkplain GraalCompiler#compile(Request) compilation}.
136 */ 79 */