|
|
43ae3d |
# HG changeset patch
|
|
|
43ae3d |
# User aph
|
|
|
43ae3d |
# Date 1531146945 -3600
|
|
|
43ae3d |
# Mon Jul 09 15:35:45 2018 +0100
|
|
|
43ae3d |
# Node ID 95b72537801cc9946c27ad27f07e3f0790a21b08
|
|
|
43ae3d |
# Parent f6341f4635dacb56678264d29a88cd052b74036b
|
|
|
43ae3d |
8206406, PR3610, RH1597825: StubCodeDesc constructor publishes partially-constructed objects on StubCodeDesc::_list
|
|
|
43ae3d |
Reviewed-by: dholmes
|
|
|
43ae3d |
|
|
|
43ae3d |
diff --git openjdk.orig/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp openjdk/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp
|
|
|
43ae3d |
--- openjdk.orig/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp
|
|
|
43ae3d |
+++ openjdk/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp
|
|
|
43ae3d |
@@ -34,12 +34,12 @@
|
|
|
43ae3d |
|
|
|
43ae3d |
// Implementation of StubCodeDesc
|
|
|
43ae3d |
|
|
|
43ae3d |
-StubCodeDesc* StubCodeDesc::_list = NULL;
|
|
|
43ae3d |
-int StubCodeDesc::_count = 0;
|
|
|
43ae3d |
+StubCodeDesc* volatile StubCodeDesc::_list = NULL;
|
|
|
43ae3d |
+int StubCodeDesc::_count = 0;
|
|
|
43ae3d |
|
|
|
43ae3d |
|
|
|
43ae3d |
StubCodeDesc* StubCodeDesc::desc_for(address pc) {
|
|
|
43ae3d |
- StubCodeDesc* p = _list;
|
|
|
43ae3d |
+ StubCodeDesc* p = (StubCodeDesc*)OrderAccess::load_ptr_acquire(&_list);
|
|
|
43ae3d |
while (p != NULL && !p->contains(pc)) p = p->_next;
|
|
|
43ae3d |
// p == NULL || p->contains(pc)
|
|
|
43ae3d |
return p;
|
|
|
43ae3d |
@@ -47,7 +47,7 @@
|
|
|
43ae3d |
|
|
|
43ae3d |
|
|
|
43ae3d |
StubCodeDesc* StubCodeDesc::desc_for_index(int index) {
|
|
|
43ae3d |
- StubCodeDesc* p = _list;
|
|
|
43ae3d |
+ StubCodeDesc* p = (StubCodeDesc*)OrderAccess::load_ptr_acquire(&_list);
|
|
|
43ae3d |
while (p != NULL && p->index() != index) p = p->_next;
|
|
|
43ae3d |
return p;
|
|
|
43ae3d |
}
|
|
|
43ae3d |
diff --git openjdk.orig/hotspot/src/share/vm/runtime/stubCodeGenerator.hpp openjdk/hotspot/src/share/vm/runtime/stubCodeGenerator.hpp
|
|
|
43ae3d |
--- openjdk.orig/hotspot/src/share/vm/runtime/stubCodeGenerator.hpp
|
|
|
43ae3d |
+++ openjdk/hotspot/src/share/vm/runtime/stubCodeGenerator.hpp
|
|
|
43ae3d |
@@ -38,7 +38,7 @@
|
|
|
43ae3d |
|
|
|
43ae3d |
class StubCodeDesc: public CHeapObj<mtCode> {
|
|
|
43ae3d |
protected:
|
|
|
43ae3d |
- static StubCodeDesc* _list; // the list of all descriptors
|
|
|
43ae3d |
+ static StubCodeDesc* volatile _list; // the list of all descriptors
|
|
|
43ae3d |
static int _count; // length of list
|
|
|
43ae3d |
|
|
|
43ae3d |
StubCodeDesc* _next; // the next element in the linked list
|
|
|
43ae3d |
@@ -69,13 +69,13 @@
|
|
|
43ae3d |
|
|
|
43ae3d |
StubCodeDesc(const char* group, const char* name, address begin) {
|
|
|
43ae3d |
assert(name != NULL, "no name specified");
|
|
|
43ae3d |
- _next = _list;
|
|
|
43ae3d |
+ _next = (StubCodeDesc*)OrderAccess::load_ptr_acquire(&_list);
|
|
|
43ae3d |
_group = group;
|
|
|
43ae3d |
_name = name;
|
|
|
43ae3d |
_index = ++_count; // (never zero)
|
|
|
43ae3d |
_begin = begin;
|
|
|
43ae3d |
_end = NULL;
|
|
|
43ae3d |
- _list = this;
|
|
|
43ae3d |
+ OrderAccess::release_store_ptr(&_list, this);
|
|
|
43ae3d |
};
|
|
|
43ae3d |
|
|
|
43ae3d |
const char* group() const { return _group; }
|