1136 |
1136 |
1137 // A JavaThread is a normal Java thread |
1137 // A JavaThread is a normal Java thread |
1138 |
1138 |
1139 void JavaThread::initialize() { |
1139 void JavaThread::initialize() { |
1140 // Initialize fields |
1140 // Initialize fields |
|
1141 |
|
1142 // Set the claimed par_id to -1 (ie not claiming any par_ids) |
|
1143 set_claimed_par_id(-1); |
|
1144 |
1141 set_saved_exception_pc(NULL); |
1145 set_saved_exception_pc(NULL); |
1142 set_threadObj(NULL); |
1146 set_threadObj(NULL); |
1143 _anchor.clear(); |
1147 _anchor.clear(); |
1144 set_entry_point(NULL); |
1148 set_entry_point(NULL); |
1145 set_jni_functions(jni_functions()); |
1149 set_jni_functions(jni_functions()); |
1207 _popframe_preserved_args_size = 0; |
1211 _popframe_preserved_args_size = 0; |
1208 |
1212 |
1209 pd_initialize(); |
1213 pd_initialize(); |
1210 } |
1214 } |
1211 |
1215 |
1212 JavaThread::JavaThread(bool is_attaching) : Thread() { |
1216 #ifndef SERIALGC |
|
1217 SATBMarkQueueSet JavaThread::_satb_mark_queue_set; |
|
1218 DirtyCardQueueSet JavaThread::_dirty_card_queue_set; |
|
1219 #endif // !SERIALGC |
|
1220 |
|
1221 JavaThread::JavaThread(bool is_attaching) : |
|
1222 Thread() |
|
1223 #ifndef SERIALGC |
|
1224 , _satb_mark_queue(&_satb_mark_queue_set), |
|
1225 _dirty_card_queue(&_dirty_card_queue_set) |
|
1226 #endif // !SERIALGC |
|
1227 { |
1213 initialize(); |
1228 initialize(); |
1214 _is_attaching = is_attaching; |
1229 _is_attaching = is_attaching; |
1215 } |
1230 } |
1216 |
1231 |
1217 bool JavaThread::reguard_stack(address cur_sp) { |
1232 bool JavaThread::reguard_stack(address cur_sp) { |
1253 |
1268 |
1254 |
1269 |
1255 // Remove this ifdef when C1 is ported to the compiler interface. |
1270 // Remove this ifdef when C1 is ported to the compiler interface. |
1256 static void compiler_thread_entry(JavaThread* thread, TRAPS); |
1271 static void compiler_thread_entry(JavaThread* thread, TRAPS); |
1257 |
1272 |
1258 JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) : Thread() { |
1273 JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) : |
|
1274 Thread() |
|
1275 #ifndef SERIALGC |
|
1276 , _satb_mark_queue(&_satb_mark_queue_set), |
|
1277 _dirty_card_queue(&_dirty_card_queue_set) |
|
1278 #endif // !SERIALGC |
|
1279 { |
1259 if (TraceThreadEvents) { |
1280 if (TraceThreadEvents) { |
1260 tty->print_cr("creating thread %p", this); |
1281 tty->print_cr("creating thread %p", this); |
1261 } |
1282 } |
1262 initialize(); |
1283 initialize(); |
1263 _is_attaching = false; |
1284 _is_attaching = false; |
3065 vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); |
3086 vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); |
3066 } |
3087 } |
3067 |
3088 |
3068 #ifndef SERIALGC |
3089 #ifndef SERIALGC |
3069 // Support for ConcurrentMarkSweep. This should be cleaned up |
3090 // Support for ConcurrentMarkSweep. This should be cleaned up |
3070 // and better encapsulated. XXX YSR |
3091 // and better encapsulated. The ugly nested if test would go away |
3071 if (UseConcMarkSweepGC) { |
3092 // once things are properly refactored. XXX YSR |
3072 ConcurrentMarkSweepThread::makeSurrogateLockerThread(THREAD); |
3093 if (UseConcMarkSweepGC || UseG1GC) { |
|
3094 if (UseConcMarkSweepGC) { |
|
3095 ConcurrentMarkSweepThread::makeSurrogateLockerThread(THREAD); |
|
3096 } else { |
|
3097 ConcurrentMarkThread::makeSurrogateLockerThread(THREAD); |
|
3098 } |
3073 if (HAS_PENDING_EXCEPTION) { |
3099 if (HAS_PENDING_EXCEPTION) { |
3074 vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); |
3100 vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); |
3075 } |
3101 } |
3076 } |
3102 } |
3077 #endif // SERIALGC |
3103 #endif // SERIALGC |