Skip to content
Permalink
Browse files

8242216: ObjectSampler::weak_oops_do() should not trigger barrier

Reviewed-by: rkennke, eosterlund
  • Loading branch information
zhengyu123 committed Apr 7, 2020
1 parent 1a40b79 commit e53ae5ae63dd87e1c36e9b6477f8ab5986ac96df
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 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
@@ -29,6 +29,10 @@ const oop ObjectSample::object() const {
return NativeAccess<ON_PHANTOM_OOP_REF | AS_NO_KEEPALIVE>::oop_load(&_object);
}

const oop ObjectSample::object_raw() const {
return RawAccess<>::oop_load(&_object);
}

void ObjectSample::set_object(oop object) {
NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(&_object, object);
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@@ -108,6 +108,7 @@ class ObjectSample : public JfrCHeapObj {
}

const oop object() const;
const oop object_raw() const;
void set_object(oop object);

const oop* object_addr() const {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@@ -223,7 +223,7 @@ void ObjectSampler::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
ObjectSample* current = sampler._list->last();
while (current != NULL) {
if (current->_object != NULL) {
if (is_alive->do_object_b(current->object())) {
if (is_alive->do_object_b(current->object_raw())) {
// The weakly referenced object is alive, update pointer
f->do_oop(const_cast<oop*>(current->object_addr()));
} else {

0 comments on commit e53ae5a

Please sign in to comment.