Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/thread.cpp @ 14318:1020b892787b
Merge
author | hseigel |
---|---|
date | Sun, 02 Feb 2014 15:31:40 -0500 |
parents | 2c95095271e9 |
children | e6195383bcaf 8a9bb7821e28 be0ac0e8f6e7 |
comparison
equal
deleted
inserted
replaced
14317:b59507f713e0 | 14318:1020b892787b |
---|---|
765 | 765 |
766 #ifndef PRODUCT | 766 #ifndef PRODUCT |
767 void JavaThread::record_jump(address target, address instr, const char* file, int line) { | 767 void JavaThread::record_jump(address target, address instr, const char* file, int line) { |
768 | 768 |
769 // This should not need to be atomic as the only way for simultaneous | 769 // This should not need to be atomic as the only way for simultaneous |
770 // updates is via interrupts. Even then this should be rare or non-existant | 770 // updates is via interrupts. Even then this should be rare or non-existent |
771 // and we don't care that much anyway. | 771 // and we don't care that much anyway. |
772 | 772 |
773 int index = _jmp_ring_index; | 773 int index = _jmp_ring_index; |
774 _jmp_ring_index = (index + 1 ) & (jump_ring_buffer_size - 1); | 774 _jmp_ring_index = (index + 1 ) & (jump_ring_buffer_size - 1); |
775 _jmp_ring[index]._target = (intptr_t) target; | 775 _jmp_ring[index]._target = (intptr_t) target; |
923 // This could potentially lead to deadlocks | 923 // This could potentially lead to deadlocks |
924 for(Monitor *cur = _owned_locks; cur; cur = cur->next()) { | 924 for(Monitor *cur = _owned_locks; cur; cur = cur->next()) { |
925 // Threads_lock is special, since the safepoint synchronization will not start before this is | 925 // Threads_lock is special, since the safepoint synchronization will not start before this is |
926 // acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock, | 926 // acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock, |
927 // since it is used to transfer control between JavaThreads and the VMThread | 927 // since it is used to transfer control between JavaThreads and the VMThread |
928 // Do not *exclude* any locks unless you are absolutly sure it is correct. Ask someone else first! | 928 // Do not *exclude* any locks unless you are absolutely sure it is correct. Ask someone else first! |
929 if ( (cur->allow_vm_block() && | 929 if ( (cur->allow_vm_block() && |
930 cur != Threads_lock && | 930 cur != Threads_lock && |
931 cur != Compile_lock && // Temporary: should not be necessary when we get spearate compilation | 931 cur != Compile_lock && // Temporary: should not be necessary when we get separate compilation |
932 cur != VMOperationRequest_lock && | 932 cur != VMOperationRequest_lock && |
933 cur != VMOperationQueue_lock) || | 933 cur != VMOperationQueue_lock) || |
934 cur->rank() == Mutex::special) { | 934 cur->rank() == Mutex::special) { |
935 warning("Thread holding lock at safepoint that vm can block on: %s", cur->name()); | 935 warning("Thread holding lock at safepoint that vm can block on: %s", cur->name()); |
936 } | 936 } |
1269 // if we didn't have any tasks we could have waited for a long time | 1269 // if we didn't have any tasks we could have waited for a long time |
1270 // consider the time_slept zero and reset time_before_loop | 1270 // consider the time_slept zero and reset time_before_loop |
1271 time_slept = 0; | 1271 time_slept = 0; |
1272 time_before_loop = now; | 1272 time_before_loop = now; |
1273 } else { | 1273 } else { |
1274 // need to recalulate since we might have new tasks in _tasks | 1274 // need to recalculate since we might have new tasks in _tasks |
1275 time_slept = (int) ((now - time_before_loop) / 1000000); | 1275 time_slept = (int) ((now - time_before_loop) / 1000000); |
1276 } | 1276 } |
1277 | 1277 |
1278 // Change to task list or spurious wakeup of some kind | 1278 // Change to task list or spurious wakeup of some kind |
1279 if (timedout || _should_terminate) { | 1279 if (timedout || _should_terminate) { |
1636 // The first routine called by a new Java thread | 1636 // The first routine called by a new Java thread |
1637 void JavaThread::run() { | 1637 void JavaThread::run() { |
1638 // initialize thread-local alloc buffer related fields | 1638 // initialize thread-local alloc buffer related fields |
1639 this->initialize_tlab(); | 1639 this->initialize_tlab(); |
1640 | 1640 |
1641 // used to test validitity of stack trace backs | 1641 // used to test validity of stack trace backs |
1642 this->record_base_of_stack_pointer(); | 1642 this->record_base_of_stack_pointer(); |
1643 | 1643 |
1644 // Record real stack base and size. | 1644 // Record real stack base and size. |
1645 this->record_stack_base_and_size(); | 1645 this->record_stack_base_and_size(); |
1646 | 1646 |
3370 os::init(); | 3370 os::init(); |
3371 | 3371 |
3372 // Initialize system properties. | 3372 // Initialize system properties. |
3373 Arguments::init_system_properties(); | 3373 Arguments::init_system_properties(); |
3374 | 3374 |
3375 // So that JDK version can be used as a discrimintor when parsing arguments | 3375 // So that JDK version can be used as a discriminator when parsing arguments |
3376 JDK_Version_init(); | 3376 JDK_Version_init(); |
3377 | 3377 |
3378 // Update/Initialize System properties after JDK version number is known | 3378 // Update/Initialize System properties after JDK version number is known |
3379 Arguments::init_version_specific_system_properties(); | 3379 Arguments::init_version_specific_system_properties(); |
3380 | 3380 |
3409 if (os_init_2_result != JNI_OK) return os_init_2_result; | 3409 if (os_init_2_result != JNI_OK) return os_init_2_result; |
3410 | 3410 |
3411 jint adjust_after_os_result = Arguments::adjust_after_os(); | 3411 jint adjust_after_os_result = Arguments::adjust_after_os(); |
3412 if (adjust_after_os_result != JNI_OK) return adjust_after_os_result; | 3412 if (adjust_after_os_result != JNI_OK) return adjust_after_os_result; |
3413 | 3413 |
3414 // intialize TLS | 3414 // initialize TLS |
3415 ThreadLocalStorage::init(); | 3415 ThreadLocalStorage::init(); |
3416 | 3416 |
3417 // Bootstrap native memory tracking, so it can start recording memory | 3417 // Bootstrap native memory tracking, so it can start recording memory |
3418 // activities before worker thread is started. This is the first phase | 3418 // activities before worker thread is started. This is the first phase |
3419 // of bootstrapping, VM is currently running in single-thread mode. | 3419 // of bootstrapping, VM is currently running in single-thread mode. |
4136 | 4136 |
4137 // Operations on the Threads list for GC. These are not explicitly locked, | 4137 // Operations on the Threads list for GC. These are not explicitly locked, |
4138 // but the garbage collector must provide a safe context for them to run. | 4138 // but the garbage collector must provide a safe context for them to run. |
4139 // In particular, these things should never be called when the Threads_lock | 4139 // In particular, these things should never be called when the Threads_lock |
4140 // is held by some other thread. (Note: the Safepoint abstraction also | 4140 // is held by some other thread. (Note: the Safepoint abstraction also |
4141 // uses the Threads_lock to gurantee this property. It also makes sure that | 4141 // uses the Threads_lock to guarantee this property. It also makes sure that |
4142 // all threads gets blocked when exiting or starting). | 4142 // all threads gets blocked when exiting or starting). |
4143 | 4143 |
4144 void Threads::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) { | 4144 void Threads::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) { |
4145 ALL_JAVA_THREADS(p) { | 4145 ALL_JAVA_THREADS(p) { |
4146 p->oops_do(f, cld_f, cf); | 4146 p->oops_do(f, cld_f, cf); |