提交 f94ce49a 编写于 作者: T tschatzl

8025728: Missing volatile specifier for field G1AllocRegion::_alloc_region

Summary: The field G1AllocRegion::_alloc_region needs to be declared volatile as it is used with that intention. Otherwise the compiler may generate the code that reloads the value which might have changed in the meantime, leading to spurious crashes.
Reviewed-by: iveresov, simonis, tschatzl
Contributed-by: NAxel Siebenborn <axel.siebenborn@sap.com>
上级 0222ddf9
...@@ -55,7 +55,7 @@ private: ...@@ -55,7 +55,7 @@ private:
// then _alloc_region is NULL and this object should not be used to // then _alloc_region is NULL and this object should not be used to
// satisfy allocation requests (it was done this way to force the // satisfy allocation requests (it was done this way to force the
// correct use of init() and release()). // correct use of init() and release()).
HeapRegion* _alloc_region; HeapRegion* volatile _alloc_region;
// It keeps track of the distinct number of regions that are used // It keeps track of the distinct number of regions that are used
// for allocation in the active interval of this object, i.e., // for allocation in the active interval of this object, i.e.,
...@@ -132,8 +132,9 @@ public: ...@@ -132,8 +132,9 @@ public:
static void setup(G1CollectedHeap* g1h, HeapRegion* dummy_region); static void setup(G1CollectedHeap* g1h, HeapRegion* dummy_region);
HeapRegion* get() const { HeapRegion* get() const {
HeapRegion * hr = _alloc_region;
// Make sure that the dummy region does not escape this class. // Make sure that the dummy region does not escape this class.
return (_alloc_region == _dummy_region) ? NULL : _alloc_region; return (hr == _dummy_region) ? NULL : hr;
} }
uint count() { return _count; } uint count() { return _count; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册