提交 da20bd28 编写于 作者: A aph

8206406: StubCodeDesc constructor publishes partially-constructed objects on StubCodeDesc::_list

Reviewed-by: dholmes
上级 ff0ed70a
......@@ -34,12 +34,12 @@
// Implementation of StubCodeDesc
StubCodeDesc* StubCodeDesc::_list = NULL;
int StubCodeDesc::_count = 0;
StubCodeDesc* volatile StubCodeDesc::_list = NULL;
int StubCodeDesc::_count = 0;
StubCodeDesc* StubCodeDesc::desc_for(address pc) {
StubCodeDesc* p = _list;
StubCodeDesc* p = (StubCodeDesc*)OrderAccess::load_ptr_acquire(&_list);
while (p != NULL && !p->contains(pc)) p = p->_next;
// p == NULL || p->contains(pc)
return p;
......@@ -47,7 +47,7 @@ StubCodeDesc* StubCodeDesc::desc_for(address pc) {
StubCodeDesc* StubCodeDesc::desc_for_index(int index) {
StubCodeDesc* p = _list;
StubCodeDesc* p = (StubCodeDesc*)OrderAccess::load_ptr_acquire(&_list);
while (p != NULL && p->index() != index) p = p->_next;
return p;
}
......
......@@ -38,7 +38,7 @@
class StubCodeDesc: public CHeapObj<mtCode> {
protected:
static StubCodeDesc* _list; // the list of all descriptors
static StubCodeDesc* volatile _list; // the list of all descriptors
static int _count; // length of list
StubCodeDesc* _next; // the next element in the linked list
......@@ -69,13 +69,13 @@ class StubCodeDesc: public CHeapObj<mtCode> {
StubCodeDesc(const char* group, const char* name, address begin) {
assert(name != NULL, "no name specified");
_next = _list;
_next = (StubCodeDesc*)OrderAccess::load_ptr_acquire(&_list);
_group = group;
_name = name;
_index = ++_count; // (never zero)
_begin = begin;
_end = NULL;
_list = this;
OrderAccess::release_store_ptr(&_list, this);
};
const char* group() const { return _group; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册