Skip to content

Commit

Permalink
8302873: ZGC: dump barrier data in C2 Mach nodes
Browse files Browse the repository at this point in the history
Reviewed-by: thartmann, kvn
robcasloz committed Feb 22, 2023
1 parent 861eea9 commit 30b2ac4
Showing 4 changed files with 38 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/hotspot/share/gc/shared/c2/barrierSetC2.hpp
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
#include "memory/allocation.hpp"
#include "oops/accessDecorators.hpp"
#include "opto/loopnode.hpp"
#include "opto/machnode.hpp"
#include "opto/matcher.hpp"
#include "opto/memnode.hpp"
#include "utilities/globalDefinitions.hpp"
@@ -302,6 +303,12 @@ class BarrierSetC2: public CHeapObj<mtGC> {
virtual void emit_stubs(CodeBuffer& cb) const { }

static int arraycopy_payload_base_offset(bool is_array);

#ifndef PRODUCT
virtual void dump_barrier_data(const MachNode* mach, outputStream* st) const {
st->print("%x", mach->barrier_data());
};
#endif
};

#endif // SHARE_GC_SHARED_C2_BARRIERSETC2_HPP
19 changes: 18 additions & 1 deletion src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, 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
@@ -564,3 +564,20 @@ void ZBarrierSetC2::compute_liveness_at_stubs() const {
}
}
}

#ifndef PRODUCT
void ZBarrierSetC2::dump_barrier_data(const MachNode* mach, outputStream* st) const {
if ((mach->barrier_data() & ZLoadBarrierStrong) != 0) {
st->print("strong ");
}
if ((mach->barrier_data() & ZLoadBarrierWeak) != 0) {
st->print("weak ");
}
if ((mach->barrier_data() & ZLoadBarrierPhantom) != 0) {
st->print("phantom ");
}
if ((mach->barrier_data() & ZLoadBarrierNoKeepalive) != 0) {
st->print("nokeepalive ");
}
}
#endif // !PRODUCT
6 changes: 5 additions & 1 deletion src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, 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
@@ -91,6 +91,10 @@ class ZBarrierSetC2 : public BarrierSetC2 {
virtual void late_barrier_analysis() const;
virtual int estimate_stub_size() const;
virtual void emit_stubs(CodeBuffer& cb) const;

#ifndef PRODUCT
virtual void dump_barrier_data(const MachNode* mach, outputStream* st) const;
#endif
};

#endif // SHARE_GC_Z_C2_ZBARRIERSETC2_HPP
9 changes: 8 additions & 1 deletion src/hotspot/share/opto/machnode.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, 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
@@ -23,6 +23,8 @@
*/

#include "precompiled.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/c2/barrierSetC2.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "memory/universe.hpp"
#include "oops/compressedOops.hpp"
@@ -535,6 +537,11 @@ void MachTypeNode::dump_spec(outputStream *st) const {
} else {
st->print(" NULL");
}
if (barrier_data() != 0) {
st->print(" barrier(");
BarrierSet::barrier_set()->barrier_set_c2()->dump_barrier_data(this, st);
st->print(")");
}
}
#endif

1 comment on commit 30b2ac4

@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.