< prev index next >

src/hotspot/share/classfile/vmClasses.cpp

Print this page

  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 #include "precompiled.hpp"
 26 #include "cds/archiveHeapLoader.hpp"
 27 #include "cds/cdsConfig.hpp"

 28 #include "classfile/classLoader.hpp"
 29 #include "classfile/classLoaderData.hpp"
 30 #include "classfile/dictionary.hpp"
 31 #include "classfile/javaClasses.hpp"
 32 #include "classfile/systemDictionary.hpp"
 33 #include "classfile/vmClasses.hpp"
 34 #include "classfile/vmSymbols.hpp"
 35 #include "gc/shared/collectedHeap.hpp"
 36 #include "memory/metaspaceClosure.hpp"
 37 #include "memory/universe.hpp"
 38 #include "oops/instanceKlass.hpp"
 39 #include "oops/instanceRefKlass.hpp"
 40 #include "oops/instanceStackChunkKlass.hpp"
 41 #include "prims/jvmtiExport.hpp"
 42 #include "runtime/globals.hpp"
 43 
 44 InstanceKlass* vmClasses::_klasses[static_cast<int>(vmClassID::LIMIT)]
 45                                                  =  { nullptr /*, nullptr...*/ };
 46 InstanceKlass* vmClasses::_box_klasses[T_VOID+1] =  { nullptr /*, nullptr...*/ };
 47 

193   _box_klasses[T_CHAR]    = vmClasses::Character_klass();
194   _box_klasses[T_FLOAT]   = vmClasses::Float_klass();
195   _box_klasses[T_DOUBLE]  = vmClasses::Double_klass();
196   _box_klasses[T_BYTE]    = vmClasses::Byte_klass();
197   _box_klasses[T_SHORT]   = vmClasses::Short_klass();
198   _box_klasses[T_INT]     = vmClasses::Integer_klass();
199   _box_klasses[T_LONG]    = vmClasses::Long_klass();
200 
201 #ifdef ASSERT
202   if (CDSConfig::is_using_archive()) {
203     JVMTI_ONLY(assert(JvmtiExport::is_early_phase(),
204                       "All well known classes must be resolved in JVMTI early phase"));
205     for (auto id : EnumRange<vmClassID>{}) {
206       InstanceKlass* k = _klasses[as_int(id)];
207       assert(k->is_shared(), "must not be replaced by JVMTI class file load hook");
208     }
209   }
210 #endif
211 
212   InstanceStackChunkKlass::init_offset_of_stack();



213 }
214 
215 #if INCLUDE_CDS
216 
217 void vmClasses::resolve_shared_class(InstanceKlass* klass, ClassLoaderData* loader_data, Handle domain, TRAPS) {
218   assert(!Universe::is_fully_initialized(), "We can make short cuts only during VM initialization");
219   assert(klass->is_shared(), "Must be shared class");
220   if (klass->class_loader_data() != nullptr) {
221     return;
222   }
223 
224   // add super and interfaces first
225   Klass* super = klass->super();
226   if (super != nullptr && super->class_loader_data() == nullptr) {
227     assert(super->is_instance_klass(), "Super should be instance klass");
228     resolve_shared_class(InstanceKlass::cast(super), loader_data, domain, CHECK);
229   }
230 
231   Array<InstanceKlass*>* ifs = klass->local_interfaces();
232   for (int i = 0; i < ifs->length(); i++) {

  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 #include "precompiled.hpp"
 26 #include "cds/archiveHeapLoader.hpp"
 27 #include "cds/cdsConfig.hpp"
 28 #include "cds/aotLinkedClassBulkLoader.hpp"
 29 #include "classfile/classLoader.hpp"
 30 #include "classfile/classLoaderData.hpp"
 31 #include "classfile/dictionary.hpp"
 32 #include "classfile/javaClasses.hpp"
 33 #include "classfile/systemDictionary.hpp"
 34 #include "classfile/vmClasses.hpp"
 35 #include "classfile/vmSymbols.hpp"
 36 #include "gc/shared/collectedHeap.hpp"
 37 #include "memory/metaspaceClosure.hpp"
 38 #include "memory/universe.hpp"
 39 #include "oops/instanceKlass.hpp"
 40 #include "oops/instanceRefKlass.hpp"
 41 #include "oops/instanceStackChunkKlass.hpp"
 42 #include "prims/jvmtiExport.hpp"
 43 #include "runtime/globals.hpp"
 44 
 45 InstanceKlass* vmClasses::_klasses[static_cast<int>(vmClassID::LIMIT)]
 46                                                  =  { nullptr /*, nullptr...*/ };
 47 InstanceKlass* vmClasses::_box_klasses[T_VOID+1] =  { nullptr /*, nullptr...*/ };
 48 

194   _box_klasses[T_CHAR]    = vmClasses::Character_klass();
195   _box_klasses[T_FLOAT]   = vmClasses::Float_klass();
196   _box_klasses[T_DOUBLE]  = vmClasses::Double_klass();
197   _box_klasses[T_BYTE]    = vmClasses::Byte_klass();
198   _box_klasses[T_SHORT]   = vmClasses::Short_klass();
199   _box_klasses[T_INT]     = vmClasses::Integer_klass();
200   _box_klasses[T_LONG]    = vmClasses::Long_klass();
201 
202 #ifdef ASSERT
203   if (CDSConfig::is_using_archive()) {
204     JVMTI_ONLY(assert(JvmtiExport::is_early_phase(),
205                       "All well known classes must be resolved in JVMTI early phase"));
206     for (auto id : EnumRange<vmClassID>{}) {
207       InstanceKlass* k = _klasses[as_int(id)];
208       assert(k->is_shared(), "must not be replaced by JVMTI class file load hook");
209     }
210   }
211 #endif
212 
213   InstanceStackChunkKlass::init_offset_of_stack();
214   if (CDSConfig::is_using_aot_linked_classes()) {
215     AOTLinkedClassBulkLoader::load_javabase_boot_classes(THREAD);
216   }
217 }
218 
219 #if INCLUDE_CDS
220 
221 void vmClasses::resolve_shared_class(InstanceKlass* klass, ClassLoaderData* loader_data, Handle domain, TRAPS) {
222   assert(!Universe::is_fully_initialized(), "We can make short cuts only during VM initialization");
223   assert(klass->is_shared(), "Must be shared class");
224   if (klass->class_loader_data() != nullptr) {
225     return;
226   }
227 
228   // add super and interfaces first
229   Klass* super = klass->super();
230   if (super != nullptr && super->class_loader_data() == nullptr) {
231     assert(super->is_instance_klass(), "Super should be instance klass");
232     resolve_shared_class(InstanceKlass::cast(super), loader_data, domain, CHECK);
233   }
234 
235   Array<InstanceKlass*>* ifs = klass->local_interfaces();
236   for (int i = 0; i < ifs->length(); i++) {
< prev index next >