Skip to content

Commit 17ace83

Browse files
committed
8258074: Move some flags related to compiler to compiler_globals.hpp
Reviewed-by: kvn, coleenp
1 parent 47ba652 commit 17ace83

File tree

12 files changed

+481
-440
lines changed

12 files changed

+481
-440
lines changed

src/hotspot/share/ci/bcEscapeAnalyzer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "ci/ciField.hpp"
3030
#include "ci/ciMethodBlocks.hpp"
3131
#include "ci/ciStreams.hpp"
32+
#include "compiler/compiler_globals.hpp"
3233
#include "interpreter/bytecode.hpp"
3334
#include "oops/oop.inline.hpp"
3435
#include "utilities/align.hpp"

src/hotspot/share/ci/ciMethodData.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
2727
#include "ci/ciMethodData.hpp"
2828
#include "ci/ciReplay.hpp"
2929
#include "ci/ciUtilities.inline.hpp"
30+
#include "compiler/compiler_globals.hpp"
3031
#include "memory/allocation.inline.hpp"
3132
#include "memory/resourceArea.hpp"
3233
#include "runtime/deoptimization.hpp"

src/hotspot/share/ci/ciObjectFactory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "ci/ciUtilities.inline.hpp"
4545
#include "classfile/javaClasses.inline.hpp"
4646
#include "classfile/systemDictionary.hpp"
47+
#include "compiler/compiler_globals.hpp"
4748
#include "gc/shared/collectedHeap.inline.hpp"
4849
#include "memory/allocation.inline.hpp"
4950
#include "memory/universe.hpp"

src/hotspot/share/compiler/compiler_globals.hpp

Lines changed: 410 additions & 0 deletions
Large diffs are not rendered by default.

src/hotspot/share/interpreter/invocationCounter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424

2525
#include "precompiled.hpp"
26+
#include "compiler/compiler_globals.hpp"
2627
#include "interpreter/invocationCounter.hpp"
2728

