Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/hotspot/share/ci/bcEscapeAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "ci/ciField.hpp"
#include "ci/ciMethodBlocks.hpp"
#include "ci/ciStreams.hpp"
#include "compiler/compiler_globals.hpp"
#include "interpreter/bytecode.hpp"
#include "oops/oop.inline.hpp"
#include "utilities/align.hpp"
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/ci/ciMethodData.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -27,6 +27,7 @@
#include "ci/ciMethodData.hpp"
#include "ci/ciReplay.hpp"
#include "ci/ciUtilities.inline.hpp"
#include "compiler/compiler_globals.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/deoptimization.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/ci/ciObjectFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "ci/ciUtilities.inline.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/systemDictionary.hpp"
#include "compiler/compiler_globals.hpp"
#include "gc/shared/collectedHeap.inline.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/universe.hpp"
Expand Down
410 changes: 410 additions & 0 deletions src/hotspot/share/compiler/compiler_globals.hpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/hotspot/share/interpreter/invocationCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

#include "precompiled.hpp"
#include "compiler/compiler_globals.hpp"
#include "interpreter/invocationCounter.hpp"

void InvocationCounter::init() {
Expand Down
44 changes: 43 additions & 1 deletion src/hotspot/share/oops/methodCounters.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -22,10 +22,52 @@
*
*/
#include "precompiled.hpp"
#include "compiler/compiler_globals.hpp"
#include "memory/metaspaceClosure.hpp"
#include "oops/methodCounters.hpp"
#include "runtime/handles.inline.hpp"

MethodCounters::MethodCounters(const methodHandle& mh) :
#if INCLUDE_AOT
_method(mh()),
#endif
_nmethod_age(INT_MAX)
#ifdef TIERED
, _rate(0),
_prev_time(0),
_highest_comp_level(0),
_highest_osr_comp_level(0)
#endif
{
set_interpreter_invocation_count(0);
set_interpreter_throwout_count(0);
JVMTI_ONLY(clear_number_of_breakpoints());
invocation_counter()->init();
backedge_counter()->init();

if (StressCodeAging) {
set_nmethod_age(HotMethodDetectionLimit);
}

// Set per-method thresholds.
double scale = 1.0;
CompilerOracle::has_option_value(mh, CompileCommand::CompileThresholdScaling, scale);

int compile_threshold = CompilerConfig::scaled_compile_threshold(CompileThreshold, scale);
_interpreter_invocation_limit = compile_threshold << InvocationCounter::count_shift;
if (ProfileInterpreter) {
// If interpreter profiling is enabled, the backward branch limit
// is compared against the method data counter rather than an invocation
// counter, therefore no shifting of bits is required.
_interpreter_backward_branch_limit = (int)((int64_t)compile_threshold * (OnStackReplacePercentage - InterpreterProfilePercentage) / 100);
} else {
_interpreter_backward_branch_limit = (int)(((int64_t)compile_threshold * OnStackReplacePercentage / 100) << InvocationCounter::count_shift);
}
_interpreter_profile_limit = ((compile_threshold * InterpreterProfilePercentage) / 100) << InvocationCounter::count_shift;
_invoke_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
_backedge_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
}

MethodCounters* MethodCounters::allocate(const methodHandle& mh, TRAPS) {
ClassLoaderData* loader_data = mh->method_holder()->class_loader_data();
return new(loader_data, method_counters_size(), MetaspaceObj::MethodCountersType, THREAD) MethodCounters(mh);
Expand Down
41 changes: 1 addition & 40 deletions src/hotspot/share/oops/methodCounters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,46 +70,7 @@ class MethodCounters : public Metadata {
u1 _highest_osr_comp_level; // Same for OSR level
#endif

MethodCounters(const methodHandle& mh) :
#if INCLUDE_AOT
_method(mh()),
#endif
_nmethod_age(INT_MAX)
#ifdef TIERED
, _rate(0),
_prev_time(0),
_highest_comp_level(0),
_highest_osr_comp_level(0)
#endif
{
set_interpreter_invocation_count(0);
set_interpreter_throwout_count(0);
JVMTI_ONLY(clear_number_of_breakpoints());
invocation_counter()->init();
backedge_counter()->init();

if (StressCodeAging) {
set_nmethod_age(HotMethodDetectionLimit);
}

// Set per-method thresholds.
double scale = 1.0;
CompilerOracle::has_option_value(mh, CompileCommand::CompileThresholdScaling, scale);

int compile_threshold = CompilerConfig::scaled_compile_threshold(CompileThreshold, scale);
_interpreter_invocation_limit = compile_threshold << InvocationCounter::count_shift;
if (ProfileInterpreter) {
// If interpreter profiling is enabled, the backward branch limit
// is compared against the method data counter rather than an invocation
// counter, therefore no shifting of bits is required.
_interpreter_backward_branch_limit = (int)((int64_t)compile_threshold * (OnStackReplacePercentage - InterpreterProfilePercentage) / 100);
} else {
_interpreter_backward_branch_limit = (int)(((int64_t)compile_threshold * OnStackReplacePercentage / 100) << InvocationCounter::count_shift);
}
_interpreter_profile_limit = ((compile_threshold * InterpreterProfilePercentage) / 100) << InvocationCounter::count_shift;
_invoke_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
_backedge_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
}
MethodCounters(const methodHandle& mh);

public:
virtual bool is_methodCounters() const { return true; }
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/prims/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "compiler/compiler_globals.hpp"
#include "gc/shared/gcLocker.inline.hpp"
#include "interpreter/linkResolver.hpp"
#include "jfr/jfrEvents.hpp"
Expand Down
16 changes: 12 additions & 4 deletions src/hotspot/share/runtime/flags/allFlags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
#include "compiler/compiler_globals.hpp"
#include "runtime/globals.hpp"

// Put the LP64/JVMCI/COMPILER1/COMPILER1/ARCH at
// the top, as they are processed by jvmFlags.cpp in that
// order.
// Put LP64/ARCH/JVMCI/COMPILER1/COMPILER2 at the top,
// as they are processed by jvmFlag.cpp in that order.

#define ALL_FLAGS( \
develop, \
Expand All @@ -50,6 +49,13 @@
range, \
constraint) \
\
ARCH_FLAGS( \
develop, \
product, \
notproduct, \
range, \
constraint) \
\
JVMCI_ONLY(JVMCI_FLAGS( \
develop, \
develop_pd, \
Expand Down Expand Up @@ -77,9 +83,11 @@
range, \
constraint)) \
\
ARCH_FLAGS( \
COMPILER_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
notproduct, \
range, \
constraint) \
Expand Down
16 changes: 8 additions & 8 deletions src/hotspot/share/runtime/flags/jvmFlag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,32 +466,32 @@ const char* JVMFlag::flag_error_str(JVMFlag::Error error) {
//----------------------------------------------------------------------
// Build flagTable[]

// Find out the number of LP64/JVMCI/COMPILER1/COMPILER1/ARCH flags,
// Find out the number of LP64/ARCH/JVMCI/COMPILER1/COMPILER2 flags,
// for JVMFlag::flag_group()

#define ENUM_F(type, name, ...) enum_##name,
#define IGNORE_F(...)

// dev dev-pd pro pro-pd notpro range constraint
enum FlagCounter_LP64 { LP64_RUNTIME_FLAGS( ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_LP64 };
enum FlagCounter_ARCH { ARCH_FLAGS( ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_ARCH };
enum FlagCounter_JVMCI { JVMCI_ONLY(JVMCI_FLAGS( ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_JVMCI };
enum FlagCounter_C1 { COMPILER1_PRESENT(C1_FLAGS(ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_C1 };
enum FlagCounter_C2 { COMPILER2_PRESENT(C2_FLAGS(ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_C2 };
enum FlagCounter_ARCH { ARCH_FLAGS( ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_ARCH };

const int first_flag_enum_LP64 = 0;
const int first_flag_enum_JVMCI = first_flag_enum_LP64 + num_flags_LP64;
const int first_flag_enum_ARCH = first_flag_enum_LP64 + num_flags_LP64;
const int first_flag_enum_JVMCI = first_flag_enum_ARCH + num_flags_ARCH;
const int first_flag_enum_C1 = first_flag_enum_JVMCI + num_flags_JVMCI;
const int first_flag_enum_C2 = first_flag_enum_C1 + num_flags_C1;
const int first_flag_enum_ARCH = first_flag_enum_C2 + num_flags_C2;
const int first_flag_enum_other = first_flag_enum_ARCH + num_flags_ARCH;
const int first_flag_enum_other = first_flag_enum_C2 + num_flags_C2;

static constexpr int flag_group(int flag_enum) {
if (flag_enum < first_flag_enum_JVMCI) return JVMFlag::KIND_LP64_PRODUCT;
if (flag_enum < first_flag_enum_ARCH) return JVMFlag::KIND_LP64_PRODUCT;
if (flag_enum < first_flag_enum_JVMCI) return JVMFlag::KIND_ARCH;
if (flag_enum < first_flag_enum_C1) return JVMFlag::KIND_JVMCI;
if (flag_enum < first_flag_enum_C2) return JVMFlag::KIND_C1;
if (flag_enum < first_flag_enum_ARCH) return JVMFlag::KIND_C2;
if (flag_enum < first_flag_enum_other) return JVMFlag::KIND_ARCH;
if (flag_enum < first_flag_enum_other) return JVMFlag::KIND_C2;

return 0;
}
Expand Down
Loading