Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/thread.cpp @ 22298:c28cb37b2e1d
Rename JVMCI to INCLUDE_JVMCI.
author | twisti |
---|---|
date | Wed, 22 Jul 2015 08:56:03 -0700 |
parents | 431b127fc0d1 |
children | 4f6caa445b92 |
comparison
equal
deleted
inserted
replaced
22297:571202729bbf | 22298:c28cb37b2e1d |
---|---|
27 #include "classfile/javaClasses.hpp" | 27 #include "classfile/javaClasses.hpp" |
28 #include "classfile/systemDictionary.hpp" | 28 #include "classfile/systemDictionary.hpp" |
29 #include "classfile/vmSymbols.hpp" | 29 #include "classfile/vmSymbols.hpp" |
30 #include "code/scopeDesc.hpp" | 30 #include "code/scopeDesc.hpp" |
31 #include "compiler/compileBroker.hpp" | 31 #include "compiler/compileBroker.hpp" |
32 #ifdef JVMCI | 32 #if INCLUDE_JVMCI |
33 #include "jvmci/jvmciCompiler.hpp" | 33 #include "jvmci/jvmciCompiler.hpp" |
34 #include "jvmci/jvmciRuntime.hpp" | 34 #include "jvmci/jvmciRuntime.hpp" |
35 #endif | 35 #endif |
36 #include "interpreter/interpreter.hpp" | 36 #include "interpreter/interpreter.hpp" |
37 #include "interpreter/linkResolver.hpp" | 37 #include "interpreter/linkResolver.hpp" |
841 | 841 |
842 void Thread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { | 842 void Thread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { |
843 active_handles()->oops_do(f); | 843 active_handles()->oops_do(f); |
844 // Do oop for ThreadShadow | 844 // Do oop for ThreadShadow |
845 f->do_oop((oop*)&_pending_exception); | 845 f->do_oop((oop*)&_pending_exception); |
846 #ifdef JVMCI | 846 #if INCLUDE_JVMCI |
847 f->do_oop((oop*)&_pending_failed_speculation); | 847 f->do_oop((oop*)&_pending_failed_speculation); |
848 #endif | 848 #endif |
849 handle_area()->oops_do(f); | 849 handle_area()->oops_do(f); |
850 } | 850 } |
851 | 851 |
1424 st->cr(); | 1424 st->cr(); |
1425 } | 1425 } |
1426 | 1426 |
1427 // ======= JavaThread ======== | 1427 // ======= JavaThread ======== |
1428 | 1428 |
1429 #ifdef JVMCI | 1429 #if INCLUDE_JVMCI |
1430 | 1430 |
1431 jlong* JavaThread::_jvmci_old_thread_counters; | 1431 jlong* JavaThread::_jvmci_old_thread_counters; |
1432 | 1432 |
1433 bool jvmci_counters_include(JavaThread* thread) { | 1433 bool jvmci_counters_include(JavaThread* thread) { |
1434 oop threadObj = thread->threadObj(); | 1434 oop threadObj = thread->threadObj(); |
1449 } | 1449 } |
1450 } | 1450 } |
1451 } | 1451 } |
1452 } | 1452 } |
1453 | 1453 |
1454 #endif // JVMCI | 1454 #endif |
1455 | 1455 |
1456 // A JavaThread is a normal Java thread | 1456 // A JavaThread is a normal Java thread |
1457 | 1457 |
1458 void JavaThread::initialize() { | 1458 void JavaThread::initialize() { |
1459 // Initialize fields | 1459 // Initialize fields |
1484 _array_for_gc = NULL; | 1484 _array_for_gc = NULL; |
1485 _suspend_equivalent = false; | 1485 _suspend_equivalent = false; |
1486 _in_deopt_handler = 0; | 1486 _in_deopt_handler = 0; |
1487 _doing_unsafe_access = false; | 1487 _doing_unsafe_access = false; |
1488 _stack_guard_state = stack_guard_unused; | 1488 _stack_guard_state = stack_guard_unused; |
1489 #ifdef JVMCI | 1489 #if INCLUDE_JVMCI |
1490 _jvmci_alternate_call_target = NULL; | 1490 _jvmci_alternate_call_target = NULL; |
1491 _jvmci_implicit_exception_pc = NULL; | 1491 _jvmci_implicit_exception_pc = NULL; |
1492 if (JVMCICounterSize > 0) { | 1492 if (JVMCICounterSize > 0) { |
1493 _jvmci_counters = NEW_C_HEAP_ARRAY(jlong, JVMCICounterSize, mtInternal); | 1493 _jvmci_counters = NEW_C_HEAP_ARRAY(jlong, JVMCICounterSize, mtInternal); |
1494 memset(_jvmci_counters, 0, sizeof(jlong) * JVMCICounterSize); | 1494 memset(_jvmci_counters, 0, sizeof(jlong) * JVMCICounterSize); |
1495 } else { | 1495 } else { |
1496 _jvmci_counters = NULL; | 1496 _jvmci_counters = NULL; |
1497 } | 1497 } |
1498 #endif // JVMCI | 1498 #endif |
1499 (void)const_cast<oop&>(_exception_oop = NULL); | 1499 (void)const_cast<oop&>(_exception_oop = NULL); |
1500 _exception_pc = 0; | 1500 _exception_pc = 0; |
1501 _exception_handler_pc = 0; | 1501 _exception_handler_pc = 0; |
1502 _is_method_handle_return = 0; | 1502 _is_method_handle_return = 0; |
1503 _jvmti_thread_state= NULL; | 1503 _jvmti_thread_state= NULL; |
1674 // All Java related clean up happens in exit | 1674 // All Java related clean up happens in exit |
1675 ThreadSafepointState::destroy(this); | 1675 ThreadSafepointState::destroy(this); |
1676 if (_thread_profiler != NULL) delete _thread_profiler; | 1676 if (_thread_profiler != NULL) delete _thread_profiler; |
1677 if (_thread_stat != NULL) delete _thread_stat; | 1677 if (_thread_stat != NULL) delete _thread_stat; |
1678 | 1678 |
1679 #ifdef JVMCI | 1679 #if INCLUDE_JVMCI |
1680 if (JVMCICounterSize > 0) { | 1680 if (JVMCICounterSize > 0) { |
1681 if (jvmci_counters_include(this)) { | 1681 if (jvmci_counters_include(this)) { |
1682 for (int i = 0; i < JVMCICounterSize; i++) { | 1682 for (int i = 0; i < JVMCICounterSize; i++) { |
1683 _jvmci_old_thread_counters[i] += _jvmci_counters[i]; | 1683 _jvmci_old_thread_counters[i] += _jvmci_counters[i]; |
1684 } | 1684 } |
1685 } | 1685 } |
1686 FREE_C_HEAP_ARRAY(jlong, _jvmci_counters, mtInternal); | 1686 FREE_C_HEAP_ARRAY(jlong, _jvmci_counters, mtInternal); |
1687 } | 1687 } |
1688 #endif // JVMCI | 1688 #endif |
1689 } | 1689 } |
1690 | 1690 |
1691 | 1691 |
1692 // The first routine called by a new Java thread | 1692 // The first routine called by a new Java thread |
1693 void JavaThread::run() { | 1693 void JavaThread::run() { |
3393 | 3393 |
3394 // Parse arguments | 3394 // Parse arguments |
3395 jint parse_result = Arguments::parse(args); | 3395 jint parse_result = Arguments::parse(args); |
3396 if (parse_result != JNI_OK) return parse_result; | 3396 if (parse_result != JNI_OK) return parse_result; |
3397 | 3397 |
3398 #ifdef JVMCI | 3398 #if INCLUDE_JVMCI |
3399 OptionValuesTable* options = JVMCIRuntime::parse_arguments(); | 3399 OptionValuesTable* options = JVMCIRuntime::parse_arguments(); |
3400 if (options == NULL) { | 3400 if (options == NULL) { |
3401 return JNI_ERR; | 3401 return JNI_ERR; |
3402 } | 3402 } |
3403 #endif | 3403 #endif |
3454 _number_of_non_daemon_threads = 0; | 3454 _number_of_non_daemon_threads = 0; |
3455 | 3455 |
3456 // Initialize global data structures and create system classes in heap | 3456 // Initialize global data structures and create system classes in heap |
3457 vm_init_globals(); | 3457 vm_init_globals(); |
3458 | 3458 |
3459 #ifdef JVMCI | 3459 #if INCLUDE_JVMCI |
3460 if (JVMCICounterSize > 0) { | 3460 if (JVMCICounterSize > 0) { |
3461 JavaThread::_jvmci_old_thread_counters = NEW_C_HEAP_ARRAY(jlong, JVMCICounterSize, mtInternal); | 3461 JavaThread::_jvmci_old_thread_counters = NEW_C_HEAP_ARRAY(jlong, JVMCICounterSize, mtInternal); |
3462 memset(JavaThread::_jvmci_old_thread_counters, 0, sizeof(jlong) * JVMCICounterSize); | 3462 memset(JavaThread::_jvmci_old_thread_counters, 0, sizeof(jlong) * JVMCICounterSize); |
3463 } else { | 3463 } else { |
3464 JavaThread::_jvmci_old_thread_counters = NULL; | 3464 JavaThread::_jvmci_old_thread_counters = NULL; |
3465 } | 3465 } |
3466 #endif // JVMCI | 3466 #endif |
3467 | 3467 |
3468 // Attach the main thread to this os thread | 3468 // Attach the main thread to this os thread |
3469 JavaThread* main_thread = new JavaThread(); | 3469 JavaThread* main_thread = new JavaThread(); |
3470 main_thread->set_thread_state(_thread_in_vm); | 3470 main_thread->set_thread_state(_thread_in_vm); |
3471 // must do this before set_active_handles and initialize_thread_local_storage | 3471 // must do this before set_active_handles and initialize_thread_local_storage |
3707 | 3707 |
3708 if (CleanChunkPoolAsync) { | 3708 if (CleanChunkPoolAsync) { |
3709 Chunk::start_chunk_pool_cleaner_task(); | 3709 Chunk::start_chunk_pool_cleaner_task(); |
3710 } | 3710 } |
3711 | 3711 |
3712 #ifdef JVMCI | 3712 #if INCLUDE_JVMCI |
3713 JVMCIRuntime::set_options(options, main_thread); | 3713 JVMCIRuntime::set_options(options, main_thread); |
3714 delete options; | 3714 delete options; |
3715 #endif | 3715 #endif |
3716 | 3716 |
3717 // initialize compiler(s) | 3717 // initialize compiler(s) |
4131 | 4131 |
4132 notify_vm_shutdown(); | 4132 notify_vm_shutdown(); |
4133 | 4133 |
4134 delete thread; | 4134 delete thread; |
4135 | 4135 |
4136 #ifdef JVMCI | 4136 #if INCLUDE_JVMCI |
4137 if (JVMCICounterSize > 0) { | 4137 if (JVMCICounterSize > 0) { |
4138 FREE_C_HEAP_ARRAY(jlong, JavaThread::_jvmci_old_thread_counters, mtInternal); | 4138 FREE_C_HEAP_ARRAY(jlong, JavaThread::_jvmci_old_thread_counters, mtInternal); |
4139 } | 4139 } |
4140 #endif // JVMCI | 4140 #endif |
4141 | 4141 |
4142 // exit_globals() will delete tty | 4142 // exit_globals() will delete tty |
4143 exit_globals(); | 4143 exit_globals(); |
4144 | 4144 |
4145 return true; | 4145 return true; |