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