src/share/vm/classfile/systemDictionary.hpp

Print this page




   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  *
  23  */
  24 











  25 // The system dictionary stores all loaded classes and maps:
  26 //
  27 //   [class name,class loader] -> class   i.e.  [symbolOop,oop] -> klassOop
  28 //
  29 // Classes are loaded lazily. The default VM class loader is
  30 // represented as NULL.
  31 
  32 // The underlying data structure is an open hash table with a fixed number
  33 // of buckets. During loading the loader object is locked, (for the VM loader
  34 // a private lock object is used). Class loading can thus be done concurrently,
  35 // but only by different loaders.
  36 //
  37 // During loading a placeholder (name, loader) is temporarily placed in
  38 // a side data structure, and is used to detect ClassCircularityErrors
  39 // and to perform verification during GC.  A GC can occur in the midst
  40 // of class loading, as we call out to Java, have to take locks, etc.
  41 //
  42 // When class loading is finished, a new entry is added to the system
  43 // dictionary and the place holder is removed. Note that the protection
  44 // domain field of the system dictionary has not yet been filled in when


 654   static oop  _java_system_loader;
 655 
 656   static bool _has_loadClassInternal;
 657   static bool _has_checkPackageAccess;
 658 };
 659 
 660 // Cf. vmSymbols vs. vmSymbolHandles
 661 class SystemDictionaryHandles : AllStatic {
 662 public:
 663   #define WK_KLASS_HANDLE_DECLARE(name, ignore_symbol, option) \
 664     static KlassHandle name() { \
 665       SystemDictionary::name(); \
 666       klassOop* loc = &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]; \
 667       return KlassHandle(loc, true); \
 668     }
 669   WK_KLASSES_DO(WK_KLASS_HANDLE_DECLARE);
 670   #undef WK_KLASS_HANDLE_DECLARE
 671 
 672   static KlassHandle box_klass(BasicType t);
 673 };




   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  *
  23  */
  24 
  25 #ifndef SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_HPP
  26 #define SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_HPP
  27 
  28 #include "classfile/classFileStream.hpp"
  29 #include "classfile/classLoader.hpp"
  30 #include "oops/objArrayOop.hpp"
  31 #include "oops/symbolOop.hpp"
  32 #include "runtime/java.hpp"
  33 #include "runtime/reflectionUtils.hpp"
  34 #include "utilities/hashtable.hpp"
  35 
  36 // The system dictionary stores all loaded classes and maps:
  37 //
  38 //   [class name,class loader] -> class   i.e.  [symbolOop,oop] -> klassOop
  39 //
  40 // Classes are loaded lazily. The default VM class loader is
  41 // represented as NULL.
  42 
  43 // The underlying data structure is an open hash table with a fixed number
  44 // of buckets. During loading the loader object is locked, (for the VM loader
  45 // a private lock object is used). Class loading can thus be done concurrently,
  46 // but only by different loaders.
  47 //
  48 // During loading a placeholder (name, loader) is temporarily placed in
  49 // a side data structure, and is used to detect ClassCircularityErrors
  50 // and to perform verification during GC.  A GC can occur in the midst
  51 // of class loading, as we call out to Java, have to take locks, etc.
  52 //
  53 // When class loading is finished, a new entry is added to the system
  54 // dictionary and the place holder is removed. Note that the protection
  55 // domain field of the system dictionary has not yet been filled in when


 665   static oop  _java_system_loader;
 666 
 667   static bool _has_loadClassInternal;
 668   static bool _has_checkPackageAccess;
 669 };
 670 
 671 // Cf. vmSymbols vs. vmSymbolHandles
 672 class SystemDictionaryHandles : AllStatic {
 673 public:
 674   #define WK_KLASS_HANDLE_DECLARE(name, ignore_symbol, option) \
 675     static KlassHandle name() { \
 676       SystemDictionary::name(); \
 677       klassOop* loc = &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]; \
 678       return KlassHandle(loc, true); \
 679     }
 680   WK_KLASSES_DO(WK_KLASS_HANDLE_DECLARE);
 681   #undef WK_KLASS_HANDLE_DECLARE
 682 
 683   static KlassHandle box_klass(BasicType t);
 684 };
 685 
 686 #endif // SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_HPP