src/share/vm/memory/universe.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 131   // Primitive objects
 132   static oop _int_mirror;
 133   static oop _float_mirror;
 134   static oop _double_mirror;
 135   static oop _byte_mirror;
 136   static oop _bool_mirror;
 137   static oop _char_mirror;
 138   static oop _long_mirror;
 139   static oop _short_mirror;
 140   static oop _void_mirror;
 141 
 142   static oop          _main_thread_group;             // Reference to the main thread group object
 143   static oop          _system_thread_group;           // Reference to the system thread group object
 144 
 145   static objArrayOop  _the_empty_class_klass_array;   // Canonicalized obj array of type java.lang.Class
 146   static oop          _the_null_string;               // A cache of "null" as a Java string
 147   static oop          _the_min_jint_string;          // A cache of "-2147483648" as a Java string
 148   static LatestMethodCache* _finalizer_register_cache; // static method for registering finalizable objects
 149   static LatestMethodCache* _loader_addClass_cache;    // method for registering loaded classes in class loader vector
 150   static LatestMethodCache* _pd_implies_cache;         // method for checking protection domain attributes

 151 
 152   static Method* _throw_illegal_access_error;
 153 
 154   // preallocated error objects (no backtrace)
 155   static oop          _out_of_memory_error_java_heap;
 156   static oop          _out_of_memory_error_metaspace;
 157   static oop          _out_of_memory_error_class_metaspace;
 158   static oop          _out_of_memory_error_array_size;
 159   static oop          _out_of_memory_error_gc_overhead_limit;
 160   static oop          _out_of_memory_error_realloc_objects;
 161 
 162   static Array<int>*       _the_empty_int_array;    // Canonicalized int array
 163   static Array<u2>*        _the_empty_short_array;  // Canonicalized short array
 164   static Array<Klass*>*  _the_empty_klass_array;  // Canonicalized klass obj array
 165   static Array<Method*>* _the_empty_method_array; // Canonicalized method obj array
 166 
 167   static Array<Klass*>*  _the_array_interfaces_array;
 168 
 169   // array of preallocated error objects with backtrace
 170   static objArrayOop   _preallocated_out_of_memory_error_array;
 171 
 172   // number of preallocated error objects available for use
 173   static volatile jint _preallocated_out_of_memory_error_avail_count;


 288 
 289   static oop java_mirror(BasicType t) {
 290     assert((uint)t < T_VOID+1, "range check");
 291     return check_mirror(_mirrors[t]);
 292   }
 293   static oop      main_thread_group()                 { return _main_thread_group; }
 294   static void set_main_thread_group(oop group)        { _main_thread_group = group;}
 295 
 296   static oop      system_thread_group()               { return _system_thread_group; }
 297   static void set_system_thread_group(oop group)      { _system_thread_group = group;}
 298 
 299   static objArrayOop  the_empty_class_klass_array ()  { return _the_empty_class_klass_array;   }
 300   static Array<Klass*>* the_array_interfaces_array() { return _the_array_interfaces_array;   }
 301   static oop          the_null_string()               { return _the_null_string;               }
 302   static oop          the_min_jint_string()          { return _the_min_jint_string;          }
 303 
 304   static Method*      finalizer_register_method()     { return _finalizer_register_cache->get_method(); }
 305   static Method*      loader_addClass_method()        { return _loader_addClass_cache->get_method(); }
 306 
 307   static Method*      protection_domain_implies_method() { return _pd_implies_cache->get_method(); }

 308 
 309   static oop          null_ptr_exception_instance()   { return _null_ptr_exception_instance;   }
 310   static oop          arithmetic_exception_instance() { return _arithmetic_exception_instance; }
 311   static oop          virtual_machine_error_instance() { return _virtual_machine_error_instance; }
 312   static oop          vm_exception()                  { return _vm_exception; }
 313 
 314   static inline oop   allocation_context_notification_obj();
 315   static inline void  set_allocation_context_notification_obj(oop obj);
 316 
 317   static Method*      throw_illegal_access_error()    { return _throw_illegal_access_error; }
 318 
 319   static Array<int>*       the_empty_int_array()    { return _the_empty_int_array; }
 320   static Array<u2>*        the_empty_short_array()  { return _the_empty_short_array; }
 321   static Array<Method*>* the_empty_method_array() { return _the_empty_method_array; }
 322   static Array<Klass*>*  the_empty_klass_array()  { return _the_empty_klass_array; }
 323 
 324   // OutOfMemoryError support. Returns an error with the required message. The returned error
 325   // may or may not have a backtrace. If error has a backtrace then the stack trace is already
 326   // filled in.
 327   static oop out_of_memory_error_java_heap()          { return gen_out_of_memory_error(_out_of_memory_error_java_heap);  }
 328   static oop out_of_memory_error_metaspace()          { return gen_out_of_memory_error(_out_of_memory_error_metaspace);   }
 329   static oop out_of_memory_error_class_metaspace()    { return gen_out_of_memory_error(_out_of_memory_error_class_metaspace);   }
 330   static oop out_of_memory_error_array_size()         { return gen_out_of_memory_error(_out_of_memory_error_array_size); }
 331   static oop out_of_memory_error_gc_overhead_limit()  { return gen_out_of_memory_error(_out_of_memory_error_gc_overhead_limit);  }
 332   static oop out_of_memory_error_realloc_objects()    { return gen_out_of_memory_error(_out_of_memory_error_realloc_objects);  }
 333 
 334   // Accessors needed for fast allocation
 335   static Klass** boolArrayKlassObj_addr()           { return &_boolArrayKlassObj;   }
 336   static Klass** byteArrayKlassObj_addr()           { return &_byteArrayKlassObj;   }
 337   static Klass** charArrayKlassObj_addr()           { return &_charArrayKlassObj;   }
 338   static Klass** intArrayKlassObj_addr()            { return &_intArrayKlassObj;    }


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 131   // Primitive objects
 132   static oop _int_mirror;
 133   static oop _float_mirror;
 134   static oop _double_mirror;
 135   static oop _byte_mirror;
 136   static oop _bool_mirror;
 137   static oop _char_mirror;
 138   static oop _long_mirror;
 139   static oop _short_mirror;
 140   static oop _void_mirror;
 141 
 142   static oop          _main_thread_group;             // Reference to the main thread group object
 143   static oop          _system_thread_group;           // Reference to the system thread group object
 144 
 145   static objArrayOop  _the_empty_class_klass_array;   // Canonicalized obj array of type java.lang.Class
 146   static oop          _the_null_string;               // A cache of "null" as a Java string
 147   static oop          _the_min_jint_string;          // A cache of "-2147483648" as a Java string
 148   static LatestMethodCache* _finalizer_register_cache; // static method for registering finalizable objects
 149   static LatestMethodCache* _loader_addClass_cache;    // method for registering loaded classes in class loader vector
 150   static LatestMethodCache* _pd_implies_cache;         // method for checking protection domain attributes
 151   static LatestMethodCache* _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError() method
 152 


 153   // preallocated error objects (no backtrace)
 154   static oop          _out_of_memory_error_java_heap;
 155   static oop          _out_of_memory_error_metaspace;
 156   static oop          _out_of_memory_error_class_metaspace;
 157   static oop          _out_of_memory_error_array_size;
 158   static oop          _out_of_memory_error_gc_overhead_limit;
 159   static oop          _out_of_memory_error_realloc_objects;
 160 
 161   static Array<int>*       _the_empty_int_array;    // Canonicalized int array
 162   static Array<u2>*        _the_empty_short_array;  // Canonicalized short array
 163   static Array<Klass*>*  _the_empty_klass_array;  // Canonicalized klass obj array
 164   static Array<Method*>* _the_empty_method_array; // Canonicalized method obj array
 165 
 166   static Array<Klass*>*  _the_array_interfaces_array;
 167 
 168   // array of preallocated error objects with backtrace
 169   static objArrayOop   _preallocated_out_of_memory_error_array;
 170 
 171   // number of preallocated error objects available for use
 172   static volatile jint _preallocated_out_of_memory_error_avail_count;


 287 
 288   static oop java_mirror(BasicType t) {
 289     assert((uint)t < T_VOID+1, "range check");
 290     return check_mirror(_mirrors[t]);
 291   }
 292   static oop      main_thread_group()                 { return _main_thread_group; }
 293   static void set_main_thread_group(oop group)        { _main_thread_group = group;}
 294 
 295   static oop      system_thread_group()               { return _system_thread_group; }
 296   static void set_system_thread_group(oop group)      { _system_thread_group = group;}
 297 
 298   static objArrayOop  the_empty_class_klass_array ()  { return _the_empty_class_klass_array;   }
 299   static Array<Klass*>* the_array_interfaces_array() { return _the_array_interfaces_array;   }
 300   static oop          the_null_string()               { return _the_null_string;               }
 301   static oop          the_min_jint_string()          { return _the_min_jint_string;          }
 302 
 303   static Method*      finalizer_register_method()     { return _finalizer_register_cache->get_method(); }
 304   static Method*      loader_addClass_method()        { return _loader_addClass_cache->get_method(); }
 305 
 306   static Method*      protection_domain_implies_method() { return _pd_implies_cache->get_method(); }
 307   static Method*      throw_illegal_access_error()    { return _throw_illegal_access_error_cache->get_method(); }
 308 
 309   static oop          null_ptr_exception_instance()   { return _null_ptr_exception_instance;   }
 310   static oop          arithmetic_exception_instance() { return _arithmetic_exception_instance; }
 311   static oop          virtual_machine_error_instance() { return _virtual_machine_error_instance; }
 312   static oop          vm_exception()                  { return _vm_exception; }
 313 
 314   static inline oop   allocation_context_notification_obj();
 315   static inline void  set_allocation_context_notification_obj(oop obj);
 316 


 317   static Array<int>*       the_empty_int_array()    { return _the_empty_int_array; }
 318   static Array<u2>*        the_empty_short_array()  { return _the_empty_short_array; }
 319   static Array<Method*>* the_empty_method_array() { return _the_empty_method_array; }
 320   static Array<Klass*>*  the_empty_klass_array()  { return _the_empty_klass_array; }
 321 
 322   // OutOfMemoryError support. Returns an error with the required message. The returned error
 323   // may or may not have a backtrace. If error has a backtrace then the stack trace is already
 324   // filled in.
 325   static oop out_of_memory_error_java_heap()          { return gen_out_of_memory_error(_out_of_memory_error_java_heap);  }
 326   static oop out_of_memory_error_metaspace()          { return gen_out_of_memory_error(_out_of_memory_error_metaspace);   }
 327   static oop out_of_memory_error_class_metaspace()    { return gen_out_of_memory_error(_out_of_memory_error_class_metaspace);   }
 328   static oop out_of_memory_error_array_size()         { return gen_out_of_memory_error(_out_of_memory_error_array_size); }
 329   static oop out_of_memory_error_gc_overhead_limit()  { return gen_out_of_memory_error(_out_of_memory_error_gc_overhead_limit);  }
 330   static oop out_of_memory_error_realloc_objects()    { return gen_out_of_memory_error(_out_of_memory_error_realloc_objects);  }
 331 
 332   // Accessors needed for fast allocation
 333   static Klass** boolArrayKlassObj_addr()           { return &_boolArrayKlassObj;   }
 334   static Klass** byteArrayKlassObj_addr()           { return &_byteArrayKlassObj;   }
 335   static Klass** charArrayKlassObj_addr()           { return &_charArrayKlassObj;   }
 336   static Klass** intArrayKlassObj_addr()            { return &_intArrayKlassObj;    }