--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp Thu Oct 17 20:27:44 2019 +0100
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp Thu Oct 17 20:53:35 2019 +0100
@@ -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
@@ -30,7 +30,6 @@
#include "gc/shared/gcName.hpp"
#include "gc/shared/gcTrace.hpp"
#include "gc/shared/gcWhen.hpp"
-#include "jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp"
#include "jfr/leakprofiler/leakProfiler.hpp"
#include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp"
#include "jfr/recorder/checkpoint/types/jfrType.hpp"
@@ -56,10 +55,6 @@
#include "opto/compile.hpp"
#include "opto/node.hpp"
#endif
-#if INCLUDE_G1GC
-#include "gc/g1/g1HeapRegionTraceType.hpp"
-#include "gc/g1/g1YCTypes.hpp"
-#endif
// Requires a ResourceMark for get_thread_name/as_utf8
class JfrCheckpointThreadClosure : public ThreadClosure {
@@ -188,15 +183,6 @@
}
}
-void G1HeapRegionTypeConstant::serialize(JfrCheckpointWriter& writer) {
- static const u4 nof_entries = G1HeapRegionTraceType::G1HeapRegionTypeEndSentinel;
- writer.write_count(nof_entries);
- for (u4 i = 0; i < nof_entries; ++i) {
- writer.write_key(i);
- writer.write(G1HeapRegionTraceType::to_string((G1HeapRegionTraceType::Type)i));
- }
-}
-
void GCThresholdUpdaterConstant::serialize(JfrCheckpointWriter& writer) {
static const u4 nof_entries = MetaspaceGCThresholdUpdater::Last;
writer.write_count(nof_entries);
@@ -224,17 +210,6 @@
}
}
-void G1YCTypeConstant::serialize(JfrCheckpointWriter& writer) {
-#if INCLUDE_G1GC
- static const u4 nof_entries = G1YCTypeEndSentinel;
- writer.write_count(nof_entries);
- for (u4 i = 0; i < nof_entries; ++i) {
- writer.write_key(i);
- writer.write(G1YCTypeHelper::to_string((G1YCType)i));
- }
-#endif
-}
-
static const char* reference_type_to_string(ReferenceType rt) {
switch (rt) {
case REF_NONE: return "None reference";
@@ -298,34 +273,26 @@
class TypeSetSerialization {
private:
+ JfrCheckpointWriter* _leakp_writer;
bool _class_unload;
public:
- explicit TypeSetSerialization(bool class_unload) : _class_unload(class_unload) {}
- void write(JfrCheckpointWriter& writer, JfrCheckpointWriter* leakp_writer) {
- JfrTypeSet::serialize(&writer, leakp_writer, _class_unload);
+ TypeSetSerialization(bool class_unload, JfrCheckpointWriter* leakp_writer = NULL) :
+ _leakp_writer(leakp_writer), _class_unload(class_unload) {}
+ void write(JfrCheckpointWriter& writer) {
+ JfrTypeSet::serialize(&writer, _leakp_writer, _class_unload);
}
};
void ClassUnloadTypeSet::serialize(JfrCheckpointWriter& writer) {
TypeSetSerialization type_set(true);
- if (LeakProfiler::is_running()) {
- JfrCheckpointWriter leakp_writer(false, true, Thread::current());
- type_set.write(writer, &leakp_writer);
- ObjectSampleCheckpoint::install(leakp_writer, true, true);
- return;
- }
- type_set.write(writer, NULL);
+ type_set.write(writer);
};
+TypeSet::TypeSet(JfrCheckpointWriter* leakp_writer) : _leakp_writer(leakp_writer) {}
+
void TypeSet::serialize(JfrCheckpointWriter& writer) {
- TypeSetSerialization type_set(false);
- if (LeakProfiler::is_suspended()) {
- JfrCheckpointWriter leakp_writer(false, true, Thread::current());
- type_set.write(writer, &leakp_writer);
- ObjectSampleCheckpoint::install(leakp_writer, false, true);
- return;
- }
- type_set.write(writer, NULL);
+ TypeSetSerialization type_set(false, _leakp_writer);
+ type_set.write(writer);
};
void ThreadStateConstant::serialize(JfrCheckpointWriter& writer) {
@@ -336,7 +303,6 @@
assert(_thread != NULL, "invariant");
assert(_thread == Thread::current(), "invariant");
assert(_thread->is_Java_thread(), "invariant");
- assert(!_thread->jfr_thread_local()->has_thread_checkpoint(), "invariant");
ResourceMark rm(_thread);
const oop threadObj = _thread->threadObj();
assert(threadObj != NULL, "invariant");