1.1 --- a/src/share/vm/memory/universe.hpp Wed Mar 11 14:16:13 2009 -0700 1.2 +++ b/src/share/vm/memory/universe.hpp Thu Mar 12 10:37:46 2009 -0700 1.3 @@ -90,6 +90,19 @@ 1.4 methodOop get_methodOop(); 1.5 }; 1.6 1.7 +// For UseCompressedOops. 1.8 +struct NarrowOopStruct { 1.9 + // Base address for oop-within-java-object materialization. 1.10 + // NULL if using wide oops or zero based narrow oops. 1.11 + address _base; 1.12 + // Number of shift bits for encoding/decoding narrow oops. 1.13 + // 0 if using wide oops or zero based unscaled narrow oops, 1.14 + // LogMinObjAlignmentInBytes otherwise. 1.15 + int _shift; 1.16 + // Generate code with implicit null checks for narrow oops. 1.17 + bool _use_implicit_null_checks; 1.18 +}; 1.19 + 1.20 1.21 class Universe: AllStatic { 1.22 // Ugh. Universe is much too friendly. 1.23 @@ -181,9 +194,9 @@ 1.24 1.25 // The particular choice of collected heap. 1.26 static CollectedHeap* _collectedHeap; 1.27 - // Base address for oop-within-java-object materialization. 1.28 - // NULL if using wide oops. Doubles as heap oop null value. 1.29 - static address _heap_base; 1.30 + 1.31 + // For UseCompressedOops. 1.32 + static struct NarrowOopStruct _narrow_oop; 1.33 1.34 // array of dummy objects used with +FullGCAlot 1.35 debug_only(static objArrayOop _fullgc_alot_dummy_array;) 1.36 @@ -328,8 +341,25 @@ 1.37 static CollectedHeap* heap() { return _collectedHeap; } 1.38 1.39 // For UseCompressedOops 1.40 - static address heap_base() { return _heap_base; } 1.41 - static address* heap_base_addr() { return &_heap_base; } 1.42 + static address* narrow_oop_base_addr() { return &_narrow_oop._base; } 1.43 + static address narrow_oop_base() { return _narrow_oop._base; } 1.44 + static int narrow_oop_shift() { return _narrow_oop._shift; } 1.45 + static void set_narrow_oop_base(address base) { _narrow_oop._base = base; } 1.46 + static void set_narrow_oop_shift(int shift) { _narrow_oop._shift = shift; } 1.47 + static bool narrow_oop_use_implicit_null_checks() { return _narrow_oop._use_implicit_null_checks; } 1.48 + static void set_narrow_oop_use_implicit_null_checks(bool use) { _narrow_oop._use_implicit_null_checks = use; } 1.49 + // Narrow Oop encoding mode: 1.50 + // 0 - Use 32-bits oops without encoding when 1.51 + // NarrowOopHeapBaseMin + heap_size < 4Gb 1.52 + // 1 - Use zero based compressed oops with encoding when 1.53 + // NarrowOopHeapBaseMin + heap_size < 32Gb 1.54 + // 2 - Use compressed oops with heap base + encoding. 1.55 + enum NARROW_OOP_MODE { 1.56 + UnscaledNarrowOop = 0, 1.57 + ZeroBasedNarrowOop = 1, 1.58 + HeapBasedNarrowOop = 2 1.59 + }; 1.60 + static char* preferred_heap_base(size_t heap_size, NARROW_OOP_MODE mode); 1.61 1.62 // Historic gc information 1.63 static size_t get_heap_capacity_at_last_gc() { return _heap_capacity_at_last_gc; }