Mercurial > hg > graal-compiler
comparison src/share/vm/memory/universe.hpp @ 10405:f2110083203d
8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
author | sla |
---|---|
date | Mon, 10 Jun 2013 11:30:51 +0200 |
parents | 92ef81e2f571 |
children | 3a0774193f71 de2d15ce3d4a |
comparison
equal
deleted
inserted
replaced
10404:d0add7016434 | 10405:f2110083203d |
---|---|
251 static oop check_mirror(oop m) { | 251 static oop check_mirror(oop m) { |
252 assert(m != NULL, "mirror not initialized"); | 252 assert(m != NULL, "mirror not initialized"); |
253 return m; | 253 return m; |
254 } | 254 } |
255 | 255 |
256 static void set_narrow_oop_base(address base) { | |
257 assert(UseCompressedOops, "no compressed oops?"); | |
258 _narrow_oop._base = base; | |
259 } | |
260 static void set_narrow_klass_base(address base) { | |
261 assert(UseCompressedKlassPointers, "no compressed klass ptrs?"); | |
262 _narrow_klass._base = base; | |
263 } | |
264 static void set_narrow_oop_use_implicit_null_checks(bool use) { | |
265 assert(UseCompressedOops, "no compressed ptrs?"); | |
266 _narrow_oop._use_implicit_null_checks = use; | |
267 } | |
268 static bool reserve_metaspace_helper(bool with_base = false); | |
269 static ReservedHeapSpace reserve_heap_metaspace(size_t heap_size, size_t alignment, bool& contiguous); | |
270 | |
271 static size_t class_metaspace_size() { | |
272 return _class_metaspace_size; | |
273 } | |
274 static void set_class_metaspace_size(size_t metaspace_size) { | |
275 _class_metaspace_size = metaspace_size; | |
276 } | |
277 | |
278 // Debugging | |
279 static int _verify_count; // number of verifies done | |
280 // True during call to verify(). Should only be set/cleared in verify(). | |
281 static bool _verify_in_progress; | |
282 | |
283 static void compute_verify_oop_data(); | |
284 | |
285 public: | |
286 // Known classes in the VM | |
287 static Klass* boolArrayKlassObj() { return _boolArrayKlassObj; } | |
288 static Klass* byteArrayKlassObj() { return _byteArrayKlassObj; } | |
289 static Klass* charArrayKlassObj() { return _charArrayKlassObj; } | |
290 static Klass* intArrayKlassObj() { return _intArrayKlassObj; } | |
291 static Klass* shortArrayKlassObj() { return _shortArrayKlassObj; } | |
292 static Klass* longArrayKlassObj() { return _longArrayKlassObj; } | |
293 static Klass* singleArrayKlassObj() { return _singleArrayKlassObj; } | |
294 static Klass* doubleArrayKlassObj() { return _doubleArrayKlassObj; } | |
295 | |
296 static Klass* objectArrayKlassObj() { | |
297 return _objectArrayKlassObj; | |
298 } | |
299 | |
300 static Klass* typeArrayKlassObj(BasicType t) { | |
301 assert((uint)t < T_VOID+1, err_msg("range check for type: %s", type2name(t))); | |
302 assert(_typeArrayKlassObjs[t] != NULL, "domain check"); | |
303 return _typeArrayKlassObjs[t]; | |
304 } | |
305 | |
306 // Known objects in the VM | |
307 static oop int_mirror() { return check_mirror(_int_mirror); } | |
308 static oop float_mirror() { return check_mirror(_float_mirror); } | |
309 static oop double_mirror() { return check_mirror(_double_mirror); } | |
310 static oop byte_mirror() { return check_mirror(_byte_mirror); } | |
311 static oop bool_mirror() { return check_mirror(_bool_mirror); } | |
312 static oop char_mirror() { return check_mirror(_char_mirror); } | |
313 static oop long_mirror() { return check_mirror(_long_mirror); } | |
314 static oop short_mirror() { return check_mirror(_short_mirror); } | |
315 static oop void_mirror() { return check_mirror(_void_mirror); } | |
316 | |
317 // table of same | |
318 static oop _mirrors[T_VOID+1]; | |
319 | |
320 static oop java_mirror(BasicType t) { | |
321 assert((uint)t < T_VOID+1, "range check"); | |
322 return check_mirror(_mirrors[t]); | |
323 } | |
324 static oop main_thread_group() { return _main_thread_group; } | |
325 static void set_main_thread_group(oop group) { _main_thread_group = group;} | |
326 | |
327 static oop system_thread_group() { return _system_thread_group; } | |
328 static void set_system_thread_group(oop group) { _system_thread_group = group;} | |
329 | |
330 static objArrayOop the_empty_class_klass_array () { return _the_empty_class_klass_array; } | |
331 static Array<Klass*>* the_array_interfaces_array() { return _the_array_interfaces_array; } | |
332 static oop the_null_string() { return _the_null_string; } | |
333 static oop the_min_jint_string() { return _the_min_jint_string; } | |
334 static Method* finalizer_register_method() { return _finalizer_register_cache->get_Method(); } | |
335 static Method* loader_addClass_method() { return _loader_addClass_cache->get_Method(); } | |
336 static ActiveMethodOopsCache* reflect_invoke_cache() { return _reflect_invoke_cache; } | |
337 static oop null_ptr_exception_instance() { return _null_ptr_exception_instance; } | |
338 static oop arithmetic_exception_instance() { return _arithmetic_exception_instance; } | |
339 static oop virtual_machine_error_instance() { return _virtual_machine_error_instance; } | |
340 static oop vm_exception() { return _vm_exception; } | |
341 | |
342 static Array<int>* the_empty_int_array() { return _the_empty_int_array; } | |
343 static Array<u2>* the_empty_short_array() { return _the_empty_short_array; } | |
344 static Array<Method*>* the_empty_method_array() { return _the_empty_method_array; } | |
345 static Array<Klass*>* the_empty_klass_array() { return _the_empty_klass_array; } | |
346 | |
347 // OutOfMemoryError support. Returns an error with the required message. The returned error | |
348 // may or may not have a backtrace. If error has a backtrace then the stack trace is already | |
349 // filled in. | |
350 static oop out_of_memory_error_java_heap() { return gen_out_of_memory_error(_out_of_memory_error_java_heap); } | |
351 static oop out_of_memory_error_perm_gen() { return gen_out_of_memory_error(_out_of_memory_error_perm_gen); } | |
352 static oop out_of_memory_error_array_size() { return gen_out_of_memory_error(_out_of_memory_error_array_size); } | |
353 static oop out_of_memory_error_gc_overhead_limit() { return gen_out_of_memory_error(_out_of_memory_error_gc_overhead_limit); } | |
354 | |
355 // Accessors needed for fast allocation | |
356 static Klass** boolArrayKlassObj_addr() { return &_boolArrayKlassObj; } | |
357 static Klass** byteArrayKlassObj_addr() { return &_byteArrayKlassObj; } | |
358 static Klass** charArrayKlassObj_addr() { return &_charArrayKlassObj; } | |
359 static Klass** intArrayKlassObj_addr() { return &_intArrayKlassObj; } | |
360 static Klass** shortArrayKlassObj_addr() { return &_shortArrayKlassObj; } | |
361 static Klass** longArrayKlassObj_addr() { return &_longArrayKlassObj; } | |
362 static Klass** singleArrayKlassObj_addr() { return &_singleArrayKlassObj; } | |
363 static Klass** doubleArrayKlassObj_addr() { return &_doubleArrayKlassObj; } | |
364 static Klass** objectArrayKlassObj_addr() { return &_objectArrayKlassObj; } | |
365 | |
366 // The particular choice of collected heap. | |
367 static CollectedHeap* heap() { return _collectedHeap; } | |
368 | |
369 // For UseCompressedOops | |
256 // Narrow Oop encoding mode: | 370 // Narrow Oop encoding mode: |
257 // 0 - Use 32-bits oops without encoding when | 371 // 0 - Use 32-bits oops without encoding when |
258 // NarrowOopHeapBaseMin + heap_size < 4Gb | 372 // NarrowOopHeapBaseMin + heap_size < 4Gb |
259 // 1 - Use zero based compressed oops with encoding when | 373 // 1 - Use zero based compressed oops with encoding when |
260 // NarrowOopHeapBaseMin + heap_size < 32Gb | 374 // NarrowOopHeapBaseMin + heap_size < 32Gb |
262 enum NARROW_OOP_MODE { | 376 enum NARROW_OOP_MODE { |
263 UnscaledNarrowOop = 0, | 377 UnscaledNarrowOop = 0, |
264 ZeroBasedNarrowOop = 1, | 378 ZeroBasedNarrowOop = 1, |
265 HeapBasedNarrowOop = 2 | 379 HeapBasedNarrowOop = 2 |
266 }; | 380 }; |
381 static NARROW_OOP_MODE narrow_oop_mode(); | |
382 static const char* narrow_oop_mode_to_string(NARROW_OOP_MODE mode); | |
267 static char* preferred_heap_base(size_t heap_size, NARROW_OOP_MODE mode); | 383 static char* preferred_heap_base(size_t heap_size, NARROW_OOP_MODE mode); |
268 static char* preferred_metaspace_base(size_t heap_size, NARROW_OOP_MODE mode); | 384 static char* preferred_metaspace_base(size_t heap_size, NARROW_OOP_MODE mode); |
269 static void set_narrow_oop_base(address base) { | |
270 assert(UseCompressedOops, "no compressed oops?"); | |
271 _narrow_oop._base = base; | |
272 } | |
273 static void set_narrow_klass_base(address base) { | |
274 assert(UseCompressedKlassPointers, "no compressed klass ptrs?"); | |
275 _narrow_klass._base = base; | |
276 } | |
277 static void set_narrow_oop_use_implicit_null_checks(bool use) { | |
278 assert(UseCompressedOops, "no compressed ptrs?"); | |
279 _narrow_oop._use_implicit_null_checks = use; | |
280 } | |
281 static bool reserve_metaspace_helper(bool with_base = false); | |
282 static ReservedHeapSpace reserve_heap_metaspace(size_t heap_size, size_t alignment, bool& contiguous); | |
283 | |
284 static size_t class_metaspace_size() { | |
285 return _class_metaspace_size; | |
286 } | |
287 static void set_class_metaspace_size(size_t metaspace_size) { | |
288 _class_metaspace_size = metaspace_size; | |
289 } | |
290 | |
291 // Debugging | |
292 static int _verify_count; // number of verifies done | |
293 // True during call to verify(). Should only be set/cleared in verify(). | |
294 static bool _verify_in_progress; | |
295 | |
296 static void compute_verify_oop_data(); | |
297 | |
298 public: | |
299 // Known classes in the VM | |
300 static Klass* boolArrayKlassObj() { return _boolArrayKlassObj; } | |
301 static Klass* byteArrayKlassObj() { return _byteArrayKlassObj; } | |
302 static Klass* charArrayKlassObj() { return _charArrayKlassObj; } | |
303 static Klass* intArrayKlassObj() { return _intArrayKlassObj; } | |
304 static Klass* shortArrayKlassObj() { return _shortArrayKlassObj; } | |
305 static Klass* longArrayKlassObj() { return _longArrayKlassObj; } | |
306 static Klass* singleArrayKlassObj() { return _singleArrayKlassObj; } | |
307 static Klass* doubleArrayKlassObj() { return _doubleArrayKlassObj; } | |
308 | |
309 static Klass* objectArrayKlassObj() { | |
310 return _objectArrayKlassObj; | |
311 } | |
312 | |
313 static Klass* typeArrayKlassObj(BasicType t) { | |
314 assert((uint)t < T_VOID+1, err_msg("range check for type: %s", type2name(t))); | |
315 assert(_typeArrayKlassObjs[t] != NULL, "domain check"); | |
316 return _typeArrayKlassObjs[t]; | |
317 } | |
318 | |
319 // Known objects in the VM | |
320 static oop int_mirror() { return check_mirror(_int_mirror); } | |
321 static oop float_mirror() { return check_mirror(_float_mirror); } | |
322 static oop double_mirror() { return check_mirror(_double_mirror); } | |
323 static oop byte_mirror() { return check_mirror(_byte_mirror); } | |
324 static oop bool_mirror() { return check_mirror(_bool_mirror); } | |
325 static oop char_mirror() { return check_mirror(_char_mirror); } | |
326 static oop long_mirror() { return check_mirror(_long_mirror); } | |
327 static oop short_mirror() { return check_mirror(_short_mirror); } | |
328 static oop void_mirror() { return check_mirror(_void_mirror); } | |
329 | |
330 // table of same | |
331 static oop _mirrors[T_VOID+1]; | |
332 | |
333 static oop java_mirror(BasicType t) { | |
334 assert((uint)t < T_VOID+1, "range check"); | |
335 return check_mirror(_mirrors[t]); | |
336 } | |
337 static oop main_thread_group() { return _main_thread_group; } | |
338 static void set_main_thread_group(oop group) { _main_thread_group = group;} | |
339 | |
340 static oop system_thread_group() { return _system_thread_group; } | |
341 static void set_system_thread_group(oop group) { _system_thread_group = group;} | |
342 | |
343 static objArrayOop the_empty_class_klass_array () { return _the_empty_class_klass_array; } | |
344 static Array<Klass*>* the_array_interfaces_array() { return _the_array_interfaces_array; } | |
345 static oop the_null_string() { return _the_null_string; } | |
346 static oop the_min_jint_string() { return _the_min_jint_string; } | |
347 static Method* finalizer_register_method() { return _finalizer_register_cache->get_Method(); } | |
348 static Method* loader_addClass_method() { return _loader_addClass_cache->get_Method(); } | |
349 static ActiveMethodOopsCache* reflect_invoke_cache() { return _reflect_invoke_cache; } | |
350 static oop null_ptr_exception_instance() { return _null_ptr_exception_instance; } | |
351 static oop arithmetic_exception_instance() { return _arithmetic_exception_instance; } | |
352 static oop virtual_machine_error_instance() { return _virtual_machine_error_instance; } | |
353 static oop vm_exception() { return _vm_exception; } | |
354 | |
355 static Array<int>* the_empty_int_array() { return _the_empty_int_array; } | |
356 static Array<u2>* the_empty_short_array() { return _the_empty_short_array; } | |
357 static Array<Method*>* the_empty_method_array() { return _the_empty_method_array; } | |
358 static Array<Klass*>* the_empty_klass_array() { return _the_empty_klass_array; } | |
359 | |
360 // OutOfMemoryError support. Returns an error with the required message. The returned error | |
361 // may or may not have a backtrace. If error has a backtrace then the stack trace is already | |
362 // filled in. | |
363 static oop out_of_memory_error_java_heap() { return gen_out_of_memory_error(_out_of_memory_error_java_heap); } | |
364 static oop out_of_memory_error_perm_gen() { return gen_out_of_memory_error(_out_of_memory_error_perm_gen); } | |
365 static oop out_of_memory_error_array_size() { return gen_out_of_memory_error(_out_of_memory_error_array_size); } | |
366 static oop out_of_memory_error_gc_overhead_limit() { return gen_out_of_memory_error(_out_of_memory_error_gc_overhead_limit); } | |
367 | |
368 // Accessors needed for fast allocation | |
369 static Klass** boolArrayKlassObj_addr() { return &_boolArrayKlassObj; } | |
370 static Klass** byteArrayKlassObj_addr() { return &_byteArrayKlassObj; } | |
371 static Klass** charArrayKlassObj_addr() { return &_charArrayKlassObj; } | |
372 static Klass** intArrayKlassObj_addr() { return &_intArrayKlassObj; } | |
373 static Klass** shortArrayKlassObj_addr() { return &_shortArrayKlassObj; } | |
374 static Klass** longArrayKlassObj_addr() { return &_longArrayKlassObj; } | |
375 static Klass** singleArrayKlassObj_addr() { return &_singleArrayKlassObj; } | |
376 static Klass** doubleArrayKlassObj_addr() { return &_doubleArrayKlassObj; } | |
377 static Klass** objectArrayKlassObj_addr() { return &_objectArrayKlassObj; } | |
378 | |
379 // The particular choice of collected heap. | |
380 static CollectedHeap* heap() { return _collectedHeap; } | |
381 | |
382 // For UseCompressedOops | |
383 static address narrow_oop_base() { return _narrow_oop._base; } | 385 static address narrow_oop_base() { return _narrow_oop._base; } |
384 static bool is_narrow_oop_base(void* addr) { return (narrow_oop_base() == (address)addr); } | 386 static bool is_narrow_oop_base(void* addr) { return (narrow_oop_base() == (address)addr); } |
385 static int narrow_oop_shift() { return _narrow_oop._shift; } | 387 static int narrow_oop_shift() { return _narrow_oop._shift; } |
386 static bool narrow_oop_use_implicit_null_checks() { return _narrow_oop._use_implicit_null_checks; } | 388 static bool narrow_oop_use_implicit_null_checks() { return _narrow_oop._use_implicit_null_checks; } |
387 | 389 |