Mercurial > hg > graal-jvmci-8
diff src/share/vm/runtime/thread.hpp @ 6948:e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 Nov 2012 23:14:12 +0100 |
parents | 957c266d8bc5 c284cf4781f0 |
children | 679e6584c177 |
line wrap: on
line diff
--- a/src/share/vm/runtime/thread.hpp Mon Nov 12 18:11:17 2012 +0100 +++ b/src/share/vm/runtime/thread.hpp Mon Nov 12 23:14:12 2012 +0100 @@ -41,7 +41,11 @@ #include "runtime/stubRoutines.hpp" #include "runtime/threadLocalStorage.hpp" #include "runtime/unhandledOops.hpp" + +#if INCLUDE_NMT #include "services/memRecorder.hpp" +#endif // INCLUDE_NMT + #include "trace/tracing.hpp" #include "utilities/exceptions.hpp" #include "utilities/top.hpp" @@ -106,7 +110,7 @@ void* _real_malloc_address; public: 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 new(size_t size, const std::nothrow_t& nothrow_constant) { return allocate(size, false); } void operator delete(void* p); protected: @@ -417,6 +421,9 @@ HandleArea* handle_area() const { return _handle_area; } void set_handle_area(HandleArea* area) { _handle_area = area; } + GrowableArray<Metadata*>* metadata_handles() const { return _metadata_handles; } + void set_metadata_handles(GrowableArray<Metadata*>* handles){ _metadata_handles = handles; } + // Thread-Local Allocation Buffer (TLAB) support ThreadLocalAllocBuffer& tlab() { return _tlab; } void initialize_tlab() { @@ -500,6 +507,9 @@ // Sweeper support void nmethods_do(CodeBlobClosure* cf); + // jvmtiRedefineClasses support + void metadata_do(void f(Metadata*)); + // Used by fast lock support virtual bool is_lock_owned(address adr) const; @@ -520,6 +530,7 @@ // Thread local handle area for allocation of handles within the VM HandleArea* _handle_area; + GrowableArray<Metadata*>* _metadata_handles; // Support for stack overflow handling, get_thread, etc. address _stack_base; @@ -711,6 +722,7 @@ private: static WatcherThread* _watcher_thread; + static bool _startable; volatile static bool _should_terminate; // updated without holding lock public: enum SomeConstants { @@ -727,6 +739,7 @@ char* name() const { return (char*)"VM Periodic Task Thread"; } void print_on(outputStream* st) const; void print() const { print_on(tty); } + void unpark(); // Returns the single instance of WatcherThread static WatcherThread* watcher_thread() { return _watcher_thread; } @@ -734,6 +747,12 @@ // Create and start the single instance of WatcherThread, or stop it on shutdown static void start(); static void stop(); + // Only allow start once the VM is sufficiently initialized + // Otherwise the first task to enroll will trigger the start + static void make_startable(); + + private: + int sleep() const; }; @@ -747,7 +766,9 @@ JavaThread* _next; // The next thread in the Threads list oop _threadObj; // The Java level thread object - // (thomaswue) Necessary for holding a compilation buffer and ci environment. Moved from CompilerThread to JavaThread in order to enable code installation from Java application code. + // (thomaswue) Necessary for holding a compilation buffer and ci environment. + // Moved up from CompilerThread to JavaThread in order to enable code + // installation from Java application code. BufferBlob* _buffer_blob; ciEnv* _env; bool _is_compiling; @@ -795,18 +816,18 @@ GrowableArray<jvmtiDeferredLocalVariableSet*>* _deferred_locals_updates; // Handshake value for fixing 6243940. We need a place for the i2c - // adapter to store the callee methodOop. This value is NEVER live + // adapter to store the callee Method*. This value is NEVER live // across a gc point so it does NOT have to be gc'd // The handshake is open ended since we can't be certain that it will // be NULLed. This is because we rarely ever see the race and end up // in handle_wrong_method which is the backend of the handshake. See // code in i2c adapters and handle_wrong_method. - methodOop _callee_target; + Method* _callee_target; - // Oop results of VM runtime calls - oop _vm_result; // Used to pass back an oop result into Java code, GC-preserved - oop _vm_result_2; // Used to pass back an oop result into Java code, GC-preserved + // Used to pass back results to the interpreter or generated code running Java code. + oop _vm_result; // oop result is GC-preserved + Metadata* _vm_result_2; // non-oop result // See ReduceInitialCardMarks: this holds the precise space interval of // the most recent slow path allocation for which compiled code has @@ -880,9 +901,6 @@ private: #ifdef GRAAL - // graal needs some place to put the dimensions - jint _graal_multinewarray_storage[256]; - volatile oop _graal_deopt_info; address _graal_alternate_call_target; #endif @@ -1058,6 +1076,7 @@ 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; } +#if INCLUDE_NMT // native memory tracking inline MemRecorder* get_recorder() const { return (MemRecorder*)_recorder; } inline void set_recorder(MemRecorder* rc) { _recorder = (volatile MemRecorder*)rc; } @@ -1065,6 +1084,7 @@ private: // per-thread memory recorder volatile MemRecorder* _recorder; +#endif // INCLUDE_NMT // Suspend/resume support for JavaThread private: @@ -1245,15 +1265,15 @@ void set_deopt_nmethod(nmethod* nm) { _deopt_nmethod = nm; } nmethod* deopt_nmethod() { return _deopt_nmethod; } - methodOop callee_target() const { return _callee_target; } - void set_callee_target (methodOop x) { _callee_target = x; } + Method* callee_target() const { return _callee_target; } + void set_callee_target (Method* x) { _callee_target = x; } // Oop results of vm runtime calls oop vm_result() const { return _vm_result; } void set_vm_result (oop x) { _vm_result = x; } - oop vm_result_2() const { return _vm_result_2; } - void set_vm_result_2 (oop x) { _vm_result_2 = x; } + Metadata* vm_result_2() const { return _vm_result_2; } + void set_vm_result_2 (Metadata* x) { _vm_result_2 = x; } MemRegion deferred_card_mark() const { return _deferred_card_mark; } void set_deferred_card_mark(MemRegion mr) { _deferred_card_mark = mr; } @@ -1351,7 +1371,6 @@ #ifdef GRAAL static ByteSize graal_deopt_info_offset() { return byte_offset_of(JavaThread, _graal_deopt_info ); } static ByteSize graal_alternate_call_target_offset() { return byte_offset_of(JavaThread, _graal_alternate_call_target); } - static ByteSize graal_multinewarray_storage_offset() { return byte_offset_of(JavaThread, _graal_multinewarray_storage); } #endif #ifdef HIGH_LEVEL_INTERPRETER static ByteSize high_level_interpreter_in_vm_offset() { return byte_offset_of(JavaThread, _high_level_interpreter_in_vm); } @@ -1435,6 +1454,9 @@ // Sweeper operations void nmethods_do(CodeBlobClosure* cf); + // RedefineClasses Support + void metadata_do(void f(Metadata*)); + // Memory management operations void gc_epilogue(); void gc_prologue(); @@ -1465,7 +1487,7 @@ // Returns method at 'depth' java or native frames down the stack // Used for security checks - klassOop security_get_caller_class(int depth); + Klass* security_get_caller_class(int depth); // Print stack trace in external format void print_stack_on(outputStream* st); @@ -1868,6 +1890,9 @@ static int _number_of_threads; static int _number_of_non_daemon_threads; static int _return_code; +#ifdef ASSERT + static bool _vm_complete; +#endif public: // Thread management @@ -1915,8 +1940,14 @@ // Sweeper static void nmethods_do(CodeBlobClosure* cf); + // RedefineClasses support + static void metadata_do(void f(Metadata*)); + static void gc_epilogue(); static void gc_prologue(); +#ifdef ASSERT + static bool is_vm_complete() { return _vm_complete; } +#endif // Verification static void verify();