Mercurial > hg > truffle
diff src/share/vm/runtime/thread.hpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 120820e30baa d2a62e0f25eb |
children | e522a00b91aa |
line wrap: on
line diff
--- a/src/share/vm/runtime/thread.hpp Mon Aug 20 15:21:31 2012 +0200 +++ b/src/share/vm/runtime/thread.hpp Tue Aug 21 10:39:19 2012 +0200 @@ -41,6 +41,7 @@ #include "runtime/stubRoutines.hpp" #include "runtime/threadLocalStorage.hpp" #include "runtime/unhandledOops.hpp" +#include "services/memRecorder.hpp" #include "trace/tracing.hpp" #include "utilities/exceptions.hpp" #include "utilities/top.hpp" @@ -100,12 +101,16 @@ //oop _pending_exception; // pending exception for current thread // const char* _exception_file; // file information for exception (debugging only) // int _exception_line; // line information for exception (debugging only) - + protected: // Support for forcing alignment of thread objects for biased locking void* _real_malloc_address; public: - void* operator new(size_t size); + void* operator new(size_t size) { return allocate(size, true); } + void* operator new(size_t size, std::nothrow_t& nothrow_constant) { return allocate(size, false); } void operator delete(void* p); + + protected: + static void* allocate(size_t size, bool throw_excpt, MEMFLAGS flags = mtThread); private: // *************************************************************** @@ -268,6 +273,15 @@ ObjectMonitor* omInUseList; // SLL to track monitors in circulation int omInUseCount; // length of omInUseList +#ifdef ASSERT + private: + bool _visited_for_critical_count; + + public: + void set_visited_for_critical_count(bool z) { _visited_for_critical_count = z; } + bool was_visited_for_critical_count() const { return _visited_for_critical_count; } +#endif + public: enum { is_definitely_current_thread = true @@ -539,7 +553,6 @@ virtual void print_on_error(outputStream* st, char* buf, int buflen) const; // Debug-only code - #ifdef ASSERT private: // Deadlock detection support for Mutex locks. List of locks own by thread. @@ -1045,9 +1058,15 @@ bool do_not_unlock_if_synchronized() { return _do_not_unlock_if_synchronized; } void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; } + // native memory tracking + inline MemRecorder* get_recorder() const { return (MemRecorder*)_recorder; } + inline void set_recorder(MemRecorder* rc) { _recorder = (volatile MemRecorder*)rc; } + + private: + // per-thread memory recorder + volatile MemRecorder* _recorder; // Suspend/resume support for JavaThread - private: void set_ext_suspended() { set_suspend_flag (_ext_suspended); } void clear_ext_suspended() { clear_suspend_flag(_ext_suspended); } @@ -1490,6 +1509,18 @@ return result; } + // NMT (Native memory tracking) support. + // This flag helps NMT to determine if this JavaThread will be blocked + // at safepoint. If not, ThreadCritical is needed for writing memory records. + // JavaThread is only safepoint visible when it is in Threads' thread list, + // it is not visible until it is added to the list and becomes invisible + // once it is removed from the list. + public: + bool is_safepoint_visible() const { return _safepoint_visible; } + void set_safepoint_visible(bool visible) { _safepoint_visible = visible; } + private: + bool _safepoint_visible; + // Static operations public: // Returns the running thread as a JavaThread