diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp index a70048a5087..bf418769cdb 100644 --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -1399,10 +1399,8 @@ void java_lang_Class::set_signers(oop java_class, objArrayOop signers) { void java_lang_Class::set_class_loader(oop java_class, oop loader) { - // jdk7 runs Queens in bootstrapping and jdk8-9 has no coordinated pushes yet. - if (_class_loader_offset != 0) { - java_class->obj_field_put(_class_loader_offset, loader); - } + assert(_class_loader_offset != 0, "offsets should have been initialized"); + java_class->obj_field_put(_class_loader_offset, loader); } oop java_lang_Class::class_loader(oop java_class) { @@ -1633,20 +1631,12 @@ void java_lang_Class::serialize_offsets(SerializeClosure* f) { #endif int java_lang_Class::classRedefinedCount(oop the_class_mirror) { - if (classRedefinedCount_offset == -1) { - // If we don't have an offset for it then just return -1 as a marker. - return -1; - } - + assert(classRedefinedCount_offset != -1, "offsets should have been initialized"); return the_class_mirror->int_field(classRedefinedCount_offset); } void java_lang_Class::set_classRedefinedCount(oop the_class_mirror, int value) { - if (classRedefinedCount_offset == -1) { - // If we don't have an offset for it then nothing to set. - return; - } - + assert(classRedefinedCount_offset != -1, "offsets should have been initialized"); the_class_mirror->int_field_put(classRedefinedCount_offset, value); } @@ -4044,6 +4034,7 @@ void java_security_AccessControlContext::serialize_offsets(SerializeClosure* f) oop java_security_AccessControlContext::create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS) { assert(_isPrivileged_offset != 0, "offsets should have been initialized"); + assert(_isAuthorized_offset != -1, "offsets should have been initialized"); // Ensure klass is initialized SystemDictionary::AccessControlContext_klass()->initialize(CHECK_0); // Allocate result @@ -4052,10 +4043,8 @@ oop java_security_AccessControlContext::create(objArrayHandle context, bool isPr result->obj_field_put(_context_offset, context()); result->obj_field_put(_privilegedContext_offset, privileged_context()); result->bool_field_put(_isPrivileged_offset, isPrivileged); - // whitelist AccessControlContexts created by the JVM if present - if (_isAuthorized_offset != -1) { - result->bool_field_put(_isAuthorized_offset, true); - } + // whitelist AccessControlContexts created by the JVM + result->bool_field_put(_isAuthorized_offset, true); return result; } @@ -4159,10 +4148,7 @@ bool java_lang_ClassLoader::is_instance(oop obj) { // based on non-null field // Written to by java.lang.ClassLoader, vm only reads this field, doesn't set it bool java_lang_ClassLoader::parallelCapable(oop class_loader) { - if (parallelCapable_offset == -1) { - // Default for backward compatibility is false - return false; - } + assert(parallelCapable_offset != -1, "offsets should have been initialized"); return (class_loader->obj_field(parallelCapable_offset) != NULL); }