1 /* |
1 /* |
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
79 } |
79 } |
80 } |
80 } |
81 |
81 |
82 // Returns the shared ProtectionDomain |
82 // Returns the shared ProtectionDomain |
83 Handle ModuleEntry::shared_protection_domain() { |
83 Handle ModuleEntry::shared_protection_domain() { |
84 return Handle(JNIHandles::resolve(_pd)); |
84 return Handle(Thread::current(), JNIHandles::resolve(_pd)); |
85 } |
85 } |
86 |
86 |
87 // Set the shared ProtectionDomain atomically |
87 // Set the shared ProtectionDomain atomically |
88 void ModuleEntry::set_shared_protection_domain(ClassLoaderData *loader_data, |
88 void ModuleEntry::set_shared_protection_domain(ClassLoaderData *loader_data, |
89 Handle pd_h) { |
89 Handle pd_h) { |
267 // Each ModuleEntryTable has exactly one unnamed module |
267 // Each ModuleEntryTable has exactly one unnamed module |
268 if (loader_data->is_the_null_class_loader_data()) { |
268 if (loader_data->is_the_null_class_loader_data()) { |
269 // For the boot loader, the java.lang.reflect.Module for the unnamed module |
269 // For the boot loader, the java.lang.reflect.Module for the unnamed module |
270 // is not known until a call to JVM_SetBootLoaderUnnamedModule is made. At |
270 // is not known until a call to JVM_SetBootLoaderUnnamedModule is made. At |
271 // this point initially create the ModuleEntry for the unnamed module. |
271 // this point initially create the ModuleEntry for the unnamed module. |
272 _unnamed_module = new_entry(0, Handle(NULL), NULL, NULL, NULL, loader_data); |
272 _unnamed_module = new_entry(0, Handle(), NULL, NULL, NULL, loader_data); |
273 } else { |
273 } else { |
274 // For all other class loaders the java.lang.reflect.Module for their |
274 // For all other class loaders the java.lang.reflect.Module for their |
275 // corresponding unnamed module can be found in the java.lang.ClassLoader object. |
275 // corresponding unnamed module can be found in the java.lang.ClassLoader object. |
276 oop module = java_lang_ClassLoader::unnamedModule(loader_data->class_loader()); |
276 oop module = java_lang_ClassLoader::unnamedModule(loader_data->class_loader()); |
277 _unnamed_module = new_entry(0, Handle(module), NULL, NULL, NULL, loader_data); |
277 _unnamed_module = new_entry(0, Handle(Thread::current(), module), NULL, NULL, NULL, loader_data); |
278 |
278 |
279 // Store pointer to the ModuleEntry in the unnamed module's java.lang.reflect.Module |
279 // Store pointer to the ModuleEntry in the unnamed module's java.lang.reflect.Module |
280 // object. |
280 // object. |
281 java_lang_reflect_Module::set_module_entry(module, _unnamed_module); |
281 java_lang_reflect_Module::set_module_entry(module, _unnamed_module); |
282 } |
282 } |