34 #include "runtime/frame.hpp"
35 #include "runtime/handshake.hpp"
36 #include "runtime/javaFrameAnchor.hpp"
37 #include "runtime/jniHandles.hpp"
38 #include "runtime/mutexLocker.hpp"
39 #include "runtime/os.hpp"
40 #include "runtime/osThread.hpp"
41 #include "runtime/park.hpp"
42 #include "runtime/safepoint.hpp"
43 #include "runtime/stubRoutines.hpp"
44 #include "runtime/threadLocalStorage.hpp"
45 #include "runtime/unhandledOops.hpp"
46 #include "trace/traceBackend.hpp"
47 #include "trace/traceMacros.hpp"
48 #include "utilities/align.hpp"
49 #include "utilities/exceptions.hpp"
50 #include "utilities/macros.hpp"
51 #ifdef ZERO
52 # include "stack_zero.hpp"
53 #endif
54
55 class ThreadSafepointState;
56 class ThreadsList;
57 class ThreadsSMRSupport;
58 class NestedThreadsList;
59
60 class JvmtiThreadState;
61 class JvmtiGetLoadedClassesClosure;
62 class ThreadStatistics;
63 class ConcurrentLocksDump;
64 class ParkEvent;
65 class Parker;
66
67 class ciEnv;
68 class CompileThread;
69 class CompileLog;
70 class CompileTask;
71 class CompileQueue;
72 class CompilerCounters;
73 class vframeArray;
327 //
328 // The two classes NoSafepointVerifier and No_Allocation_Verifier are used to set these counters.
329 //
330 NOT_PRODUCT(int _allow_safepoint_count;) // If 0, thread allow a safepoint to happen
331 debug_only(int _allow_allocation_count;) // If 0, the thread is allowed to allocate oops.
332
333 // Used by SkipGCALot class.
334 NOT_PRODUCT(bool _skip_gcalot;) // Should we elide gc-a-lot?
335
336 friend class NoAllocVerifier;
337 friend class NoSafepointVerifier;
338 friend class PauseNoSafepointVerifier;
339 friend class GCLocker;
340
341 volatile void* _polling_page; // Thread local polling page
342
343 ThreadLocalAllocBuffer _tlab; // Thread-local eden
344 jlong _allocated_bytes; // Cumulative number of bytes allocated on
345 // the Java heap
346
347 mutable TRACE_DATA _trace_data; // Thread-local data for tracing
348
349 int _vm_operation_started_count; // VM_Operation support
350 int _vm_operation_completed_count; // VM_Operation support
351
352 ObjectMonitor* _current_pending_monitor; // ObjectMonitor this thread
353 // is waiting to lock
354 bool _current_pending_monitor_is_from_java; // locking is from Java code
355
356 // ObjectMonitor on which this thread called Object.wait()
357 ObjectMonitor* _current_waiting_monitor;
358
359 // Private thread-local objectmonitor list - a simple cache organized as a SLL.
360 public:
361 ObjectMonitor* omFreeList;
362 int omFreeCount; // length of omFreeList
363 int omFreeProvision; // reload chunk size
364 ObjectMonitor* omInUseList; // SLL to track monitors in circulation
365 int omInUseCount; // length of omInUseList
366
505 // Internal handle support
506 HandleArea* handle_area() const { return _handle_area; }
507 void set_handle_area(HandleArea* area) { _handle_area = area; }
508
509 GrowableArray<Metadata*>* metadata_handles() const { return _metadata_handles; }
510 void set_metadata_handles(GrowableArray<Metadata*>* handles){ _metadata_handles = handles; }
511
512 // Thread-Local Allocation Buffer (TLAB) support
513 ThreadLocalAllocBuffer& tlab() { return _tlab; }
514 void initialize_tlab() {
515 if (UseTLAB) {
516 tlab().initialize();
517 }
518 }
519
520 jlong allocated_bytes() { return _allocated_bytes; }
521 void set_allocated_bytes(jlong value) { _allocated_bytes = value; }
522 void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
523 inline jlong cooked_allocated_bytes();
524
525 TRACE_DEFINE_THREAD_TRACE_DATA_OFFSET;
526 TRACE_DATA* trace_data() const { return &_trace_data; }
527 bool is_trace_suspend() { return (_suspend_flags & _trace_flag) != 0; }
528
529 // VM operation support
530 int vm_operation_ticket() { return ++_vm_operation_started_count; }
531 int vm_operation_completed_count() { return _vm_operation_completed_count; }
532 void increment_vm_operation_completed_count() { _vm_operation_completed_count++; }
533
534 // For tracking the heavyweight monitor the thread is pending on.
535 ObjectMonitor* current_pending_monitor() {
536 return _current_pending_monitor;
537 }
538 void set_current_pending_monitor(ObjectMonitor* monitor) {
539 _current_pending_monitor = monitor;
540 }
541 void set_current_pending_monitor_is_from_java(bool from_java) {
542 _current_pending_monitor_is_from_java = from_java;
543 }
544 bool current_pending_monitor_is_from_java() {
|
34 #include "runtime/frame.hpp"
35 #include "runtime/handshake.hpp"
36 #include "runtime/javaFrameAnchor.hpp"
37 #include "runtime/jniHandles.hpp"
38 #include "runtime/mutexLocker.hpp"
39 #include "runtime/os.hpp"
40 #include "runtime/osThread.hpp"
41 #include "runtime/park.hpp"
42 #include "runtime/safepoint.hpp"
43 #include "runtime/stubRoutines.hpp"
44 #include "runtime/threadLocalStorage.hpp"
45 #include "runtime/unhandledOops.hpp"
46 #include "trace/traceBackend.hpp"
47 #include "trace/traceMacros.hpp"
48 #include "utilities/align.hpp"
49 #include "utilities/exceptions.hpp"
50 #include "utilities/macros.hpp"
51 #ifdef ZERO
52 # include "stack_zero.hpp"
53 #endif
54 #include "runtime/threadStatisticInfo.hpp"
55
56 class ThreadSafepointState;
57 class ThreadsList;
58 class ThreadsSMRSupport;
59 class NestedThreadsList;
60
61 class JvmtiThreadState;
62 class JvmtiGetLoadedClassesClosure;
63 class ThreadStatistics;
64 class ConcurrentLocksDump;
65 class ParkEvent;
66 class Parker;
67
68 class ciEnv;
69 class CompileThread;
70 class CompileLog;
71 class CompileTask;
72 class CompileQueue;
73 class CompilerCounters;
74 class vframeArray;
328 //
329 // The two classes NoSafepointVerifier and No_Allocation_Verifier are used to set these counters.
330 //
331 NOT_PRODUCT(int _allow_safepoint_count;) // If 0, thread allow a safepoint to happen
332 debug_only(int _allow_allocation_count;) // If 0, the thread is allowed to allocate oops.
333
334 // Used by SkipGCALot class.
335 NOT_PRODUCT(bool _skip_gcalot;) // Should we elide gc-a-lot?
336
337 friend class NoAllocVerifier;
338 friend class NoSafepointVerifier;
339 friend class PauseNoSafepointVerifier;
340 friend class GCLocker;
341
342 volatile void* _polling_page; // Thread local polling page
343
344 ThreadLocalAllocBuffer _tlab; // Thread-local eden
345 jlong _allocated_bytes; // Cumulative number of bytes allocated on
346 // the Java heap
347
348 ThreadStatisticInfo _statistic_info; // Statistic info about the thread
349
350 mutable TRACE_DATA _trace_data; // Thread-local data for tracing
351
352 int _vm_operation_started_count; // VM_Operation support
353 int _vm_operation_completed_count; // VM_Operation support
354
355 ObjectMonitor* _current_pending_monitor; // ObjectMonitor this thread
356 // is waiting to lock
357 bool _current_pending_monitor_is_from_java; // locking is from Java code
358
359 // ObjectMonitor on which this thread called Object.wait()
360 ObjectMonitor* _current_waiting_monitor;
361
362 // Private thread-local objectmonitor list - a simple cache organized as a SLL.
363 public:
364 ObjectMonitor* omFreeList;
365 int omFreeCount; // length of omFreeList
366 int omFreeProvision; // reload chunk size
367 ObjectMonitor* omInUseList; // SLL to track monitors in circulation
368 int omInUseCount; // length of omInUseList
369
508 // Internal handle support
509 HandleArea* handle_area() const { return _handle_area; }
510 void set_handle_area(HandleArea* area) { _handle_area = area; }
511
512 GrowableArray<Metadata*>* metadata_handles() const { return _metadata_handles; }
513 void set_metadata_handles(GrowableArray<Metadata*>* handles){ _metadata_handles = handles; }
514
515 // Thread-Local Allocation Buffer (TLAB) support
516 ThreadLocalAllocBuffer& tlab() { return _tlab; }
517 void initialize_tlab() {
518 if (UseTLAB) {
519 tlab().initialize();
520 }
521 }
522
523 jlong allocated_bytes() { return _allocated_bytes; }
524 void set_allocated_bytes(jlong value) { _allocated_bytes = value; }
525 void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
526 inline jlong cooked_allocated_bytes();
527
528 ThreadStatisticInfo& statistic_info() { return _statistic_info; }
529
530 TRACE_DEFINE_THREAD_TRACE_DATA_OFFSET;
531 TRACE_DATA* trace_data() const { return &_trace_data; }
532 bool is_trace_suspend() { return (_suspend_flags & _trace_flag) != 0; }
533
534 // VM operation support
535 int vm_operation_ticket() { return ++_vm_operation_started_count; }
536 int vm_operation_completed_count() { return _vm_operation_completed_count; }
537 void increment_vm_operation_completed_count() { _vm_operation_completed_count++; }
538
539 // For tracking the heavyweight monitor the thread is pending on.
540 ObjectMonitor* current_pending_monitor() {
541 return _current_pending_monitor;
542 }
543 void set_current_pending_monitor(ObjectMonitor* monitor) {
544 _current_pending_monitor = monitor;
545 }
546 void set_current_pending_monitor_is_from_java(bool from_java) {
547 _current_pending_monitor_is_from_java = from_java;
548 }
549 bool current_pending_monitor_is_from_java() {
|