1 /*
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
299 public:
300 explicit TypeSetSerialization(bool class_unload) : _class_unload(class_unload) {}
301 void write(JfrCheckpointWriter& writer, JfrCheckpointWriter* leakp_writer) {
302 JfrTypeSet::serialize(&writer, leakp_writer, _class_unload);
303 }
304 };
305
306 void ClassUnloadTypeSet::serialize(JfrCheckpointWriter& writer) {
307 TypeSetSerialization type_set(true);
308 if (LeakProfiler::is_running()) {
309 JfrCheckpointWriter leakp_writer(false, true, Thread::current());
310 type_set.write(writer, &leakp_writer);
311 ObjectSampleCheckpoint::install(leakp_writer, true, true);
312 return;
313 }
314 type_set.write(writer, NULL);
315 };
316
317 void TypeSet::serialize(JfrCheckpointWriter& writer) {
318 TypeSetSerialization type_set(false);
319 if (LeakProfiler::is_suspended()) {
320 JfrCheckpointWriter leakp_writer(false, true, Thread::current());
321 type_set.write(writer, &leakp_writer);
322 ObjectSampleCheckpoint::install(leakp_writer, false, true);
323 return;
324 }
325 type_set.write(writer, NULL);
326 };
327
328 void ThreadStateConstant::serialize(JfrCheckpointWriter& writer) {
329 JfrThreadState::serialize(writer);
330 }
331
332 void JfrThreadConstant::serialize(JfrCheckpointWriter& writer) {
333 assert(_thread != NULL, "invariant");
334 assert(_thread == Thread::current(), "invariant");
335 assert(_thread->is_Java_thread(), "invariant");
336 assert(!_thread->jfr_thread_local()->has_thread_checkpoint(), "invariant");
337 ResourceMark rm(_thread);
338 const oop threadObj = _thread->threadObj();
339 assert(threadObj != NULL, "invariant");
|
1 /*
2 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
299 public:
300 explicit TypeSetSerialization(bool class_unload) : _class_unload(class_unload) {}
301 void write(JfrCheckpointWriter& writer, JfrCheckpointWriter* leakp_writer) {
302 JfrTypeSet::serialize(&writer, leakp_writer, _class_unload);
303 }
304 };
305
306 void ClassUnloadTypeSet::serialize(JfrCheckpointWriter& writer) {
307 TypeSetSerialization type_set(true);
308 if (LeakProfiler::is_running()) {
309 JfrCheckpointWriter leakp_writer(false, true, Thread::current());
310 type_set.write(writer, &leakp_writer);
311 ObjectSampleCheckpoint::install(leakp_writer, true, true);
312 return;
313 }
314 type_set.write(writer, NULL);
315 };
316
317 void TypeSet::serialize(JfrCheckpointWriter& writer) {
318 TypeSetSerialization type_set(false);
319 if (LeakProfiler::is_running()) {
320 JfrCheckpointWriter leakp_writer(false, true, Thread::current());
321 type_set.write(writer, &leakp_writer);
322 ObjectSampleCheckpoint::install(leakp_writer, false, true);
323 return;
324 }
325 type_set.write(writer, NULL);
326 };
327
328 void ThreadStateConstant::serialize(JfrCheckpointWriter& writer) {
329 JfrThreadState::serialize(writer);
330 }
331
332 void JfrThreadConstant::serialize(JfrCheckpointWriter& writer) {
333 assert(_thread != NULL, "invariant");
334 assert(_thread == Thread::current(), "invariant");
335 assert(_thread->is_Java_thread(), "invariant");
336 assert(!_thread->jfr_thread_local()->has_thread_checkpoint(), "invariant");
337 ResourceMark rm(_thread);
338 const oop threadObj = _thread->threadObj();
339 assert(threadObj != NULL, "invariant");
|