src/share/vm/memory/universe.hpp

changeset 4159
8e47bac5643a
parent 4062
2a48c84f1d04
child 4177
633ba56cb013
equal deleted inserted replaced
4158:65d07d9ee446 4159:8e47bac5643a
103 103
104 public: 104 public:
105 Method* get_Method(); 105 Method* get_Method();
106 }; 106 };
107 107
108 // For UseCompressedOops. 108 // For UseCompressedOops and UseCompressedKlassPointers.
109 struct NarrowOopStruct { 109 struct NarrowPtrStruct {
110 // Base address for oop-within-java-object materialization. 110 // Base address for oop/klass-within-java-object materialization.
111 // NULL if using wide oops or zero based narrow oops. 111 // NULL if using wide oops/klasses or zero based narrow oops/klasses.
112 address _base; 112 address _base;
113 // Number of shift bits for encoding/decoding narrow oops. 113 // Number of shift bits for encoding/decoding narrow ptrs.
114 // 0 if using wide oops or zero based unscaled narrow oops, 114 // 0 if using wide ptrs or zero based unscaled narrow ptrs,
115 // LogMinObjAlignmentInBytes otherwise. 115 // LogMinObjAlignmentInBytes/LogKlassAlignmentInBytes otherwise.
116 int _shift; 116 int _shift;
117 // Generate code with implicit null checks for narrow oops. 117 // Generate code with implicit null checks for narrow ptrs.
118 bool _use_implicit_null_checks; 118 bool _use_implicit_null_checks;
119 }; 119 };
120 120
121 enum VerifyOption { 121 enum VerifyOption {
122 VerifyOption_Default = 0, 122 VerifyOption_Default = 0,
204 204
205 // The particular choice of collected heap. 205 // The particular choice of collected heap.
206 static CollectedHeap* _collectedHeap; 206 static CollectedHeap* _collectedHeap;
207 207
208 // For UseCompressedOops. 208 // For UseCompressedOops.
209 static struct NarrowOopStruct _narrow_oop; 209 static struct NarrowPtrStruct _narrow_oop;
210 // For UseCompressedKlassPointers.
211 static struct NarrowPtrStruct _narrow_klass;
212 static address _narrow_ptrs_base;
210 213
211 // array of dummy objects used with +FullGCAlot 214 // array of dummy objects used with +FullGCAlot
212 debug_only(static objArrayOop _fullgc_alot_dummy_array;) 215 debug_only(static objArrayOop _fullgc_alot_dummy_array;)
213 // index of next entry to clear 216 // index of next entry to clear
214 debug_only(static int _fullgc_alot_dummy_next;) 217 debug_only(static int _fullgc_alot_dummy_next;)
257 UnscaledNarrowOop = 0, 260 UnscaledNarrowOop = 0,
258 ZeroBasedNarrowOop = 1, 261 ZeroBasedNarrowOop = 1,
259 HeapBasedNarrowOop = 2 262 HeapBasedNarrowOop = 2
260 }; 263 };
261 static char* preferred_heap_base(size_t heap_size, NARROW_OOP_MODE mode); 264 static char* preferred_heap_base(size_t heap_size, NARROW_OOP_MODE mode);
262 static void set_narrow_oop_base(address base) { _narrow_oop._base = base; } 265 static char* preferred_metaspace_base(size_t heap_size, NARROW_OOP_MODE mode);
263 static void set_narrow_oop_use_implicit_null_checks(bool use) { _narrow_oop._use_implicit_null_checks = use; } 266 static void set_narrow_oop_base(address base) {
267 assert(UseCompressedOops, "no compressed oops?");
268 _narrow_oop._base = base;
269 }
270 static void set_narrow_klass_base(address base) {
271 assert(UseCompressedKlassPointers, "no compressed klass ptrs?");
272 _narrow_klass._base = base;
273 }
274 static void set_narrow_oop_use_implicit_null_checks(bool use) {
275 assert(UseCompressedOops, "no compressed ptrs?");
276 _narrow_oop._use_implicit_null_checks = use;
277 }
278 static bool reserve_metaspace_helper(bool with_base = false);
279 static ReservedHeapSpace reserve_heap_metaspace(size_t heap_size, size_t alignment, bool& contiguous);
264 280
265 // Debugging 281 // Debugging
266 static int _verify_count; // number of verifies done 282 static int _verify_count; // number of verifies done
267 // True during call to verify(). Should only be set/cleared in verify(). 283 // True during call to verify(). Should only be set/cleared in verify().
268 static bool _verify_in_progress; 284 static bool _verify_in_progress;
352 368
353 // The particular choice of collected heap. 369 // The particular choice of collected heap.
354 static CollectedHeap* heap() { return _collectedHeap; } 370 static CollectedHeap* heap() { return _collectedHeap; }
355 371
356 // For UseCompressedOops 372 // For UseCompressedOops
357 static address* narrow_oop_base_addr() { return &_narrow_oop._base; } 373 static address narrow_oop_base() { return _narrow_oop._base; }
358 static address narrow_oop_base() { return _narrow_oop._base; } 374 static bool is_narrow_oop_base(void* addr) { return (narrow_oop_base() == (address)addr); }
359 static bool is_narrow_oop_base(void* addr) { return (narrow_oop_base() == (address)addr); } 375 static int narrow_oop_shift() { return _narrow_oop._shift; }
360 static int narrow_oop_shift() { return _narrow_oop._shift; } 376 static bool narrow_oop_use_implicit_null_checks() { return _narrow_oop._use_implicit_null_checks; }
361 static bool narrow_oop_use_implicit_null_checks() { return _narrow_oop._use_implicit_null_checks; } 377
378 // For UseCompressedKlassPointers
379 static address narrow_klass_base() { return _narrow_klass._base; }
380 static bool is_narrow_klass_base(void* addr) { return (narrow_klass_base() == (address)addr); }
381 static int narrow_klass_shift() { return _narrow_klass._shift; }
382 static bool narrow_klass_use_implicit_null_checks() { return _narrow_klass._use_implicit_null_checks; }
383
384 static address* narrow_ptrs_base_addr() { return &_narrow_ptrs_base; }
385 static void set_narrow_ptrs_base(address a) { _narrow_ptrs_base = a; }
386 static address narrow_ptrs_base() { return _narrow_ptrs_base; }
362 387
363 // this is set in vm_version on sparc (and then reset in universe afaict) 388 // this is set in vm_version on sparc (and then reset in universe afaict)
364 static void set_narrow_oop_shift(int shift) { _narrow_oop._shift = shift; } 389 static void set_narrow_oop_shift(int shift) {
390 _narrow_oop._shift = shift;
391 }
392
393 static void set_narrow_klass_shift(int shift) {
394 assert(shift == 0 || shift == LogKlassAlignmentInBytes, "invalid shift for klass ptrs");
395 _narrow_klass._shift = shift;
396 }
365 397
366 // Reserve Java heap and determine CompressedOops mode 398 // Reserve Java heap and determine CompressedOops mode
367 static ReservedSpace reserve_heap(size_t heap_size, size_t alignment); 399 static ReservedSpace reserve_heap(size_t heap_size, size_t alignment);
368 400
369 // Historic gc information 401 // Historic gc information

mercurial