@@ -709,47 +709,50 @@ classInitStateMachine(J9VMThread *currentThread, J9Class *clazz, J9ClassInitStat
709709 J9ITable *superITable = NULL ;
710710 J9ITable *firstITable = NULL ;
711711 J9ITable *iTable = NULL ;
712- if (NULL != superclazz) {
713- Trc_VM_classInitStateMachine_initSuperclass (currentThread);
714- PUSH_OBJECT_IN_SPECIAL_FRAME (currentThread, initializationLock);
715- classInitStateMachine (currentThread, superclazz, J9_CLASS_INIT_INITIALIZED );
716- initializationLock = POP_OBJECT_IN_SPECIAL_FRAME (currentThread);
717- clazz = VM_VMHelpers::currentClass (clazz);
718- superclazz = VM_VMHelpers::getSuperclass (clazz);
719- if (VM_VMHelpers::exceptionPending (currentThread)) {
720- goto initFailed;
712+
713+ /* Do not initialize the superclass java.lang.Object of interfaces */
714+ if (!J9ROMCLASS_IS_INTERFACE (clazz->romClass )) {
715+ if (NULL != superclazz) {
716+ Trc_VM_classInitStateMachine_initSuperclass (currentThread);
717+ PUSH_OBJECT_IN_SPECIAL_FRAME (currentThread, initializationLock);
718+ classInitStateMachine (currentThread, superclazz, J9_CLASS_INIT_INITIALIZED );
719+ initializationLock = POP_OBJECT_IN_SPECIAL_FRAME (currentThread);
720+ clazz = VM_VMHelpers::currentClass (clazz);
721+ superclazz = VM_VMHelpers::getSuperclass (clazz);
722+ if (VM_VMHelpers::exceptionPending (currentThread)) {
723+ goto initFailed;
724+ }
725+ superITable = (J9ITable*)superclazz->iTable ;
721726 }
722- superITable = (J9ITable*)superclazz->iTable ;
723727 }
724- /* Do not initialize the superinterfaces of interfaces */
725- if (!J9_ARE_ANY_BITS_SET (clazz->romClass ->modifiers , J9AccInterface)) {
726- /* Initialize super-interfaces with non-static, non-abstract methods */
727- Trc_VM_classInitStateMachine_initSuperInterfacesWithNonStaticNonAbstractMethods (currentThread, clazz);
728- /* Don't traverse all iTables - indirect super-interfaces are initialized with the superclass */
729- firstITable = (J9ITable*)clazz->iTable ;
730- iTable = firstITable;
731- while (iTable != superITable) {
732- J9Class *interfaceClazz = iTable->interfaceClass ;
733- if (J9_ARE_ANY_BITS_SET (interfaceClazz->romClass ->extraModifiers , J9AccClassHasNonStaticNonAbstractMethods)) {
734- PUSH_OBJECT_IN_SPECIAL_FRAME (currentThread, initializationLock);
735- classInitStateMachine (currentThread, interfaceClazz, J9_CLASS_INIT_INITIALIZED );
736- initializationLock = POP_OBJECT_IN_SPECIAL_FRAME (currentThread);
737- clazz = VM_VMHelpers::currentClass (clazz);
738- if (VM_VMHelpers::exceptionPending (currentThread)) {
739- goto initFailed;
740- }
741- /* Ensure that we are still traversing a valid iTable chain */
742- if (firstITable != (J9ITable*)clazz->iTable ) {
743- iTable = (J9ITable*)clazz->iTable ;
744- if (NULL != superclazz) {
745- superclazz = VM_VMHelpers::getSuperclass (clazz);
746- superITable = (J9ITable*)superclazz->iTable ;
747- }
748- continue ;
728+
729+ /* Initialize super-interfaces with non-static, non-abstract methods */
730+ Trc_VM_classInitStateMachine_initSuperInterfacesWithNonStaticNonAbstractMethods (currentThread, clazz);
731+ /* Don't traverse all iTables - indirect super-interfaces are initialized with the superclass */
732+ firstITable = (J9ITable*)clazz->iTable ;
733+ iTable = firstITable;
734+ while (iTable != superITable) {
735+ J9Class *interfaceClazz = iTable->interfaceClass ;
736+
737+ if (J9_ARE_ANY_BITS_SET (interfaceClazz->romClass ->extraModifiers , J9AccClassHasNonStaticNonAbstractMethods)) {
738+ PUSH_OBJECT_IN_SPECIAL_FRAME (currentThread, initializationLock);
739+ classInitStateMachine (currentThread, interfaceClazz, J9_CLASS_INIT_INITIALIZED );
740+ initializationLock = POP_OBJECT_IN_SPECIAL_FRAME (currentThread);
741+ clazz = VM_VMHelpers::currentClass (clazz);
742+ if (VM_VMHelpers::exceptionPending (currentThread)) {
743+ goto initFailed;
744+ }
745+ /* Ensure that we are still traversing a valid iTable chain */
746+ if (firstITable != (J9ITable*)clazz->iTable ) {
747+ iTable = (J9ITable*)clazz->iTable ;
748+ if (NULL != superclazz) {
749+ superclazz = VM_VMHelpers::getSuperclass (clazz);
750+ superITable = (J9ITable*)superclazz->iTable ;
749751 }
752+ continue ;
750753 }
751- iTable = iTable->next ;
752754 }
755+ iTable = iTable->next ;
753756 }
754757
755758#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
0 commit comments