Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/thread.cpp @ 16795:a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 12 Aug 2014 16:30:17 -0700 |
parents | ce6696559683 |
children | 52b4284cb496 |
comparison
equal
deleted
inserted
replaced
16794:74c02c90a3f9 | 16795:a29e6e7b7a86 |
---|---|
1472 set_monitor_chunks(NULL); | 1472 set_monitor_chunks(NULL); |
1473 set_next(NULL); | 1473 set_next(NULL); |
1474 #ifdef GRAAL | 1474 #ifdef GRAAL |
1475 set_gpu_exception_bci(0); | 1475 set_gpu_exception_bci(0); |
1476 set_gpu_exception_method(NULL); | 1476 set_gpu_exception_method(NULL); |
1477 set_gpu_hsail_deopt_info(NULL); | 1477 set_gpu_hsail_deopt_info(NULL); |
1478 _gpu_hsail_tlabs_count = 0; | |
1479 _gpu_hsail_tlabs = NULL; | |
1478 #endif | 1480 #endif |
1479 set_thread_state(_thread_new); | 1481 set_thread_state(_thread_new); |
1480 #if INCLUDE_NMT | 1482 #if INCLUDE_NMT |
1481 set_recorder(NULL); | 1483 set_recorder(NULL); |
1482 #endif | 1484 #endif |
1692 _graal_old_thread_counters[i] += _graal_counters[i]; | 1694 _graal_old_thread_counters[i] += _graal_counters[i]; |
1693 } | 1695 } |
1694 } | 1696 } |
1695 FREE_C_HEAP_ARRAY(jlong, _graal_counters, mtInternal); | 1697 FREE_C_HEAP_ARRAY(jlong, _graal_counters, mtInternal); |
1696 } | 1698 } |
1699 | |
1700 delete_gpu_hsail_tlabs(); | |
1697 #endif // GRAAL | 1701 #endif // GRAAL |
1698 } | 1702 } |
1699 | 1703 |
1700 | 1704 |
1701 // The first routine called by a new Java thread | 1705 // The first routine called by a new Java thread |
1966 | 1970 |
1967 // These have to be removed while this is still a valid thread. | 1971 // These have to be removed while this is still a valid thread. |
1968 remove_stack_guard_pages(); | 1972 remove_stack_guard_pages(); |
1969 | 1973 |
1970 if (UseTLAB) { | 1974 if (UseTLAB) { |
1971 tlab().make_parsable(true); // retire TLAB | 1975 tlabs_make_parsable(true); // retire TLABs, if any |
1972 } | 1976 } |
1973 | 1977 |
1974 if (JvmtiEnv::environments_might_exist()) { | 1978 if (JvmtiEnv::environments_might_exist()) { |
1975 JvmtiExport::cleanup_thread(this); | 1979 JvmtiExport::cleanup_thread(this); |
1976 } | 1980 } |
2045 | 2049 |
2046 // These have to be removed while this is still a valid thread. | 2050 // These have to be removed while this is still a valid thread. |
2047 remove_stack_guard_pages(); | 2051 remove_stack_guard_pages(); |
2048 | 2052 |
2049 if (UseTLAB) { | 2053 if (UseTLAB) { |
2050 tlab().make_parsable(true); // retire TLAB, if any | 2054 tlabs_make_parsable(true); // retire TLABs, if any |
2051 } | 2055 } |
2052 | 2056 |
2053 #if INCLUDE_ALL_GCS | 2057 #if INCLUDE_ALL_GCS |
2054 if (UseG1GC) { | 2058 if (UseG1GC) { |
2055 flush_barrier_queues(); | 2059 flush_barrier_queues(); |
4790 p->verify(); | 4794 p->verify(); |
4791 } | 4795 } |
4792 VMThread* thread = VMThread::vm_thread(); | 4796 VMThread* thread = VMThread::vm_thread(); |
4793 if (thread != NULL) thread->verify(); | 4797 if (thread != NULL) thread->verify(); |
4794 } | 4798 } |
4799 | |
4800 void JavaThread::tlabs_make_parsable(bool retire) { | |
4801 // do the primary tlab for this thread | |
4802 tlab().make_parsable(retire); | |
4803 #ifdef GRAAL | |
4804 // do the gpu_hsail tlabs if any | |
4805 gpu_hsail_tlabs_make_parsable(retire); | |
4806 #endif | |
4807 } | |
4808 | |
4809 | |
4810 #ifdef GRAAL | |
4811 void JavaThread::initialize_gpu_hsail_tlabs(jint count) { | |
4812 if (!UseTLAB) return; | |
4813 // create tlabs | |
4814 _gpu_hsail_tlabs = NEW_C_HEAP_ARRAY(ThreadLocalAllocBuffer*, count, mtInternal); | |
4815 // initialize | |
4816 for (jint i = 0; i < count; i++) { | |
4817 _gpu_hsail_tlabs[i] = new ThreadLocalAllocBuffer(); | |
4818 _gpu_hsail_tlabs[i]->initialize(Thread::current()); | |
4819 } | |
4820 _gpu_hsail_tlabs_count = count; | |
4821 } | |
4822 | |
4823 ThreadLocalAllocBuffer* JavaThread::get_gpu_hsail_tlab_at(jint idx) { | |
4824 assert(idx >= 0 && idx < get_gpu_hsail_tlabs_count(), "illegal gpu tlab index"); | |
4825 return _gpu_hsail_tlabs[idx]; | |
4826 } | |
4827 | |
4828 void JavaThread::gpu_hsail_tlabs_make_parsable(bool retire) { | |
4829 for (jint i = 0; i < get_gpu_hsail_tlabs_count(); i++) { | |
4830 get_gpu_hsail_tlab_at(i)->make_parsable(retire); | |
4831 } | |
4832 } | |
4833 | |
4834 void JavaThread::delete_gpu_hsail_tlabs() { | |
4835 if (!UseTLAB) return; | |
4836 if (_gpu_hsail_tlabs_count == 0) return; | |
4837 | |
4838 gpu_hsail_tlabs_make_parsable(true); | |
4839 for (jint i = 0; i < get_gpu_hsail_tlabs_count(); i++) { | |
4840 delete get_gpu_hsail_tlab_at(i); | |
4841 } | |
4842 FREE_C_HEAP_ARRAY(ThreadLocalAllocBuffer*, _gpu_hsail_tlabs, mtInternal); | |
4843 _gpu_hsail_tlabs = NULL; | |
4844 _gpu_hsail_tlabs_count = 0; | |
4845 } | |
4846 | |
4847 | |
4848 #endif | |
4849 |