8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass

Converted package() and module() functions to pure virtual functions of Klass

Reviewed-by: dholmes, coleenp, lfoltan, hseigel
This commit is contained in:
Rachel Protacio 2016-04-26 09:08:12 -04:00
parent b788b49698
commit 09add35155
9 changed files with 99 additions and 32 deletions

View file

@ -23,6 +23,8 @@
*/
#include "precompiled.hpp"
#include "classfile/moduleEntry.hpp"
#include "classfile/packageEntry.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
@ -135,14 +137,7 @@ Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data,
// GC walks these as strong roots.
loader_data->add_class(oak);
// The array is defined in the module of its bottom class
Klass* bottom_klass = oak->bottom_klass();
ModuleEntry* module;
if (bottom_klass->is_instance_klass()) {
module = InstanceKlass::cast(bottom_klass)->module();
} else {
module = ModuleEntryTable::javabase_module();
}
ModuleEntry* module = oak->module();
assert(module != NULL, "No module entry for array");
// Call complete_create_array_klass after all instance variables has been initialized.
@ -422,6 +417,16 @@ jint ObjArrayKlass::compute_modifier_flags(TRAPS) const {
| (JVM_ACC_ABSTRACT | JVM_ACC_FINAL);
}
ModuleEntry* ObjArrayKlass::module() const {
assert(bottom_klass() != NULL, "ObjArrayKlass returned unexpected NULL bottom_klass");
// The array is defined in the module of its bottom class
return bottom_klass()->module();
}
PackageEntry* ObjArrayKlass::package() const {
assert(bottom_klass() != NULL, "ObjArrayKlass returned unexpected NULL bottom_klass");
return bottom_klass()->package();
}
// Printing