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