Skip to content

Commit

Permalink
8322489: 22-b27: Up to 7% regression in all Footprint3-*-G1/ZGC
Browse files Browse the repository at this point in the history
Reviewed-by: egahlin
  • Loading branch information
Markus Grönlund committed Jan 8, 2024
1 parent eb9e754 commit 09c6c4f
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/hotspot/share/jfr/jfr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ void Jfr::on_create_vm_3() {
}

void Jfr::on_unloading_classes() {
JfrCheckpointManager::on_unloading_classes();
if (JfrRecorder::is_created() || JfrRecorder::is_started_on_commandline()) {
JfrCheckpointManager::on_unloading_classes();
}
}

bool Jfr::is_excluded(Thread* t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ bool JfrCheckpointManager::initialize_early() {
assert(_thread_local_mspace == nullptr, "invariant");
_thread_local_mspace = new JfrThreadLocalCheckpointMspace();
if (_thread_local_mspace == nullptr || !_thread_local_mspace->initialize(thread_local_buffer_size,
thread_local_buffer_prealloc_count,
thread_local_buffer_prealloc_count)) {
thread_local_buffer_prealloc_count,
thread_local_buffer_prealloc_count)) {
return false;
}

assert(_virtual_thread_local_mspace == nullptr, "invariant");
_virtual_thread_local_mspace = new JfrThreadLocalCheckpointMspace();
if (_virtual_thread_local_mspace == nullptr || !_virtual_thread_local_mspace->initialize(virtual_thread_local_buffer_size,
JFR_MSPACE_UNLIMITED_CACHE_SIZE,
virtual_thread_local_buffer_prealloc_count)) {
JFR_MSPACE_UNLIMITED_CACHE_SIZE,
virtual_thread_local_buffer_prealloc_count)) {
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct JfrCheckpointContext {

class JfrCheckpointWriter : public JfrCheckpointWriterBase {
friend class JfrCheckpointManager;
friend class JfrDeprecationManager;
friend class JfrSerializerRegistration;
friend class JfrTypeManager;
private:
Expand Down
24 changes: 17 additions & 7 deletions src/hotspot/share/jfr/recorder/jfrRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ bool JfrRecorder::create_oop_storages() {
return ObjectSampler::create_oop_storage();
}

// Subsystem
static JfrCheckpointManager* _checkpoint_manager = nullptr;

bool JfrRecorder::on_create_vm_1() {
if (!is_disabled()) {
if (FlightRecorder || is_started_on_commandline()) {
Expand All @@ -99,9 +96,10 @@ bool JfrRecorder::on_create_vm_1() {
return false;
}

_checkpoint_manager = JfrCheckpointManager::create();
if (_checkpoint_manager == nullptr || !_checkpoint_manager->initialize_early()) {
return false;
if (is_started_on_commandline()) {
if (!create_checkpoint_manager()) {
return false;
}
}

// fast time initialization
Expand Down Expand Up @@ -292,7 +290,7 @@ bool JfrRecorder::create_components() {
if (!create_storage()) {
return false;
}
if (!create_checkpoint_manager()) {
if (!initialize_checkpoint_manager()) {
return false;
}
if (!create_stacktrace_repository()) {
Expand Down Expand Up @@ -321,6 +319,7 @@ static JfrStackTraceRepository* _stack_trace_repository;
static JfrStringPool* _stringpool = nullptr;
static JfrOSInterface* _os_interface = nullptr;
static JfrThreadSampling* _thread_sampling = nullptr;
static JfrCheckpointManager* _checkpoint_manager = nullptr;

bool JfrRecorder::create_java_event_writer() {
return JfrJavaEventWriter::initialize();
Expand Down Expand Up @@ -357,6 +356,17 @@ bool JfrRecorder::create_storage() {
}

bool JfrRecorder::create_checkpoint_manager() {
assert(_checkpoint_manager == nullptr, "invariant");
_checkpoint_manager = JfrCheckpointManager::create();
return _checkpoint_manager != nullptr && _checkpoint_manager->initialize_early();
}

bool JfrRecorder::initialize_checkpoint_manager() {
if (_checkpoint_manager == nullptr) {
if (!create_checkpoint_manager()) {
return false;
}
}
assert(_checkpoint_manager != nullptr, "invariant");
assert(_repository != nullptr, "invariant");
return _checkpoint_manager->initialize(&_repository->chunkwriter());
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/jfr/recorder/jfrRecorder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class JfrRecorder : public JfrCHeapObj {
static bool on_create_vm_2();
static bool on_create_vm_3();
static bool create_checkpoint_manager();
static bool initialize_checkpoint_manager();
static bool create_chunk_repository();
static bool create_java_event_writer();
static bool create_jvmti_agent();
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/jfr/support/jfrDeprecationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,10 @@ void JfrDeprecationManager::write_edges(JfrChunkWriter& cw, Thread* thread, bool

void JfrDeprecationManager::on_type_set(JfrCheckpointWriter& writer, JfrChunkWriter* cw, Thread* thread) {
assert(_pending_list.is_empty(), "invariant");
if (writer.has_data() && _pending_head != nullptr) {
if (_pending_head != nullptr) {
save_type_set_blob(writer);
} else {
writer.cancel();
}
if (cw != nullptr) {
write_edges(*cw, thread);
Expand Down

1 comment on commit 09c6c4f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.