169 } |
169 } |
170 |
170 |
171 void Thread::operator delete(void* p) { |
171 void Thread::operator delete(void* p) { |
172 if (UseBiasedLocking) { |
172 if (UseBiasedLocking) { |
173 void* real_malloc_addr = ((Thread*) p)->_real_malloc_address; |
173 void* real_malloc_addr = ((Thread*) p)->_real_malloc_address; |
174 FreeHeap(real_malloc_addr, mtThread); |
174 FreeHeap(real_malloc_addr); |
175 } else { |
175 } else { |
176 FreeHeap(p, mtThread); |
176 FreeHeap(p); |
177 } |
177 } |
178 } |
178 } |
179 |
179 |
180 |
180 |
181 // Base class for all threads: VMThread, WatcherThread, ConcurrentMarkSweepThread, |
181 // Base class for all threads: VMThread, WatcherThread, ConcurrentMarkSweepThread, |
1144 _processed_thread = NULL; |
1144 _processed_thread = NULL; |
1145 } |
1145 } |
1146 |
1146 |
1147 NamedThread::~NamedThread() { |
1147 NamedThread::~NamedThread() { |
1148 if (_name != NULL) { |
1148 if (_name != NULL) { |
1149 FREE_C_HEAP_ARRAY(char, _name, mtThread); |
1149 FREE_C_HEAP_ARRAY(char, _name); |
1150 _name = NULL; |
1150 _name = NULL; |
1151 } |
1151 } |
1152 } |
1152 } |
1153 |
1153 |
1154 void NamedThread::set_name(const char* format, ...) { |
1154 void NamedThread::set_name(const char* format, ...) { |
2996 return in_WordSize(sz / wordSize); |
2996 return in_WordSize(sz / wordSize); |
2997 } |
2997 } |
2998 |
2998 |
2999 void JavaThread::popframe_free_preserved_args() { |
2999 void JavaThread::popframe_free_preserved_args() { |
3000 assert(_popframe_preserved_args != NULL, "should not free PopFrame preserved arguments twice"); |
3000 assert(_popframe_preserved_args != NULL, "should not free PopFrame preserved arguments twice"); |
3001 FREE_C_HEAP_ARRAY(char, (char*) _popframe_preserved_args, mtThread); |
3001 FREE_C_HEAP_ARRAY(char, (char*) _popframe_preserved_args); |
3002 _popframe_preserved_args = NULL; |
3002 _popframe_preserved_args = NULL; |
3003 _popframe_preserved_args_size = 0; |
3003 _popframe_preserved_args_size = 0; |
3004 } |
3004 } |
3005 |
3005 |
3006 #ifndef PRODUCT |
3006 #ifndef PRODUCT |
3606 size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1; |
3606 size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1; |
3607 char *buf = NEW_C_HEAP_ARRAY(char, len, mtThread); |
3607 char *buf = NEW_C_HEAP_ARRAY(char, len, mtThread); |
3608 jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf); |
3608 jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf); |
3609 // If we can't find the agent, exit. |
3609 // If we can't find the agent, exit. |
3610 vm_exit_during_initialization(buf, NULL); |
3610 vm_exit_during_initialization(buf, NULL); |
3611 FREE_C_HEAP_ARRAY(char, buf, mtThread); |
3611 FREE_C_HEAP_ARRAY(char, buf); |
3612 } |
3612 } |
3613 } else { |
3613 } else { |
3614 // Try to load the agent from the standard dll directory |
3614 // Try to load the agent from the standard dll directory |
3615 if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), |
3615 if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), |
3616 name)) { |
3616 name)) { |
3626 size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1; |
3626 size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1; |
3627 char *buf = NEW_C_HEAP_ARRAY(char, len, mtThread); |
3627 char *buf = NEW_C_HEAP_ARRAY(char, len, mtThread); |
3628 jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf); |
3628 jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf); |
3629 // If we can't find the agent, exit. |
3629 // If we can't find the agent, exit. |
3630 vm_exit_during_initialization(buf, NULL); |
3630 vm_exit_during_initialization(buf, NULL); |
3631 FREE_C_HEAP_ARRAY(char, buf, mtThread); |
3631 FREE_C_HEAP_ARRAY(char, buf); |
3632 } |
3632 } |
3633 } |
3633 } |
3634 } |
3634 } |
3635 agent->set_os_lib(library); |
3635 agent->set_os_lib(library); |
3636 agent->set_valid(); |
3636 agent->set_valid(); |