8298059: Linked stack watermarks don't support nesting
Reviewed-by: stefank, sspitsyn, rehn, pchilanomate
This commit is contained in:
parent
98fa48c330
commit
b17c52422c
src/hotspot/share/runtime
test/hotspot/jtreg
@ -44,7 +44,7 @@ KeepStackGCProcessedMark::KeepStackGCProcessedMark(JavaThread* jt) :
|
||||
return;
|
||||
}
|
||||
StackWatermark* their_watermark = StackWatermarkSet::get(jt, StackWatermarkKind::gc);
|
||||
our_watermark->link_watermark(their_watermark);
|
||||
our_watermark->push_linked_watermark(their_watermark);
|
||||
}
|
||||
|
||||
KeepStackGCProcessedMark::~KeepStackGCProcessedMark() {
|
||||
@ -52,7 +52,7 @@ KeepStackGCProcessedMark::~KeepStackGCProcessedMark() {
|
||||
return;
|
||||
}
|
||||
StackWatermark* our_watermark = StackWatermarkSet::get(JavaThread::current(), StackWatermarkKind::gc);
|
||||
our_watermark->link_watermark(NULL);
|
||||
our_watermark->pop_linked_watermark();
|
||||
}
|
||||
|
||||
void KeepStackGCProcessedMark::finish_processing() {
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "utilities/macros.hpp"
|
||||
#include "utilities/preserveException.hpp"
|
||||
|
||||
class StackWatermarkFramesIterator : public CHeapObj<mtInternal> {
|
||||
class StackWatermarkFramesIterator : public CHeapObj<mtThread> {
|
||||
JavaThread* _jt;
|
||||
uintptr_t _caller;
|
||||
uintptr_t _callee;
|
||||
@ -166,7 +166,7 @@ StackWatermark::StackWatermark(JavaThread* jt, StackWatermarkKind kind, uint32_t
|
||||
_iterator(NULL),
|
||||
_lock(Mutex::stackwatermark, "StackWatermark_lock"),
|
||||
_kind(kind),
|
||||
_linked_watermark(NULL) {
|
||||
_linked_watermarks() {
|
||||
}
|
||||
|
||||
StackWatermark::~StackWatermark() {
|
||||
@ -250,9 +250,15 @@ void StackWatermark::process_one() {
|
||||
}
|
||||
}
|
||||
|
||||
void StackWatermark::link_watermark(StackWatermark* watermark) {
|
||||
assert(watermark == NULL || _linked_watermark == NULL, "nesting not supported");
|
||||
_linked_watermark = watermark;
|
||||
void StackWatermark::push_linked_watermark(StackWatermark* watermark) {
|
||||
assert(JavaThread::current() == _jt, "This code is not thread safe");
|
||||
_linked_watermarks.push(watermark);
|
||||
}
|
||||
|
||||
void StackWatermark::pop_linked_watermark() {
|
||||
assert(JavaThread::current() == _jt, "This code is not thread safe");
|
||||
assert(_linked_watermarks.length() > 0, "Mismatched push and pop?");
|
||||
_linked_watermarks.pop();
|
||||
}
|
||||
|
||||
uintptr_t StackWatermark::watermark() {
|
||||
@ -288,12 +294,22 @@ bool StackWatermark::processing_completed_acquire() const {
|
||||
return processing_completed(Atomic::load_acquire(&_state));
|
||||
}
|
||||
|
||||
void StackWatermark::process_linked_watermarks() {
|
||||
assert(JavaThread::current() == _jt, "This code is not thread safe");
|
||||
|
||||
// Finish processing all linked stack watermarks
|
||||
for (StackWatermark* watermark : _linked_watermarks) {
|
||||
watermark->finish_processing(NULL /* context */);
|
||||
}
|
||||
}
|
||||
|
||||
void StackWatermark::on_safepoint() {
|
||||
start_processing();
|
||||
StackWatermark* linked_watermark = _linked_watermark;
|
||||
if (linked_watermark != NULL) {
|
||||
linked_watermark->finish_processing(NULL /* context */);
|
||||
}
|
||||
|
||||
// If the thread waking up from a safepoint expected certain other
|
||||
// stack watermarks (potentially from different threads) are processed,
|
||||
// then we have to perform processing of said linked watermarks here.
|
||||
process_linked_watermarks();
|
||||
}
|
||||
|
||||
void StackWatermark::start_processing() {
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "memory/allStatic.hpp"
|
||||
#include "runtime/mutex.hpp"
|
||||
#include "runtime/stackWatermarkKind.hpp"
|
||||
#include "utilities/growableArray.hpp"
|
||||
|
||||
class frame;
|
||||
class JavaThread;
|
||||
@ -83,7 +84,7 @@ public:
|
||||
// ---------- <-- watermark (callee SP from the snapshot, SP at the
|
||||
// point of unwinding, might be above or below
|
||||
// due to frame resizing)
|
||||
class StackWatermark : public CHeapObj<mtInternal> {
|
||||
class StackWatermark : public CHeapObj<mtThread> {
|
||||
friend class StackWatermarkFramesIterator;
|
||||
protected:
|
||||
volatile uint32_t _state;
|
||||
@ -93,7 +94,7 @@ protected:
|
||||
StackWatermarkFramesIterator* _iterator;
|
||||
Mutex _lock;
|
||||
StackWatermarkKind _kind;
|
||||
StackWatermark* _linked_watermark;
|
||||
GrowableArrayCHeap<StackWatermark*, mtThread> _linked_watermarks;
|
||||
|
||||
void process_one();
|
||||
|
||||
@ -116,6 +117,8 @@ protected:
|
||||
// opposed to due to frames being unwound by the owning thread.
|
||||
virtual bool process_on_iteration() { return true; }
|
||||
|
||||
void process_linked_watermarks();
|
||||
|
||||
bool processing_started(uint32_t state) const;
|
||||
bool processing_completed(uint32_t state) const;
|
||||
|
||||
@ -129,7 +132,8 @@ public:
|
||||
StackWatermark* next() const { return _next; }
|
||||
void set_next(StackWatermark* n) { _next = n; }
|
||||
|
||||
void link_watermark(StackWatermark* watermark);
|
||||
void push_linked_watermark(StackWatermark* watermark);
|
||||
void pop_linked_watermark();
|
||||
|
||||
uintptr_t watermark();
|
||||
uintptr_t last_processed();
|
||||
|
@ -83,6 +83,3 @@ vmTestbase/nsk/monitoring/stress/lowmem/lowmem033/TestDescription.java 8297979 g
|
||||
vmTestbase/nsk/monitoring/stress/lowmem/lowmem034/TestDescription.java 8297979 generic-all
|
||||
vmTestbase/nsk/monitoring/stress/lowmem/lowmem035/TestDescription.java 8297979 generic-all
|
||||
vmTestbase/nsk/monitoring/stress/lowmem/lowmem036/TestDescription.java 8297979 generic-all
|
||||
|
||||
vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter001/TestDescription.java 8298059 generic-x64
|
||||
vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter004/TestDescription.java 8298059 generic-x64
|
||||
|
Loading…
x
Reference in New Issue
Block a user