Mercurial > hg > truffle
comparison src/share/vm/runtime/thread.cpp @ 4840:0a10d80352d5
Merge
author | brutisso |
---|---|
date | Fri, 27 Jan 2012 09:04:57 +0100 |
parents | 94ec88ca68e2 |
children | aa3d708d67c4 |
comparison
equal
deleted
inserted
replaced
4839:b4ebad3520bb | 4840:0a10d80352d5 |
---|---|
71 #include "runtime/vmThread.hpp" | 71 #include "runtime/vmThread.hpp" |
72 #include "runtime/vm_operations.hpp" | 72 #include "runtime/vm_operations.hpp" |
73 #include "services/attachListener.hpp" | 73 #include "services/attachListener.hpp" |
74 #include "services/management.hpp" | 74 #include "services/management.hpp" |
75 #include "services/threadService.hpp" | 75 #include "services/threadService.hpp" |
76 #include "trace/traceEventTypes.hpp" | |
76 #include "utilities/defaultStream.hpp" | 77 #include "utilities/defaultStream.hpp" |
77 #include "utilities/dtrace.hpp" | 78 #include "utilities/dtrace.hpp" |
78 #include "utilities/events.hpp" | 79 #include "utilities/events.hpp" |
79 #include "utilities/preserveException.hpp" | 80 #include "utilities/preserveException.hpp" |
80 #ifdef TARGET_OS_FAMILY_linux | 81 #ifdef TARGET_OS_FAMILY_linux |
230 NOT_PRODUCT(_allow_safepoint_count = 0;) | 231 NOT_PRODUCT(_allow_safepoint_count = 0;) |
231 NOT_PRODUCT(_skip_gcalot = false;) | 232 NOT_PRODUCT(_skip_gcalot = false;) |
232 CHECK_UNHANDLED_OOPS_ONLY(_gc_locked_out_count = 0;) | 233 CHECK_UNHANDLED_OOPS_ONLY(_gc_locked_out_count = 0;) |
233 _jvmti_env_iteration_count = 0; | 234 _jvmti_env_iteration_count = 0; |
234 set_allocated_bytes(0); | 235 set_allocated_bytes(0); |
236 set_trace_buffer(NULL); | |
235 _vm_operation_started_count = 0; | 237 _vm_operation_started_count = 0; |
236 _vm_operation_completed_count = 0; | 238 _vm_operation_completed_count = 0; |
237 _current_pending_monitor = NULL; | 239 _current_pending_monitor = NULL; |
238 _current_pending_monitor_is_from_java = true; | 240 _current_pending_monitor_is_from_java = true; |
239 _current_waiting_monitor = NULL; | 241 _current_waiting_monitor = NULL; |
1509 this->set_active_handles(JNIHandleBlock::allocate_block()); | 1511 this->set_active_handles(JNIHandleBlock::allocate_block()); |
1510 | 1512 |
1511 if (JvmtiExport::should_post_thread_life()) { | 1513 if (JvmtiExport::should_post_thread_life()) { |
1512 JvmtiExport::post_thread_start(this); | 1514 JvmtiExport::post_thread_start(this); |
1513 } | 1515 } |
1516 | |
1517 EVENT_BEGIN(TraceEventThreadStart, event); | |
1518 EVENT_COMMIT(event, | |
1519 EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(this->threadObj()))); | |
1514 | 1520 |
1515 // We call another function to do the rest so we are sure that the stack addresses used | 1521 // We call another function to do the rest so we are sure that the stack addresses used |
1516 // from there will be lower than the stack base just computed | 1522 // from there will be lower than the stack base just computed |
1517 thread_main_inner(); | 1523 thread_main_inner(); |
1518 | 1524 |
1639 CLEAR_PENDING_EXCEPTION; | 1645 CLEAR_PENDING_EXCEPTION; |
1640 } | 1646 } |
1641 } | 1647 } |
1642 } | 1648 } |
1643 | 1649 |
1650 // Called before the java thread exit since we want to read info | |
1651 // from java_lang_Thread object | |
1652 EVENT_BEGIN(TraceEventThreadEnd, event); | |
1653 EVENT_COMMIT(event, | |
1654 EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(this->threadObj()))); | |
1655 | |
1656 // Call after last event on thread | |
1657 EVENT_THREAD_EXIT(this); | |
1658 | |
1644 // Call Thread.exit(). We try 3 times in case we got another Thread.stop during | 1659 // Call Thread.exit(). We try 3 times in case we got another Thread.stop during |
1645 // the execution of the method. If that is not enough, then we don't really care. Thread.stop | 1660 // the execution of the method. If that is not enough, then we don't really care. Thread.stop |
1646 // is deprecated anyhow. | 1661 // is deprecated anyhow. |
1647 { int count = 3; | 1662 { int count = 3; |
1648 while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) { | 1663 while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) { |
3184 delete main_thread; | 3199 delete main_thread; |
3185 *canTryAgain = false; // don't let caller call JNI_CreateJavaVM again | 3200 *canTryAgain = false; // don't let caller call JNI_CreateJavaVM again |
3186 return status; | 3201 return status; |
3187 } | 3202 } |
3188 | 3203 |
3204 // Must be run after init_ft which initializes ft_enabled | |
3205 if (TRACE_INITIALIZE() != JNI_OK) { | |
3206 vm_exit_during_initialization("Failed to initialize tracing backend"); | |
3207 } | |
3208 | |
3189 // Should be done after the heap is fully created | 3209 // Should be done after the heap is fully created |
3190 main_thread->cache_global_variables(); | 3210 main_thread->cache_global_variables(); |
3191 | 3211 |
3192 HandleMark hm; | 3212 HandleMark hm; |
3193 | 3213 |
3419 // Launch -Xrun agents | 3439 // Launch -Xrun agents |
3420 // Must be done in the JVMTI live phase so that for backward compatibility the JDWP | 3440 // Must be done in the JVMTI live phase so that for backward compatibility the JDWP |
3421 // back-end can launch with -Xdebug -Xrunjdwp. | 3441 // back-end can launch with -Xdebug -Xrunjdwp. |
3422 if (!EagerXrunInit && Arguments::init_libraries_at_startup()) { | 3442 if (!EagerXrunInit && Arguments::init_libraries_at_startup()) { |
3423 create_vm_init_libraries(); | 3443 create_vm_init_libraries(); |
3444 } | |
3445 | |
3446 if (!TRACE_START()) { | |
3447 vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); | |
3424 } | 3448 } |
3425 | 3449 |
3426 // Notify JVMTI agents that VM initialization is complete - nop if no agents. | 3450 // Notify JVMTI agents that VM initialization is complete - nop if no agents. |
3427 JvmtiExport::post_vm_initialized(); | 3451 JvmtiExport::post_vm_initialized(); |
3428 | 3452 |