< prev index next >
src/hotspot/share/classfile/javaClasses.cpp
Print this page
@@ -137,13 +137,13 @@
// Helpful routine for computing field offsets at run time rather than hardcoding them
// Finds local fields only, including static fields. Static field offsets are from the
// beginning of the mirror.
-static void compute_offset(int &dest_offset,
+void JavaClasses::compute_offset(int &dest_offset,
InstanceKlass* ik, Symbol* name_symbol, Symbol* signature_symbol,
- bool is_static = false) {
+ bool is_static) {
fieldDescriptor fd;
if (ik == NULL) {
ResourceMark rm;
log_error(class)("Mismatch JDK version for field: %s type: %s", name_symbol->as_C_string(), signature_symbol->as_C_string());
vm_exit_during_initialization("Invalid layout of well-known class");
@@ -163,13 +163,13 @@
}
dest_offset = fd.offset();
}
// Overloading to pass name as a string.
-static void compute_offset(int& dest_offset, InstanceKlass* ik,
+void JavaClasses::compute_offset(int& dest_offset, InstanceKlass* ik,
const char* name_string, Symbol* signature_symbol,
- bool is_static = false) {
+ bool is_static) {
TempNewSymbol name = SymbolTable::probe(name_string, (int)strlen(name_string));
if (name == NULL) {
ResourceMark rm;
log_error(class)("Name %s should be in the SymbolTable since its class is loaded", name_string);
vm_exit_during_initialization("Invalid layout of well-known class", ik->external_name());
@@ -182,11 +182,11 @@
#define FIELD_SERIALIZE_OFFSET(offset, klass, name, signature, is_static) \
f->do_u4((u4*)&offset)
#endif
#define FIELD_COMPUTE_OFFSET(offset, klass, name, signature, is_static) \
- compute_offset(offset, klass, name, vmSymbols::signature(), is_static)
+ JavaClasses::compute_offset(offset, klass, name, vmSymbols::signature(), is_static)
// java_lang_String
int java_lang_String::_value_offset;
@@ -3411,16 +3411,21 @@
void java_lang_Module::set_name(oop module, oop value) {
module->obj_field_put(_name_offset, value);
}
-ModuleEntry* java_lang_Module::module_entry(oop module) {
+ModuleEntry* java_lang_Module::module_entry_raw(oop module) {
assert(_module_entry_offset != 0, "Uninitialized module_entry_offset");
assert(module != NULL, "module can't be null");
assert(oopDesc::is_oop(module), "module must be oop");
ModuleEntry* module_entry = (ModuleEntry*)module->address_field(_module_entry_offset);
+ return module_entry;
+}
+
+ModuleEntry* java_lang_Module::module_entry(oop module) {
+ ModuleEntry* module_entry = module_entry_raw(module);
if (module_entry == NULL) {
// If the inject field containing the ModuleEntry* is null then return the
// class loader's unnamed module.
oop loader = java_lang_Module::loader(module);
Handle h_loader = Handle(Thread::current(), loader);
@@ -4840,11 +4845,10 @@
#if INCLUDE_CDS_JAVA_HEAP
bool JavaClasses::is_supported_for_archiving(oop obj) {
Klass* klass = obj->klass();
if (klass == SystemDictionary::ClassLoader_klass() || // ClassLoader::loader_data is malloc'ed.
- klass == SystemDictionary::Module_klass() || // Module::module_entry is malloc'ed
// The next 3 classes are used to implement java.lang.invoke, and are not used directly in
// regular Java code. The implementation of java.lang.invoke uses generated anonymoys classes
// (e.g., as referenced by ResolvedMethodName::vmholder) that are not yet supported by CDS.
// So for now we cannot not support these classes for archiving.
//
< prev index next >