Skip to content
Permalink
Browse files
8273221: Guard GCIdMark against nested calls
Reviewed-by: tschatzl, kbarrett
  • Loading branch information
albertnetymk committed Sep 6, 2021
1 parent 4d25e6f commit b4e5b28b860f10d3e028a2ab042d452db289064f
Showing 2 changed files with 5 additions and 6 deletions.
@@ -67,14 +67,16 @@ size_t GCId::print_prefix(char* buf, size_t len) {
return 0;
}

GCIdMark::GCIdMark() : _previous_gc_id(currentNamedthread()->gc_id()) {
GCIdMark::GCIdMark() {
assert(currentNamedthread()->gc_id() == GCId::undefined(), "nested");
currentNamedthread()->set_gc_id(GCId::create());
}

GCIdMark::GCIdMark(uint gc_id) : _previous_gc_id(currentNamedthread()->gc_id()) {
GCIdMark::GCIdMark(uint gc_id) {
assert(currentNamedthread()->gc_id() == GCId::undefined(), "nested");
currentNamedthread()->set_gc_id(gc_id);
}

GCIdMark::~GCIdMark() {
currentNamedthread()->set_gc_id(_previous_gc_id);
currentNamedthread()->set_gc_id(GCId::undefined());
}
@@ -47,9 +47,6 @@ class GCId : public AllStatic {
};

class GCIdMark : public StackObj {
private:
const uint _previous_gc_id;

public:
GCIdMark();
GCIdMark(uint gc_id);

1 comment on commit b4e5b28

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on b4e5b28 Sep 6, 2021

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.