88 89 public: 90 ActiveMethodOopsCache() { _prev_methods = NULL; } 91 ~ActiveMethodOopsCache(); 92 93 void add_previous_version(Method* method); 94 bool is_same_method(const Method* method) const; 95 }; 96 97 98 // A helper class for caching a Method* when the user of the cache 99 // only cares about the latest version of the Method*. 100 // 101 class LatestMethodOopCache : public CommonMethodOopCache { 102 // This subclass adds a getter method for the latest Method*. 103 104 public: 105 Method* get_Method(); 106 }; 107 108 // For UseCompressedOops and UseCompressedKlassPointers. 109 struct NarrowPtrStruct { 110 // Base address for oop/klass-within-java-object materialization. 111 // NULL if using wide oops/klasses or zero based narrow oops/klasses. 112 address _base; 113 // Number of shift bits for encoding/decoding narrow ptrs. 114 // 0 if using wide ptrs or zero based unscaled narrow ptrs, 115 // LogMinObjAlignmentInBytes/LogKlassAlignmentInBytes otherwise. 116 int _shift; 117 // Generate code with implicit null checks for narrow ptrs. 118 bool _use_implicit_null_checks; 119 }; 120 121 enum VerifyOption { 122 VerifyOption_Default = 0, 123 124 // G1 125 VerifyOption_G1UsePrevMarking = VerifyOption_Default, 126 VerifyOption_G1UseNextMarking = VerifyOption_G1UsePrevMarking + 1, 127 VerifyOption_G1UseMarkWord = VerifyOption_G1UseNextMarking + 1 128 }; 129 130 class Universe: AllStatic { 131 // Ugh. Universe is much too friendly. 132 friend class MarkSweep; 133 friend class oopDesc; 134 friend class ClassLoader; 135 friend class Arguments; 136 friend class SystemDictionary; 137 friend class VMStructs; 138 friend class VM_PopulateDumpSharedSpace; 139 140 friend jint universe_init(); 141 friend void universe2_init(); 142 friend bool universe_post_init(); 143 144 private: 145 // Known classes in the VM 146 static Klass* _boolArrayKlassObj; 147 static Klass* _byteArrayKlassObj; 148 static Klass* _charArrayKlassObj; 149 static Klass* _intArrayKlassObj; 150 static Klass* _shortArrayKlassObj; 151 static Klass* _longArrayKlassObj; 152 static Klass* _singleArrayKlassObj; 153 static Klass* _doubleArrayKlassObj; 154 static Klass* _typeArrayKlassObjs[T_VOID+1]; 155 156 static Klass* _objectArrayKlassObj; 157 158 // Known objects in the VM 197 198 // number of preallocated error objects available for use 199 static volatile jint _preallocated_out_of_memory_error_avail_count; 200 201 static oop _null_ptr_exception_instance; // preallocated exception object 202 static oop _arithmetic_exception_instance; // preallocated exception object 203 static oop _virtual_machine_error_instance; // preallocated exception object 204 // The object used as an exception dummy when exceptions are thrown for 205 // the vm thread. 206 static oop _vm_exception; 207 208 // The particular choice of collected heap. 209 static CollectedHeap* _collectedHeap; 210 211 // For UseCompressedOops. 212 static struct NarrowPtrStruct _narrow_oop; 213 // For UseCompressedKlassPointers. 214 static struct NarrowPtrStruct _narrow_klass; 215 static address _narrow_ptrs_base; 216 217 // Aligned size of the metaspace. 218 static size_t _class_metaspace_size; 219 220 // array of dummy objects used with +FullGCAlot 221 debug_only(static objArrayOop _fullgc_alot_dummy_array;) 222 // index of next entry to clear 223 debug_only(static int _fullgc_alot_dummy_next;) 224 225 // Compiler/dispatch support 226 static int _base_vtable_size; // Java vtbl size of klass Object (in words) 227 228 // Initialization 229 static bool _bootstrapping; // true during genesis 230 static bool _fully_initialized; // true after universe_init and initialize_vtables called 231 232 // the array of preallocated errors with backtraces 233 static objArrayOop preallocated_out_of_memory_errors() { return _preallocated_out_of_memory_error_array; } 234 235 // generate an out of memory error; if possible using an error with preallocated backtrace; 236 // otherwise return the given default error. 237 static oop gen_out_of_memory_error(oop default_err); 238 239 // Historic gc information 251 static void genesis(TRAPS); // Create the initial world 252 253 // Mirrors for primitive classes (created eagerly) 254 static oop check_mirror(oop m) { 255 assert(m != NULL, "mirror not initialized"); 256 return m; 257 } 258 259 static void set_narrow_oop_base(address base) { 260 assert(UseCompressedOops, "no compressed oops?"); 261 _narrow_oop._base = base; 262 } 263 static void set_narrow_klass_base(address base) { 264 assert(UseCompressedKlassPointers, "no compressed klass ptrs?"); 265 _narrow_klass._base = base; 266 } 267 static void set_narrow_oop_use_implicit_null_checks(bool use) { 268 assert(UseCompressedOops, "no compressed ptrs?"); 269 _narrow_oop._use_implicit_null_checks = use; 270 } 271 static bool reserve_metaspace_helper(bool with_base = false); 272 static ReservedHeapSpace reserve_heap_metaspace(size_t heap_size, size_t alignment, bool& contiguous); 273 274 static size_t class_metaspace_size() { 275 return _class_metaspace_size; 276 } 277 static void set_class_metaspace_size(size_t metaspace_size) { 278 _class_metaspace_size = metaspace_size; 279 } 280 281 // Debugging 282 static int _verify_count; // number of verifies done 283 // True during call to verify(). Should only be set/cleared in verify(). 284 static bool _verify_in_progress; 285 286 static void compute_verify_oop_data(); 287 288 public: 289 // Known classes in the VM 290 static Klass* boolArrayKlassObj() { return _boolArrayKlassObj; } 291 static Klass* byteArrayKlassObj() { return _byteArrayKlassObj; } 292 static Klass* charArrayKlassObj() { return _charArrayKlassObj; } 293 static Klass* intArrayKlassObj() { return _intArrayKlassObj; } 294 static Klass* shortArrayKlassObj() { return _shortArrayKlassObj; } 295 static Klass* longArrayKlassObj() { return _longArrayKlassObj; } 296 static Klass* singleArrayKlassObj() { return _singleArrayKlassObj; } 297 static Klass* doubleArrayKlassObj() { return _doubleArrayKlassObj; } 298 299 static Klass* objectArrayKlassObj() { | 88 89 public: 90 ActiveMethodOopsCache() { _prev_methods = NULL; } 91 ~ActiveMethodOopsCache(); 92 93 void add_previous_version(Method* method); 94 bool is_same_method(const Method* method) const; 95 }; 96 97 98 // A helper class for caching a Method* when the user of the cache 99 // only cares about the latest version of the Method*. 100 // 101 class LatestMethodOopCache : public CommonMethodOopCache { 102 // This subclass adds a getter method for the latest Method*. 103 104 public: 105 Method* get_Method(); 106 }; 107 108 // For UseCompressedOops. 109 struct NarrowPtrStruct { 110 // Base address for oop-within-java-object materialization. 111 // NULL if using wide oops or zero based narrow oops. 112 address _base; 113 // Number of shift bits for encoding/decoding narrow ptrs. 114 // 0 if using wide ptrs or zero based unscaled narrow ptrs, 115 // LogMinObjAlignmentInBytes/LogKlassAlignmentInBytes otherwise. 116 int _shift; 117 // Generate code with implicit null checks for narrow ptrs. 118 bool _use_implicit_null_checks; 119 }; 120 121 enum VerifyOption { 122 VerifyOption_Default = 0, 123 124 // G1 125 VerifyOption_G1UsePrevMarking = VerifyOption_Default, 126 VerifyOption_G1UseNextMarking = VerifyOption_G1UsePrevMarking + 1, 127 VerifyOption_G1UseMarkWord = VerifyOption_G1UseNextMarking + 1 128 }; 129 130 class Universe: AllStatic { 131 // Ugh. Universe is much too friendly. 132 friend class MarkSweep; 133 friend class oopDesc; 134 friend class ClassLoader; 135 friend class Arguments; 136 friend class SystemDictionary; 137 friend class VMStructs; 138 friend class VM_PopulateDumpSharedSpace; 139 friend class Metaspace; 140 141 friend jint universe_init(); 142 friend void universe2_init(); 143 friend bool universe_post_init(); 144 145 private: 146 // Known classes in the VM 147 static Klass* _boolArrayKlassObj; 148 static Klass* _byteArrayKlassObj; 149 static Klass* _charArrayKlassObj; 150 static Klass* _intArrayKlassObj; 151 static Klass* _shortArrayKlassObj; 152 static Klass* _longArrayKlassObj; 153 static Klass* _singleArrayKlassObj; 154 static Klass* _doubleArrayKlassObj; 155 static Klass* _typeArrayKlassObjs[T_VOID+1]; 156 157 static Klass* _objectArrayKlassObj; 158 159 // Known objects in the VM 198 199 // number of preallocated error objects available for use 200 static volatile jint _preallocated_out_of_memory_error_avail_count; 201 202 static oop _null_ptr_exception_instance; // preallocated exception object 203 static oop _arithmetic_exception_instance; // preallocated exception object 204 static oop _virtual_machine_error_instance; // preallocated exception object 205 // The object used as an exception dummy when exceptions are thrown for 206 // the vm thread. 207 static oop _vm_exception; 208 209 // The particular choice of collected heap. 210 static CollectedHeap* _collectedHeap; 211 212 // For UseCompressedOops. 213 static struct NarrowPtrStruct _narrow_oop; 214 // For UseCompressedKlassPointers. 215 static struct NarrowPtrStruct _narrow_klass; 216 static address _narrow_ptrs_base; 217 218 // array of dummy objects used with +FullGCAlot 219 debug_only(static objArrayOop _fullgc_alot_dummy_array;) 220 // index of next entry to clear 221 debug_only(static int _fullgc_alot_dummy_next;) 222 223 // Compiler/dispatch support 224 static int _base_vtable_size; // Java vtbl size of klass Object (in words) 225 226 // Initialization 227 static bool _bootstrapping; // true during genesis 228 static bool _fully_initialized; // true after universe_init and initialize_vtables called 229 230 // the array of preallocated errors with backtraces 231 static objArrayOop preallocated_out_of_memory_errors() { return _preallocated_out_of_memory_error_array; } 232 233 // generate an out of memory error; if possible using an error with preallocated backtrace; 234 // otherwise return the given default error. 235 static oop gen_out_of_memory_error(oop default_err); 236 237 // Historic gc information 249 static void genesis(TRAPS); // Create the initial world 250 251 // Mirrors for primitive classes (created eagerly) 252 static oop check_mirror(oop m) { 253 assert(m != NULL, "mirror not initialized"); 254 return m; 255 } 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 270 // Debugging 271 static int _verify_count; // number of verifies done 272 // True during call to verify(). Should only be set/cleared in verify(). 273 static bool _verify_in_progress; 274 275 static void compute_verify_oop_data(); 276 277 public: 278 // Known classes in the VM 279 static Klass* boolArrayKlassObj() { return _boolArrayKlassObj; } 280 static Klass* byteArrayKlassObj() { return _byteArrayKlassObj; } 281 static Klass* charArrayKlassObj() { return _charArrayKlassObj; } 282 static Klass* intArrayKlassObj() { return _intArrayKlassObj; } 283 static Klass* shortArrayKlassObj() { return _shortArrayKlassObj; } 284 static Klass* longArrayKlassObj() { return _longArrayKlassObj; } 285 static Klass* singleArrayKlassObj() { return _singleArrayKlassObj; } 286 static Klass* doubleArrayKlassObj() { return _doubleArrayKlassObj; } 287 288 static Klass* objectArrayKlassObj() { |