equal
deleted
inserted
replaced
31 #include "classfile/vmSymbols.hpp" |
31 #include "classfile/vmSymbols.hpp" |
32 #include "code/codeCache.hpp" |
32 #include "code/codeCache.hpp" |
33 #include "code/scopeDesc.hpp" |
33 #include "code/scopeDesc.hpp" |
34 #include "compiler/compileBroker.hpp" |
34 #include "compiler/compileBroker.hpp" |
35 #include "compiler/compileTask.hpp" |
35 #include "compiler/compileTask.hpp" |
|
36 #include "gc/shared/barrierSet.hpp" |
36 #include "gc/shared/gcId.hpp" |
37 #include "gc/shared/gcId.hpp" |
37 #include "gc/shared/gcLocker.inline.hpp" |
38 #include "gc/shared/gcLocker.inline.hpp" |
38 #include "gc/shared/workgroup.hpp" |
39 #include "gc/shared/workgroup.hpp" |
39 #include "interpreter/interpreter.hpp" |
40 #include "interpreter/interpreter.hpp" |
40 #include "interpreter/linkResolver.hpp" |
41 #include "interpreter/linkResolver.hpp" |
113 #include "utilities/macros.hpp" |
114 #include "utilities/macros.hpp" |
114 #include "utilities/preserveException.hpp" |
115 #include "utilities/preserveException.hpp" |
115 #include "utilities/vmError.hpp" |
116 #include "utilities/vmError.hpp" |
116 #if INCLUDE_ALL_GCS |
117 #if INCLUDE_ALL_GCS |
117 #include "gc/cms/concurrentMarkSweepThread.hpp" |
118 #include "gc/cms/concurrentMarkSweepThread.hpp" |
118 #include "gc/g1/g1BarrierSet.hpp" |
|
119 #include "gc/g1/g1ConcurrentMarkThread.inline.hpp" |
119 #include "gc/g1/g1ConcurrentMarkThread.inline.hpp" |
120 #include "gc/parallel/pcTasks.hpp" |
120 #include "gc/parallel/pcTasks.hpp" |
121 #endif // INCLUDE_ALL_GCS |
121 #endif // INCLUDE_ALL_GCS |
122 #if INCLUDE_JVMCI |
122 #if INCLUDE_JVMCI |
123 #include "jvmci/jvmciCompiler.hpp" |
123 #include "jvmci/jvmciCompiler.hpp" |
310 assert(this == _real_malloc_address || |
310 assert(this == _real_malloc_address || |
311 this == align_up(_real_malloc_address, (int)markOopDesc::biased_lock_alignment), |
311 this == align_up(_real_malloc_address, (int)markOopDesc::biased_lock_alignment), |
312 "bug in forced alignment of thread objects"); |
312 "bug in forced alignment of thread objects"); |
313 } |
313 } |
314 #endif // ASSERT |
314 #endif // ASSERT |
|
315 |
|
316 // Notify the barrier set that a thread is being created. Note that the |
|
317 // main thread is created before a barrier set is available. The call to |
|
318 // BarrierSet::on_thread_create() for the main thread is therefore deferred |
|
319 // until it calls BarrierSet::set_barrier_set(). |
|
320 BarrierSet* const barrier_set = BarrierSet::barrier_set(); |
|
321 if (barrier_set != NULL) { |
|
322 barrier_set->on_thread_create(this); |
|
323 } |
315 } |
324 } |
316 |
325 |
317 void Thread::initialize_thread_current() { |
326 void Thread::initialize_thread_current() { |
318 #ifndef USE_LIBRARY_BASED_TLS_ONLY |
327 #ifndef USE_LIBRARY_BASED_TLS_ONLY |
319 assert(_thr_current == NULL, "Thread::current already initialized"); |
328 assert(_thr_current == NULL, "Thread::current already initialized"); |
359 } |
368 } |
360 |
369 |
361 |
370 |
362 Thread::~Thread() { |
371 Thread::~Thread() { |
363 EVENT_THREAD_DESTRUCT(this); |
372 EVENT_THREAD_DESTRUCT(this); |
|
373 |
|
374 // Notify the barrier set that a thread is being destroyed. Note that a barrier |
|
375 // set might not be available if we encountered errors during bootstrapping. |
|
376 BarrierSet* const barrier_set = BarrierSet::barrier_set(); |
|
377 if (barrier_set != NULL) { |
|
378 barrier_set->on_thread_destroy(this); |
|
379 } |
364 |
380 |
365 // stack_base can be NULL if the thread is never started or exited before |
381 // stack_base can be NULL if the thread is never started or exited before |
366 // record_stack_base_and_size called. Although, we would like to ensure |
382 // record_stack_base_and_size called. Although, we would like to ensure |
367 // that all started threads do call record_stack_base_and_size(), there is |
383 // that all started threads do call record_stack_base_and_size(), there is |
368 // not proper way to enforce that. |
384 // not proper way to enforce that. |
1589 |
1605 |
1590 pd_initialize(); |
1606 pd_initialize(); |
1591 } |
1607 } |
1592 |
1608 |
1593 JavaThread::JavaThread(bool is_attaching_via_jni) : |
1609 JavaThread::JavaThread(bool is_attaching_via_jni) : |
1594 Thread() |
1610 Thread() { |
1595 #if INCLUDE_ALL_GCS |
|
1596 , _satb_mark_queue(&G1BarrierSet::satb_mark_queue_set()), |
|
1597 _dirty_card_queue(&G1BarrierSet::dirty_card_queue_set()) |
|
1598 #endif // INCLUDE_ALL_GCS |
|
1599 { |
|
1600 initialize(); |
1611 initialize(); |
1601 if (is_attaching_via_jni) { |
1612 if (is_attaching_via_jni) { |
1602 _jni_attach_state = _attaching_via_jni; |
1613 _jni_attach_state = _attaching_via_jni; |
1603 } else { |
1614 } else { |
1604 _jni_attach_state = _not_attaching_via_jni; |
1615 _jni_attach_state = _not_attaching_via_jni; |
1656 // Remove this ifdef when C1 is ported to the compiler interface. |
1667 // Remove this ifdef when C1 is ported to the compiler interface. |
1657 static void compiler_thread_entry(JavaThread* thread, TRAPS); |
1668 static void compiler_thread_entry(JavaThread* thread, TRAPS); |
1658 static void sweeper_thread_entry(JavaThread* thread, TRAPS); |
1669 static void sweeper_thread_entry(JavaThread* thread, TRAPS); |
1659 |
1670 |
1660 JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) : |
1671 JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) : |
1661 Thread() |
1672 Thread() { |
1662 #if INCLUDE_ALL_GCS |
|
1663 , _satb_mark_queue(&G1BarrierSet::satb_mark_queue_set()), |
|
1664 _dirty_card_queue(&G1BarrierSet::dirty_card_queue_set()) |
|
1665 #endif // INCLUDE_ALL_GCS |
|
1666 { |
|
1667 initialize(); |
1673 initialize(); |
1668 _jni_attach_state = _not_attaching_via_jni; |
1674 _jni_attach_state = _not_attaching_via_jni; |
1669 set_entry_point(entry_point); |
1675 set_entry_point(entry_point); |
1670 // Create the native thread itself. |
1676 // Create the native thread itself. |
1671 // %note runtime_23 |
1677 // %note runtime_23 |