Mercurial > hg > truffle
comparison src/share/vm/memory/universe.hpp @ 642:660978a2a31a
6791178: Specialize for zero as the compressed oop vm heap base
Summary: Use zero based compressed oops if java heap is below 32gb and unscaled compressed oops if java heap is below 4gb.
Reviewed-by: never, twisti, jcoomes, coleenp
author | kvn |
---|---|
date | Thu, 12 Mar 2009 10:37:46 -0700 |
parents | d593294016c3 |
children | bd441136a5ce |
comparison
equal
deleted
inserted
replaced
641:6af0a709d52b | 642:660978a2a31a |
---|---|
88 | 88 |
89 public: | 89 public: |
90 methodOop get_methodOop(); | 90 methodOop get_methodOop(); |
91 }; | 91 }; |
92 | 92 |
93 // For UseCompressedOops. | |
94 struct NarrowOopStruct { | |
95 // Base address for oop-within-java-object materialization. | |
96 // NULL if using wide oops or zero based narrow oops. | |
97 address _base; | |
98 // Number of shift bits for encoding/decoding narrow oops. | |
99 // 0 if using wide oops or zero based unscaled narrow oops, | |
100 // LogMinObjAlignmentInBytes otherwise. | |
101 int _shift; | |
102 // Generate code with implicit null checks for narrow oops. | |
103 bool _use_implicit_null_checks; | |
104 }; | |
105 | |
93 | 106 |
94 class Universe: AllStatic { | 107 class Universe: AllStatic { |
95 // Ugh. Universe is much too friendly. | 108 // Ugh. Universe is much too friendly. |
96 friend class MarkSweep; | 109 friend class MarkSweep; |
97 friend class oopDesc; | 110 friend class oopDesc; |
179 | 192 |
180 static oop _emptySymbol; // Canonical empty string ("") symbol | 193 static oop _emptySymbol; // Canonical empty string ("") symbol |
181 | 194 |
182 // The particular choice of collected heap. | 195 // The particular choice of collected heap. |
183 static CollectedHeap* _collectedHeap; | 196 static CollectedHeap* _collectedHeap; |
184 // Base address for oop-within-java-object materialization. | 197 |
185 // NULL if using wide oops. Doubles as heap oop null value. | 198 // For UseCompressedOops. |
186 static address _heap_base; | 199 static struct NarrowOopStruct _narrow_oop; |
187 | 200 |
188 // array of dummy objects used with +FullGCAlot | 201 // array of dummy objects used with +FullGCAlot |
189 debug_only(static objArrayOop _fullgc_alot_dummy_array;) | 202 debug_only(static objArrayOop _fullgc_alot_dummy_array;) |
190 // index of next entry to clear | 203 // index of next entry to clear |
191 debug_only(static int _fullgc_alot_dummy_next;) | 204 debug_only(static int _fullgc_alot_dummy_next;) |
326 | 339 |
327 // The particular choice of collected heap. | 340 // The particular choice of collected heap. |
328 static CollectedHeap* heap() { return _collectedHeap; } | 341 static CollectedHeap* heap() { return _collectedHeap; } |
329 | 342 |
330 // For UseCompressedOops | 343 // For UseCompressedOops |
331 static address heap_base() { return _heap_base; } | 344 static address* narrow_oop_base_addr() { return &_narrow_oop._base; } |
332 static address* heap_base_addr() { return &_heap_base; } | 345 static address narrow_oop_base() { return _narrow_oop._base; } |
346 static int narrow_oop_shift() { return _narrow_oop._shift; } | |
347 static void set_narrow_oop_base(address base) { _narrow_oop._base = base; } | |
348 static void set_narrow_oop_shift(int shift) { _narrow_oop._shift = shift; } | |
349 static bool narrow_oop_use_implicit_null_checks() { return _narrow_oop._use_implicit_null_checks; } | |
350 static void set_narrow_oop_use_implicit_null_checks(bool use) { _narrow_oop._use_implicit_null_checks = use; } | |
351 // Narrow Oop encoding mode: | |
352 // 0 - Use 32-bits oops without encoding when | |
353 // NarrowOopHeapBaseMin + heap_size < 4Gb | |
354 // 1 - Use zero based compressed oops with encoding when | |
355 // NarrowOopHeapBaseMin + heap_size < 32Gb | |
356 // 2 - Use compressed oops with heap base + encoding. | |
357 enum NARROW_OOP_MODE { | |
358 UnscaledNarrowOop = 0, | |
359 ZeroBasedNarrowOop = 1, | |
360 HeapBasedNarrowOop = 2 | |
361 }; | |
362 static char* preferred_heap_base(size_t heap_size, NARROW_OOP_MODE mode); | |
333 | 363 |
334 // Historic gc information | 364 // Historic gc information |
335 static size_t get_heap_capacity_at_last_gc() { return _heap_capacity_at_last_gc; } | 365 static size_t get_heap_capacity_at_last_gc() { return _heap_capacity_at_last_gc; } |
336 static size_t get_heap_free_at_last_gc() { return _heap_capacity_at_last_gc - _heap_used_at_last_gc; } | 366 static size_t get_heap_free_at_last_gc() { return _heap_capacity_at_last_gc - _heap_used_at_last_gc; } |
337 static size_t get_heap_used_at_last_gc() { return _heap_used_at_last_gc; } | 367 static size_t get_heap_used_at_last_gc() { return _heap_used_at_last_gc; } |