< prev index next >

src/hotspot/share/classfile/javaClasses.cpp

Print this page




2839 oop java_lang_Module::loader(oop module) {
2840   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
2841   return module->obj_field(loader_offset);
2842 }
2843 
2844 void java_lang_Module::set_loader(oop module, oop value) {
2845   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
2846   module->obj_field_put(loader_offset, value);
2847 }
2848 
2849 oop java_lang_Module::name(oop module) {
2850   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
2851   return module->obj_field(name_offset);
2852 }
2853 
2854 void java_lang_Module::set_name(oop module, oop value) {
2855   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
2856   module->obj_field_put(name_offset, value);
2857 }
2858 
2859 ModuleEntry* java_lang_Module::module_entry(oop module, TRAPS) {
2860   assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
2861   assert(module != NULL, "module can't be null");
2862   assert(oopDesc::is_oop(module), "module must be oop");
2863 
2864   ModuleEntry* module_entry = (ModuleEntry*)module->address_field(_module_entry_offset);
2865   if (module_entry == NULL) {
2866     // If the inject field containing the ModuleEntry* is null then return the
2867     // class loader's unnamed module.
2868     oop loader = java_lang_Module::loader(module);
2869     Handle h_loader = Handle(THREAD, loader);
2870     ClassLoaderData* loader_cld = SystemDictionary::register_loader(h_loader, CHECK_NULL);
2871     return loader_cld->unnamed_module();
2872   }
2873   return module_entry;
2874 }
2875 
2876 void java_lang_Module::set_module_entry(oop module, ModuleEntry* module_entry) {
2877   assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
2878   assert(module != NULL, "module can't be null");
2879   assert(oopDesc::is_oop(module), "module must be oop");
2880   module->address_field_put(_module_entry_offset, (address)module_entry);
2881 }
2882 
2883 Handle reflect_ConstantPool::create(TRAPS) {
2884   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
2885   InstanceKlass* k = SystemDictionary::reflect_ConstantPool_klass();
2886   // Ensure it is initialized
2887   k->initialize(CHECK_NH);
2888   return k->allocate_instance_handle(THREAD);
2889 }
2890 




2839 oop java_lang_Module::loader(oop module) {
2840   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
2841   return module->obj_field(loader_offset);
2842 }
2843 
2844 void java_lang_Module::set_loader(oop module, oop value) {
2845   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
2846   module->obj_field_put(loader_offset, value);
2847 }
2848 
2849 oop java_lang_Module::name(oop module) {
2850   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
2851   return module->obj_field(name_offset);
2852 }
2853 
2854 void java_lang_Module::set_name(oop module, oop value) {
2855   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
2856   module->obj_field_put(name_offset, value);
2857 }
2858 
2859 ModuleEntry* java_lang_Module::module_entry(oop module) {
2860   assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
2861   assert(module != NULL, "module can't be null");
2862   assert(oopDesc::is_oop(module), "module must be oop");
2863 
2864   ModuleEntry* module_entry = (ModuleEntry*)module->address_field(_module_entry_offset);
2865   if (module_entry == NULL) {
2866     // If the inject field containing the ModuleEntry* is null then return the
2867     // class loader's unnamed module.
2868     oop loader = java_lang_Module::loader(module);
2869     Handle h_loader = Handle(Thread::current(), loader);
2870     ClassLoaderData* loader_cld = SystemDictionary::register_loader(h_loader);
2871     return loader_cld->unnamed_module();
2872   }
2873   return module_entry;
2874 }
2875 
2876 void java_lang_Module::set_module_entry(oop module, ModuleEntry* module_entry) {
2877   assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
2878   assert(module != NULL, "module can't be null");
2879   assert(oopDesc::is_oop(module), "module must be oop");
2880   module->address_field_put(_module_entry_offset, (address)module_entry);
2881 }
2882 
2883 Handle reflect_ConstantPool::create(TRAPS) {
2884   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
2885   InstanceKlass* k = SystemDictionary::reflect_ConstantPool_klass();
2886   // Ensure it is initialized
2887   k->initialize(CHECK_NH);
2888   return k->allocate_instance_handle(THREAD);
2889 }
2890 


< prev index next >