2829
void InvocationCounter::init() {

src/hotspot/share/oops/methodCounters.cpp

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,10 +22,52 @@
2222
*
2323
*/
2424
#include "precompiled.hpp"
25+
#include "compiler/compiler_globals.hpp"
2526
#include "memory/metaspaceClosure.hpp"
2627
#include "oops/methodCounters.hpp"
2728
#include "runtime/handles.inline.hpp"
2829

30+
MethodCounters::MethodCounters(const methodHandle& mh) :
31+
#if INCLUDE_AOT
32+
_method(mh()),
33+
#endif
34+
_nmethod_age(INT_MAX)
35+
#ifdef TIERED
36+
, _rate(0),
37+
_prev_time(0),
38+
_highest_comp_level(0),
39+
_highest_osr_comp_level(0)
40+
#endif
41+
{
42+
set_interpreter_invocation_count(0);
43+
set_interpreter_throwout_count(0);
44+
JVMTI_ONLY(clear_number_of_breakpoints());
45+
invocation_counter()->init();
46+
backedge_counter()->init();
47+
48+
if (StressCodeAging) {
49+
set_nmethod_age(HotMethodDetectionLimit);
50+
}
51+
52+
// Set per-method thresholds.
53+
double scale = 1.0;
54+
CompilerOracle::has_option_value(mh, CompileCommand::CompileThresholdScaling, scale);
55+
56+
int compile_threshold = CompilerConfig::scaled_compile_threshold(CompileThreshold, scale);
57+
_interpreter_invocation_limit = compile_threshold << InvocationCounter::count_shift;
58+
if (ProfileInterpreter) {
59+
// If interpreter profiling is enabled, the backward branch limit
60+
// is compared against the method data counter rather than an invocation
61+
// counter, therefore no shifting of bits is required.
62+
_interpreter_backward_branch_limit = (int)((int64_t)compile_threshold * (OnStackReplacePercentage - InterpreterProfilePercentage) / 100);
63+
} else {
64+
_interpreter_backward_branch_limit = (int)(((int64_t)compile_threshold * OnStackReplacePercentage / 100) << InvocationCounter::count_shift);
65+
}
66+
_interpreter_profile_limit = ((compile_threshold * InterpreterProfilePercentage) / 100) << InvocationCounter::count_shift;
67+
_invoke_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
68+
_backedge_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
69+
}
70+
2971
MethodCounters* MethodCounters::allocate(const methodHandle& mh, TRAPS) {
3072
ClassLoaderData* loader_data = mh->method_holder()->class_loader_data();
3173
return new(loader_data, method_counters_size(), MetaspaceObj::MethodCountersType, THREAD) MethodCounters(mh);

src/hotspot/share/oops/methodCounters.hpp

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -70,46 +70,7 @@ class MethodCounters : public Metadata {
7070
u1 _highest_osr_comp_level; // Same for OSR level
7171
#endif
7272

73-
MethodCounters(const methodHandle& mh) :
74-
#if INCLUDE_AOT
75-
_method(mh()),
76-
#endif
77-
_nmethod_age(INT_MAX)
78-
#ifdef TIERED
79-
, _rate(0),
80-
_prev_time(0),
81-
_highest_comp_level(0),
82-
_highest_osr_comp_level(0)
83-
#endif
84-
{
85-
set_interpreter_invocation_count(0);
86-
set_interpreter_throwout_count(0);
87-
JVMTI_ONLY(clear_number_of_breakpoints());
88-
invocation_counter()->init();
89-
backedge_counter()->init();
90-
91-
if (StressCodeAging) {
92-
set_nmethod_age(HotMethodDetectionLimit);
93-
}
94-
95-
// Set per-method thresholds.
96-
double scale = 1.0;
97-
CompilerOracle::has_option_value(mh, CompileCommand::CompileThresholdScaling, scale);
98-
99-
int compile_threshold = CompilerConfig::scaled_compile_threshold(CompileThreshold, scale);
100-
_interpreter_invocation_limit = compile_threshold << InvocationCounter::count_shift;
101-
if (ProfileInterpreter) {
102-
// If interpreter profiling is enabled, the backward branch limit
103-
// is compared against the method data counter rather than an invocation
104-
// counter, therefore no shifting of bits is required.
105-
_interpreter_backward_branch_limit = (int)((int64_t)compile_threshold * (OnStackReplacePercentage - InterpreterProfilePercentage) / 100);
106-
} else {
107-
_interpreter_backward_branch_limit = (int)(((int64_t)compile_threshold * OnStackReplacePercentage / 100) << InvocationCounter::count_shift);
108-
}
109-
_interpreter_profile_limit = ((compile_threshold * InterpreterProfilePercentage) / 100) << InvocationCounter::count_shift;
110-
_invoke_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
111-
_backedge_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
112-
}
73+
MethodCounters(const methodHandle& mh);
11374

11475
public:
11576
virtual bool is_methodCounters() const { return true; }

src/hotspot/share/prims/jni.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "classfile/symbolTable.hpp"
3939
#include "classfile/systemDictionary.hpp"
4040
#include "classfile/vmSymbols.hpp"
41+
#include "compiler/compiler_globals.hpp"
4142
#include "gc/shared/gcLocker.inline.hpp"
4243
#include "interpreter/linkResolver.hpp"
4344
#include "jfr/jfrEvents.hpp"

src/hotspot/share/runtime/flags/allFlags.hpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
#include "compiler/compiler_globals.hpp"
2929
#include "runtime/globals.hpp"
3030

31-
// Put the LP64/JVMCI/COMPILER1/COMPILER1/ARCH at
32-
// the top, as they are processed by jvmFlags.cpp in that
33-
// order.
31+
// Put LP64/ARCH/JVMCI/COMPILER1/COMPILER2 at the top,
32+
// as they are processed by jvmFlag.cpp in that order.
3433

3534
#define ALL_FLAGS( \
3635
develop, \
@@ -50,6 +49,13 @@
5049
range, \
5150
constraint) \
5251
\
52+
ARCH_FLAGS( \
53+
develop, \
54+
product, \
55+
notproduct, \
56+
range, \
57+
constraint) \
58+
\
5359
JVMCI_ONLY(JVMCI_FLAGS( \
5460
develop, \
5561
develop_pd, \
@@ -77,9 +83,11 @@
7783
range, \
7884
constraint)) \
7985
\
80-
ARCH_FLAGS( \
86+
COMPILER_FLAGS( \
8187
develop, \
88+
develop_pd, \
8289
product, \
90+
product_pd, \
8391
notproduct, \
8492
range, \
8593
constraint) \

src/hotspot/share/runtime/flags/jvmFlag.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,32 +466,32 @@ const char* JVMFlag::flag_error_str(JVMFlag::Error error) {
466466
//----------------------------------------------------------------------
467467
// Build flagTable[]
468468

469-
// Find out the number of LP64/JVMCI/COMPILER1/COMPILER1/ARCH flags,
469+
// Find out the number of LP64/ARCH/JVMCI/COMPILER1/COMPILER2 flags,
470470
// for JVMFlag::flag_group()
471471

472472
#define ENUM_F(type, name, ...) enum_##name,
473473
#define IGNORE_F(...)
474474

475475
// dev dev-pd pro pro-pd notpro range constraint
476476
enum FlagCounter_LP64 { LP64_RUNTIME_FLAGS( ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_LP64 };
477+
enum FlagCounter_ARCH { ARCH_FLAGS( ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_ARCH };
477478
enum FlagCounter_JVMCI { JVMCI_ONLY(JVMCI_FLAGS( ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_JVMCI };
478479
enum FlagCounter_C1 { COMPILER1_PRESENT(C1_FLAGS(ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_C1 };
479480
enum FlagCounter_C2 { COMPILER2_PRESENT(C2_FLAGS(ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_C2 };
480-
enum FlagCounter_ARCH { ARCH_FLAGS( ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_ARCH };
481481

482482
const int first_flag_enum_LP64 = 0;
483-
const int first_flag_enum_JVMCI = first_flag_enum_LP64 + num_flags_LP64;
483+
const int first_flag_enum_ARCH = first_flag_enum_LP64 + num_flags_LP64;
484+
const int first_flag_enum_JVMCI = first_flag_enum_ARCH + num_flags_ARCH;
484485
const int first_flag_enum_C1 = first_flag_enum_JVMCI + num_flags_JVMCI;
485486
const int first_flag_enum_C2 = first_flag_enum_C1 + num_flags_C1;
486-
const int first_flag_enum_ARCH = first_flag_enum_C2 + num_flags_C2;
487-
const int first_flag_enum_other = first_flag_enum_ARCH + num_flags_ARCH;
487+
const int first_flag_enum_other = first_flag_enum_C2 + num_flags_C2;
488488

489489
static constexpr int flag_group(int flag_enum) {
490-
if (flag_enum < first_flag_enum_JVMCI) return JVMFlag::KIND_LP64_PRODUCT;
490+
if (flag_enum < first_flag_enum_ARCH) return JVMFlag::KIND_LP64_PRODUCT;
491+
if (flag_enum < first_flag_enum_JVMCI) return JVMFlag::KIND_ARCH;
491492
if (flag_enum < first_flag_enum_C1) return JVMFlag::KIND_JVMCI;
492493
if (flag_enum < first_flag_enum_C2) return JVMFlag::KIND_C1;
493-
if (flag_enum < first_flag_enum_ARCH) return JVMFlag::KIND_C2;
494-
if (flag_enum < first_flag_enum_other) return JVMFlag::KIND_ARCH;
494+
if (flag_enum < first_flag_enum_other) return JVMFlag::KIND_C2;
495495

496496
return 0;
497497
}

0 commit comments

Comments
 (0)