Skip to content

Commit cfb175d

Browse files
author
Nils Eliasson
committed
8256508: Improve CompileCommand flag
Reviewed-by: redestad, kvn
1 parent 7aed9b6 commit cfb175d

22 files changed

+794
-480
lines changed

src/hotspot/share/c1/c1_LIRGenerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3384,7 +3384,7 @@ void LIRGenerator::do_ProfileInvoke(ProfileInvoke* x) {
33843384
// Notify the runtime very infrequently only to take care of counter overflows
33853385
int freq_log = Tier23InlineeNotifyFreqLog;
33863386
double scale;
3387-
if (_method->has_option_value("CompileThresholdScaling", scale)) {
3387+
if (_method->has_option_value(CompileCommand::CompileThresholdScaling, scale)) {
33883388
freq_log = CompilerConfig::scaled_freq_log(freq_log, scale);
33893389
}
33903390
increment_event_counter_impl(info, x->inlinee(), LIR_OprFact::intConst(InvocationCounter::count_increment), right_n_bits(freq_log), InvocationEntryBci, false, true);
@@ -3425,7 +3425,7 @@ void LIRGenerator::increment_event_counter(CodeEmitInfo* info, LIR_Opr step, int
34253425
}
34263426
// Increment the appropriate invocation/backedge counter and notify the runtime.
34273427
double scale;
3428-
if (_method->has_option_value("CompileThresholdScaling", scale)) {
3428+
if (_method->has_option_value(CompileCommand::CompileThresholdScaling, scale)) {
34293429
freq_log = CompilerConfig::scaled_freq_log(freq_log, scale);
34303430
}
34313431
increment_event_counter_impl(info, info->scope()->method(), step, right_n_bits(freq_log), bci, backedge, true);

src/hotspot/share/ci/ciMethod.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,17 +1043,17 @@ MethodCounters* ciMethod::ensure_method_counters() {
10431043
// ------------------------------------------------------------------
10441044
// ciMethod::has_option
10451045
//
1046-
bool ciMethod::has_option(const char* option) {
1046+
bool ciMethod::has_option(enum CompileCommand option) {
10471047
check_is_loaded();
10481048
VM_ENTRY_MARK;
10491049
methodHandle mh(THREAD, get_Method());
1050-
return CompilerOracle::has_option_string(mh, option);
1050+
return CompilerOracle::has_option(mh, option);
10511051
}
10521052

10531053
// ------------------------------------------------------------------
10541054
// ciMethod::has_option_value
10551055
//
1056-
bool ciMethod::has_option_value(const char* option, double& value) {
1056+
bool ciMethod::has_option_value(enum CompileCommand option, double& value) {
10571057
check_is_loaded();
10581058
VM_ENTRY_MARK;
10591059
methodHandle mh(THREAD, get_Method());

src/hotspot/share/ci/ciMethod.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ class ciMethod : public ciMetadata {
293293
// Find the proper vtable index to invoke this method.
294294
int resolve_vtable_index(ciKlass* caller, ciKlass* receiver);
295295

296-
bool has_option(const char *option);
297-
bool has_option_value(const char* option, double& value);
296+
bool has_option(enum CompileCommand option);
297+
bool has_option_value(enum CompileCommand option, double& value);
298298
bool can_be_compiled();
299299
bool can_be_parsed() const { return _can_be_parsed; }
300300
bool has_compiled_code();

src/hotspot/share/code/nmethod.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -978,15 +978,15 @@ void nmethod::print_nmethod(bool printmethod) {
978978
#if defined(SUPPORT_DATA_STRUCTS)
979979
if (AbstractDisassembler::show_structs()) {
980980
methodHandle mh(Thread::current(), _method);
981-
if (printmethod || PrintDebugInfo || CompilerOracle::has_option_string(mh, "PrintDebugInfo")) {
981+
if (printmethod || PrintDebugInfo || CompilerOracle::has_option(mh, CompileCommand::PrintDebugInfo)) {
982982
print_scopes();
983983
tty->print_cr("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
984984
}
985-
if (printmethod || PrintRelocations || CompilerOracle::has_option_string(mh, "PrintRelocations")) {
985+
if (printmethod || PrintRelocations || CompilerOracle::has_option(mh, CompileCommand::PrintRelocations)) {
986986
print_relocations();
987987
tty->print_cr("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
988988
}
989-
if (printmethod || PrintDependencies || CompilerOracle::has_option_string(mh, "PrintDependencies")) {
989+
if (printmethod || PrintDependencies || CompilerOracle::has_option(mh, CompileCommand::PrintDependencies)) {
990990
print_dependencies();
991991
tty->print_cr("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
992992
}

src/hotspot/share/compiler/compileBroker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,8 +1585,8 @@ bool CompileBroker::compilation_is_prohibited(const methodHandle& method, int os
15851585

15861586
// The method may be explicitly excluded by the user.
15871587
double scale;
1588-
if (excluded || (CompilerOracle::has_option_value(method, "CompileThresholdScaling", scale) && scale == 0)) {
1589-
bool quietly = CompilerOracle::should_exclude_quietly();
1588+
if (excluded || (CompilerOracle::has_option_value(method, CompileCommand::CompileThresholdScaling, scale) && scale == 0)) {
1589+
bool quietly = CompilerOracle::be_quiet();
15901590
if (PrintCompilation && !quietly) {
15911591
// This does not happen quietly...
15921592
ResourceMark rm;

src/hotspot/share/compiler/compilerDirectives.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ bool CompilerDirectives::match(const methodHandle& method) {
140140
}
141141

142142
bool CompilerDirectives::add_match(char* str, const char*& error_msg) {
143-
BasicMatcher* bm = BasicMatcher::parse_method_pattern(str, error_msg);
143+
BasicMatcher* bm = BasicMatcher::parse_method_pattern(str, error_msg, false);
144144
if (bm == NULL) {
145145
assert(error_msg != NULL, "Must have error message");
146146
return false;
@@ -326,7 +326,7 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle
326326
// Early bail out - checking all options is expensive - we rely on them not being used
327327
// Only set a flag if it has not been modified and value changes.
328328
// Only copy set if a flag needs to be set
329-
if (!CompilerDirectivesIgnoreCompileCommandsOption && CompilerOracle::has_any_option()) {
329+
if (!CompilerDirectivesIgnoreCompileCommandsOption && CompilerOracle::has_any_command_set()) {
330330
DirectiveSetPtr set(this);
331331

332332
// All CompileCommands are not equal so this gets a bit verbose
@@ -359,8 +359,7 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle
359359
}
360360

361361
// inline and dontinline (including exclude) are implemented in the directiveset accessors
362-
// ignore flags whose cc_flags are X
363-
#define init_default_cc(name, type, dvalue, cc_flag) { type v; if (!_modified[name##Index] && CompilerOracle::has_option_value(method, #cc_flag, v) && v != this->name##Option) { set.cloned()->name##Option = v; } }
362+
#define init_default_cc(name, type, dvalue, cc_flag) { type v; if (!_modified[name##Index] && CompilerOracle::has_option_value(method, CompileCommand::cc_flag, v) && v != this->name##Option) { set.cloned()->name##Option = v; } }
364363
compilerdirectives_common_flags(init_default_cc)
365364
compilerdirectives_c2_flags(init_default_cc)
366365
compilerdirectives_c1_flags(init_default_cc)
@@ -370,7 +369,7 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle
370369
bool need_reset = true; // if Control/DisableIntrinsic redefined, only need to reset control_words once
371370

372371
if (!_modified[ControlIntrinsicIndex] &&
373-
CompilerOracle::has_option_value(method, "ControlIntrinsic", option_value)) {
372+
CompilerOracle::has_option_value(method, CompileCommand::ControlIntrinsic, option_value)) {
374373
ControlIntrinsicIter iter(option_value);
375374

376375
if (need_reset) {
@@ -390,7 +389,7 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle
390389

391390

392391
if (!_modified[DisableIntrinsicIndex] &&
393-
CompilerOracle::has_option_value(method, "DisableIntrinsic", option_value)) {
392+
CompilerOracle::has_option_value(method, CompileCommand::DisableIntrinsic, option_value)) {
394393
ControlIntrinsicIter iter(option_value, true/*disable_all*/);
395394

396395
if (need_reset) {

src/hotspot/share/compiler/compilerDirectives.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@
3434

3535
// Directives flag name, type, default value, compile command name
3636
#define compilerdirectives_common_flags(cflags) \
37-
cflags(Enable, bool, false, X) \
38-
cflags(Exclude, bool, false, X) \
37+
cflags(Enable, bool, false, Unknown) \
38+
cflags(Exclude, bool, false, Unknown) \
3939
cflags(BreakAtExecute, bool, false, BreakAtExecute) \
4040
cflags(BreakAtCompile, bool, false, BreakAtCompile) \
41-
cflags(Log, bool, LogCompilation, X) \
41+
cflags(Log, bool, LogCompilation, Unknown) \
4242
cflags(PrintAssembly, bool, PrintAssembly, PrintAssembly) \
4343
cflags(PrintInlining, bool, PrintInlining, PrintInlining) \
4444
cflags(PrintNMethods, bool, PrintNMethods, PrintNMethods) \
4545
cflags(BackgroundCompilation, bool, BackgroundCompilation, BackgroundCompilation) \
4646
cflags(ReplayInline, bool, false, ReplayInline) \
4747
cflags(DumpReplay, bool, false, DumpReplay) \
4848
cflags(DumpInline, bool, false, DumpInline) \
49-
cflags(CompilerDirectivesIgnoreCompileCommands, bool, CompilerDirectivesIgnoreCompileCommands, X) \
49+
cflags(CompilerDirectivesIgnoreCompileCommands, bool, CompilerDirectivesIgnoreCompileCommands, Unknown) \
5050
cflags(DisableIntrinsic, ccstrlist, DisableIntrinsic, DisableIntrinsic) \
5151
cflags(ControlIntrinsic, ccstrlist, ControlIntrinsic, ControlIntrinsic) \
5252
cflags(RepeatCompilation, intx, RepeatCompilation, RepeatCompilation)

0 commit comments

Comments
 (0)