8228834: Regression caused by JDK-8214542 not installing complete checkpoint data to candidates
Reviewed-by: egahlin
This commit is contained in:
parent
7ca72d55c3
commit
946d2b3197
@ -181,34 +181,33 @@ class SampleMark {
|
||||
}
|
||||
};
|
||||
|
||||
void ObjectSampleCheckpoint::install(JfrCheckpointWriter& writer, bool class_unload) {
|
||||
void ObjectSampleCheckpoint::install(JfrCheckpointWriter& writer, bool class_unload, bool type_set) {
|
||||
if (!writer.has_data()) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert(writer.has_data(), "invariant");
|
||||
const JfrCheckpointBlobHandle h_cp = writer.checkpoint_blob();
|
||||
CheckpointInstall install(h_cp);
|
||||
|
||||
// Class unload implies a safepoint.
|
||||
// Not class unload implies the object sampler is locked, because it was claimed exclusively earlier.
|
||||
// Therefore: direct access the object sampler instance is safe.
|
||||
const ObjectSampler* const object_sampler = ObjectSampler::sampler();
|
||||
ObjectSampler* const object_sampler = ObjectSampler::sampler();
|
||||
assert(object_sampler != NULL, "invariant");
|
||||
|
||||
ObjectSample* const last = const_cast<ObjectSample*>(object_sampler->last());
|
||||
const ObjectSample* const last_resolved = object_sampler->last_resolved();
|
||||
CheckpointInstall install(h_cp);
|
||||
|
||||
if (class_unload) {
|
||||
// all samples need class unload information
|
||||
do_samples(last, NULL, install);
|
||||
return;
|
||||
}
|
||||
|
||||
// only new samples since last resolved checkpoint
|
||||
// install only to new samples since last resolved checkpoint
|
||||
if (last != last_resolved) {
|
||||
do_samples(last, last_resolved, install);
|
||||
const_cast<ObjectSampler*>(object_sampler)->set_last_resolved(last);
|
||||
if (class_unload) {
|
||||
return;
|
||||
}
|
||||
if (type_set) {
|
||||
object_sampler->set_last_resolved(last);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,6 +288,6 @@ bool WriteObjectSampleStacktrace::process() {
|
||||
JfrStackTraceRepository::write_metadata(writer);
|
||||
|
||||
// install the stacktrace checkpoint information to the candidates
|
||||
ObjectSampleCheckpoint::install(writer, false);
|
||||
ObjectSampleCheckpoint::install(writer, false, false);
|
||||
return true;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class ObjectSampler;
|
||||
|
||||
class ObjectSampleCheckpoint : AllStatic {
|
||||
public:
|
||||
static void install(JfrCheckpointWriter& writer, bool class_unload);
|
||||
static void install(JfrCheckpointWriter& writer, bool class_unload, bool type_set);
|
||||
static void write(ObjectSampler* sampler, EdgeStore* edge_store, bool emit_all, Thread* thread);
|
||||
static int mark(ObjectSampler* sampler, ObjectSampleMarker& marker, bool emit_all);
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
@ -311,7 +311,7 @@ void ClassUnloadTypeSet::serialize(JfrCheckpointWriter& writer) {
|
||||
if (LeakProfiler::is_running()) {
|
||||
JfrCheckpointWriter leakp_writer(false, true, Thread::current());
|
||||
type_set.write(writer, &leakp_writer);
|
||||
ObjectSampleCheckpoint::install(leakp_writer, true);
|
||||
ObjectSampleCheckpoint::install(leakp_writer, true, true);
|
||||
return;
|
||||
}
|
||||
type_set.write(writer, NULL);
|
||||
@ -322,7 +322,7 @@ void TypeSet::serialize(JfrCheckpointWriter& writer) {
|
||||
if (LeakProfiler::is_running()) {
|
||||
JfrCheckpointWriter leakp_writer(false, true, Thread::current());
|
||||
type_set.write(writer, &leakp_writer);
|
||||
ObjectSampleCheckpoint::install(leakp_writer, false);
|
||||
ObjectSampleCheckpoint::install(leakp_writer, false, true);
|
||||
return;
|
||||
}
|
||||
type_set.write(writer, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user