comparison src/share/vm/runtime/thread.cpp @ 2100:b1a2afa37ec4

7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis Summary: Track allocated bytes in Thread's, update on TLAB retirement and direct allocation in Eden and tenured, add JNI methods for ThreadMXBean. Reviewed-by: coleenp, kvn, dholmes, ysr
author phh
date Fri, 07 Jan 2011 10:42:32 -0500
parents 4de5f4101cfd
children 91fe28b03d6a db2b0f8c1cef
comparison
equal deleted inserted replaced
2097:039eb4201e06 2100:b1a2afa37ec4
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
175 // Base class for all threads: VMThread, WatcherThread, ConcurrentMarkSweepThread, 175 // Base class for all threads: VMThread, WatcherThread, ConcurrentMarkSweepThread,
176 // JavaThread 176 // JavaThread
177 177
178 178
179 Thread::Thread() { 179 Thread::Thread() {
180 // stack 180 // stack and get_thread
181 _stack_base = NULL; 181 set_stack_base(NULL);
182 _stack_size = 0; 182 set_stack_size(0);
183 _self_raw_id = 0; 183 set_self_raw_id(0);
184 _lgrp_id = -1; 184 set_lgrp_id(-1);
185 _osthread = NULL;
186 185
187 // allocated data structures 186 // allocated data structures
187 set_osthread(NULL);
188 set_resource_area(new ResourceArea()); 188 set_resource_area(new ResourceArea());
189 set_handle_area(new HandleArea(NULL)); 189 set_handle_area(new HandleArea(NULL));
190 set_active_handles(NULL); 190 set_active_handles(NULL);
191 set_free_handle_block(NULL); 191 set_free_handle_block(NULL);
192 set_last_handle_mark(NULL); 192 set_last_handle_mark(NULL);
193 set_osthread(NULL);
194 193
195 // This initial value ==> never claimed. 194 // This initial value ==> never claimed.
196 _oops_do_parity = 0; 195 _oops_do_parity = 0;
197 196
198 // the handle mark links itself to last_handle_mark 197 // the handle mark links itself to last_handle_mark
203 debug_only(_allow_allocation_count = 0;) 202 debug_only(_allow_allocation_count = 0;)
204 NOT_PRODUCT(_allow_safepoint_count = 0;) 203 NOT_PRODUCT(_allow_safepoint_count = 0;)
205 NOT_PRODUCT(_skip_gcalot = false;) 204 NOT_PRODUCT(_skip_gcalot = false;)
206 CHECK_UNHANDLED_OOPS_ONLY(_gc_locked_out_count = 0;) 205 CHECK_UNHANDLED_OOPS_ONLY(_gc_locked_out_count = 0;)
207 _jvmti_env_iteration_count = 0; 206 _jvmti_env_iteration_count = 0;
207 set_allocated_bytes(0);
208 _vm_operation_started_count = 0; 208 _vm_operation_started_count = 0;
209 _vm_operation_completed_count = 0; 209 _vm_operation_completed_count = 0;
210 _current_pending_monitor = NULL; 210 _current_pending_monitor = NULL;
211 _current_pending_monitor_is_from_java = true; 211 _current_pending_monitor_is_from_java = true;
212 _current_waiting_monitor = NULL; 212 _current_waiting_monitor = NULL;
3229 warning("java.lang.ClassCastException has not been initialized"); 3229 warning("java.lang.ClassCastException has not been initialized");
3230 warning("java.lang.ArrayStoreException has not been initialized"); 3230 warning("java.lang.ArrayStoreException has not been initialized");
3231 warning("java.lang.ArithmeticException has not been initialized"); 3231 warning("java.lang.ArithmeticException has not been initialized");
3232 warning("java.lang.StackOverflowError has not been initialized"); 3232 warning("java.lang.StackOverflowError has not been initialized");
3233 } 3233 }
3234 } 3234 }
3235 3235
3236 // See : bugid 4211085. 3236 // See : bugid 4211085.
3237 // Background : the static initializer of java.lang.Compiler tries to read 3237 // Background : the static initializer of java.lang.Compiler tries to read
3238 // property"java.compiler" and read & write property "java.vm.info". 3238 // property"java.compiler" and read & write property "java.vm.info".
3239 // When a security manager is installed through the command line 3239 // When a security manager is installed through the command line