diff -r 696e77cc8e7b -r 40b2c6c30123 hotspot/src/share/vm/runtime/thread.hpp --- a/hotspot/src/share/vm/runtime/thread.hpp Fri Jul 26 10:12:15 2013 +0200 +++ b/hotspot/src/share/vm/runtime/thread.hpp Thu Aug 01 17:25:10 2013 -0700 @@ -86,6 +86,8 @@ class ThreadClosure; class IdealGraphPrinter; +DEBUG_ONLY(class ResourceMark;) + class WorkerThread; // Class hierarchy @@ -519,6 +521,9 @@ // Check if address is in the stack of the thread (not just for locks). // Warning: the method can only be used on the running thread bool is_in_stack(address adr) const; + // Check if address is in the usable part of the stack (excludes protected + // guard pages) + bool is_in_usable_stack(address adr) const; // Sets this thread as starting thread. Returns failure if thread // creation fails due to lack of memory, too many threads etc. @@ -531,6 +536,8 @@ // Thread local resource area for temporary allocation within the VM ResourceArea* _resource_area; + DEBUG_ONLY(ResourceMark* _current_resource_mark;) + // Thread local handle area for allocation of handles within the VM HandleArea* _handle_area; GrowableArray* _metadata_handles; @@ -585,6 +592,8 @@ // Deadlock detection bool allow_allocation() { return _allow_allocation_count == 0; } + ResourceMark* current_resource_mark() { return _current_resource_mark; } + void set_current_resource_mark(ResourceMark* rm) { _current_resource_mark = rm; } #endif void check_for_valid_safepoint_state(bool potential_vm_operation) PRODUCT_RETURN; @@ -724,6 +733,8 @@ static bool _startable; volatile static bool _should_terminate; // updated without holding lock + + os::WatcherThreadCrashProtection* _crash_protection; public: enum SomeConstants { delay_interval = 10 // interrupt delay in milliseconds @@ -751,6 +762,14 @@ // Otherwise the first task to enroll will trigger the start static void make_startable(); + void set_crash_protection(os::WatcherThreadCrashProtection* crash_protection) { + assert(Thread::current()->is_Watcher_thread(), "Can only be set by WatcherThread"); + _crash_protection = crash_protection; + } + + bool has_crash_protection() const { return _crash_protection != NULL; } + os::WatcherThreadCrashProtection* crash_protection() const { return _crash_protection; } + private: int sleep() const; };