Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
8241718: assert ((klass)->trace_id()) & ((JfrTraceIdEpoch::method_and…
Browse files Browse the repository at this point in the history
…_class_in_use_this_epoch_bits()))) != 0 in ObjectSampleCheckpoint::add_to_leakp_set

Reviewed-by: dholmes, iklam, ccheung
  • Loading branch information
Markus Grönlund committed Jun 24, 2020
1 parent 2f09989 commit 6715f23
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 4 deletions.
Expand Up @@ -761,6 +761,7 @@ int write__method(JfrCheckpointWriter* writer, const void* m) {
int write__method__leakp(JfrCheckpointWriter* writer, const void* m) {
assert(m != NULL, "invariant");
MethodPtr method = (MethodPtr)m;
CLEAR_LEAKP_METHOD(method);
return write_method(writer, method, true);
}

Expand Down
Expand Up @@ -170,6 +170,13 @@ void JfrTraceId::remove(const Klass* k) {
k->set_trace_id(EVENT_KLASS_MASK(k));
}

// used by CDS / APPCDS as part of "remove_unshareable_info"
void JfrTraceId::remove(const Method* method) {
assert(method != NULL, "invariant");
// Clear all bits.
method->set_trace_flags(0);
}

// used by CDS / APPCDS as part of "restore_unshareable_info"
void JfrTraceId::restore(const Klass* k) {
assert(k != NULL, "invariant");
Expand Down
Expand Up @@ -106,6 +106,7 @@ class JfrTraceId : public AllStatic {
static traceid load_raw(const ClassLoaderData* cld);

static void remove(const Klass* klass);
static void remove(const Method* method);
static void restore(const Klass* klass);

// set of event classes made visible to java
Expand Down
Expand Up @@ -145,6 +145,7 @@
#define CLEAR_SERIALIZED_METHOD(method) (METHOD_META_MASK_CLEAR(method, META_MASK))
#define SET_PREVIOUS_EPOCH_METHOD_CLEARED_BIT(ptr) (METHOD_META_TAG(ptr, PREVIOUS_EPOCH_BIT))
#define CLEAR_LEAKP(ptr) (TRACE_ID_META_MASK_CLEAR(ptr, (~(LEAKP_META_BIT))))
#define CLEAR_LEAKP_METHOD(method) (METHOD_META_MASK_CLEAR(method, (~(LEAKP_META_BIT))))
#define CLEAR_THIS_EPOCH_CLEARED_BIT(ptr) (TRACE_ID_META_MASK_CLEAR(ptr,(~(THIS_EPOCH_BIT))))
#define CLEAR_THIS_EPOCH_METHOD_CLEARED_BIT(ptr) (METHOD_META_MASK_CLEAR(ptr,(~(THIS_EPOCH_BIT))))
#define IS_THIS_EPOCH_METHOD_CLEARED(ptr) (METHOD_FLAG_PREDICATE(method, THIS_EPOCH_BIT))
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/jfr/recorder/jfrRecorder.cpp
Expand Up @@ -172,8 +172,8 @@ static void log_jdk_jfr_module_resolution_error(TRAPS) {
}

static bool is_cds_dump_requested() {
// we will not be able to launch recordings if a cds dump is being requested
if (Arguments::is_dumping_archive() && (JfrOptionSet::start_flight_recording_options() != NULL)) {
// we will not be able to launch recordings on startup if a cds dump is being requested
if (Arguments::is_dumping_archive()) {
warning("JFR will be disabled during CDS dumping");
teardown_startup_support();
return true;
Expand Down Expand Up @@ -213,7 +213,7 @@ bool JfrRecorder::on_create_vm_2() {

bool JfrRecorder::on_create_vm_3() {
assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence");
return launch_command_line_recordings(Thread::current());
return Arguments::is_dumping_archive() || launch_command_line_recordings(Thread::current());
}

static bool _created = false;
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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 @@ -40,6 +40,7 @@

#define INIT_ID(data) JfrTraceId::assign(data)
#define REMOVE_ID(k) JfrTraceId::remove(k);
#define REMOVE_METHOD_ID(method) JfrTraceId::remove(method);
#define RESTORE_ID(k) JfrTraceId::restore(k);

class JfrTraceFlag {
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/oops/method.cpp
Expand Up @@ -357,6 +357,7 @@ void Method::metaspace_pointers_do(MetaspaceClosure* it) {

void Method::remove_unshareable_info() {
unlink_method();
JFR_ONLY(REMOVE_METHOD_ID(this);)
}

void Method::set_vtable_index(int index) {
Expand Down

0 comments on commit 6715f23

Please sign in to comment.