Remove Implicit creation work - #22975
Conversation
| } | ||
| if (J9ROMClassHelper.hasImplicitCreationAttribute(romClass)) { | ||
| classWalkerCallback.addSlot(clazz, SlotType.J9_SRP, cursor, "implicitCreationAttributeSRP"); | ||
| implicitCreationAttributeDo(U32Pointer.cast(cursor.get())); |
There was a problem hiding this comment.
The implicitCreationAttributeDo should also be removed.
| rangeValid = callbacks->validateRangeCallback(romClass, cursor, sizeof(J9SRP), userData); | ||
| if (rangeValid) { | ||
| callbacks->slotCallback(romClass, J9ROM_SRP, cursor, "implicitCreationAttributeSRP", userData); | ||
| allSlotsInImplicitCreationAttributeDo(romClass, SRP_PTR_GET(cursor, U_32*), callbacks, userData); |
There was a problem hiding this comment.
The allSlotsInImplicitCreationAttributeDo method should also be removed.
| _isClassValueBased = true; | ||
| } | ||
| #if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) | ||
| if (containsKnownAnnotation(foundAnnotations, LOOSELYCONSISTENTVALUE_ANNOTATION)) { |
There was a problem hiding this comment.
You can remove all the references to LOOSELYCONSISTENTVALUE_ANNOTATION as well since we aren't doing anything with it right now.
| #if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) | ||
| if (J9_ARE_ALL_BITS_SET(_romClass->optionalFlags, J9_ROMCLASS_OPTINFO_IMPLICITCREATION_ATTRIBUTE)) { | ||
| U_32 implicitCreationFlags = (U_32)getImplicitCreationFlags(_romClass); | ||
| addEntry((void*) &IMPLICITCREATION, 0, CFR_CONSTANT_Utf8); |
There was a problem hiding this comment.
Remove the IMPLICITCREATION definition in line 71.
| ROMClassWriter::writeImplicitCreation(Cursor *cursor, bool markAndCountOnly) | ||
| { | ||
| if (_classFileOracle->hasImplicitCreation()) { | ||
| cursor->mark(_implicitCreationSRPKey); |
There was a problem hiding this comment.
Remove _implicitCreationSRPKey from line 327.
| @@ -193,8 +193,5 @@ | |||
| (J9StaticFieldRefStrictInitWritten == ((classAndFlags) & J9StaticFieldRefStrictInitMask)) | |||
| #endif /* defined(J9VM_OPT_VALHALLA_STRICT_FIELDS) */ | |||
|
|
|||
There was a problem hiding this comment.
Please remove the extra space here as well.
| #define J9_ROMCLASS_OPTINFO_LOADABLEDESCRIPTORS_ATTRIBUTE 0x20000 | ||
| #endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ | ||
| #if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) | ||
| #define J9_ROMCLASS_OPTINFO_IMPLICITCREATION_ATTRIBUTE 0x40000 |
There was a problem hiding this comment.
Instead of removing this rename it as UNUSED like the other values below.
| # END NON-TRANSLATABLE | ||
|
|
||
| # NullRestricted is not translatable | ||
| J9NLS_VM_NULLRESTRICTED_MUST_BE_IN_DEFAULT_IMPLICITCREATION_VALUE_CLASS=An instance field with a NullRestricted attribute must be in a value class with an implicit constructor |
There was a problem hiding this comment.
You can't rename NLS messages, create a new one at the end of the file.
| U_8 *elementAddress = (U_8*)indexableEffectiveAddress(vmThread, arrayRef, index, J9ARRAYCLASS_GET_STRIDE((J9Class *) arrayClazz)); | ||
| IDATA elementOffset = (elementAddress - (U_8*)arrayRef); | ||
| J9Class *elementClazz = J9GC_J9OBJECT_CLAZZ_THREAD(srcObject, vmThread); | ||
| Assert_MM_true(J9_IS_J9CLASS_ALLOW_DEFAULT_VALUE(elementClazz)); |
There was a problem hiding this comment.
Instead of removing these I think we can at least check that elementClazz is a value class.
| * Don't try to initialize class for null-restricted array creation since | ||
| * the regular arrayClass will always be created first. | ||
| */ | ||
| if (J9_IS_J9CLASS_ALLOW_DEFAULT_VALUE(elementClass) |
There was a problem hiding this comment.
Please update the comment above this line as well.
d1a364b to
96a5772
Compare
theresa-m
left a comment
There was a problem hiding this comment.
Second pass. Please also remove the ImplicitCreationAttribute class in ValhallaUtils.java.
| inline | ||
| #endif | ||
| #endif | ||
| static size_t |
There was a problem hiding this comment.
please remove the type changes here and line 188.
| return len + asso_values[(unsigned char)str[1]]; | ||
| } | ||
|
|
||
| #ifdef __GNUC__ |
There was a problem hiding this comment.
please keep this unchanged.
| offset = address; | ||
| goto _errorFound; | ||
| } | ||
| implicitCreationAttributeRead = TRUE; |
There was a problem hiding this comment.
Please remove the implicitCreationAttributeRead declaration.
| } | ||
|
|
||
| #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) | ||
| if (valueTypeClass) { |
There was a problem hiding this comment.
Did you mean to remove this?
| IDATA elementOffset = (elementAddress - (U_8*)arrayRef); | ||
| J9Class *elementClazz = J9GC_J9OBJECT_CLAZZ_THREAD(srcObject, vmThread); | ||
| Assert_MM_true(J9_IS_J9CLASS_ALLOW_DEFAULT_VALUE(elementClazz)); | ||
| Assert_MM_true(J9_IS_J9CLASS_VALUEBASED(elementClazz)); |
There was a problem hiding this comment.
You're looking for J9_IS_J9CLASS_VALUETYPE here. J9_IS_J9CLASS_VALUEBASED refers to the ValueBased annotation.
| J9NLS_CFR_ERR_PRELOAD_CLASS_ENTRY_NOT_CLASS_TYPE.user_response=Contact the provider of the classfile for a corrected version. | ||
| # END NON-TRANSLATABLE | ||
|
|
||
| # ImplicitCreation is not translatable |
There was a problem hiding this comment.
Please don't remove these, see notes at the top of the file.
| J9NLS_VM_CRIU_RESTORE_RESET_VIRTUALTHREAD_FORKJOINPOOL_PARALLELISM_INVALID_PARALLELISM_OFFSET.user_response=View CRIU documentation to determine how to resolve the exception. | ||
| # END NON-TRANSLATABLE | ||
|
|
||
| # NullRestricted is not translatable |
There was a problem hiding this comment.
These can't be removed, see notes at the top of the file.
| #endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ | ||
| #if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) | ||
| #define J9_ROMCLASS_OPTINFO_IMPLICITCREATION_ATTRIBUTE 0x40000 | ||
| #define J9_ROMCLASS_OPTINFO_IMPLICITCREATION_ATTRIBUTE_UNUSED_40000 0x40000 |
There was a problem hiding this comment.
J9_ROMCLASS_OPTINFO_IMPLICITCREATION_ATTRIBUTE_UNUSED_40000 -> J9_ROMCLASS_OPTINFO_UNUSED_40000
| #endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ | ||
| #if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) | ||
| if (_classFileOracle->hasImplicitCreation()) { | ||
| cursor->writeSRP(_implicitCreationSRPKey, Cursor::SRP_TO_GENERIC); |
There was a problem hiding this comment.
Please remove the declaration for _implicitCreationSRPKey as well as the comment SRP to ImplicitCreation attribute in ROMClassWriter.cpp.
| /* A class may have no more than one ImplicitCreation attribute. */ | ||
| @Test(expectedExceptions = java.lang.ClassFormatError.class, expectedExceptionsMessageRegExp = ".*Multiple ImplicitCreation attributes.*") | ||
| public static void testMultipleImplicitCreationAttributes() throws Throwable { | ||
| ValhallaAttributeGenerator.generateClassWithTwoImplicitCreationAttributes("MultiImplicitCreationAttributes"); |
There was a problem hiding this comment.
Please remove the ValhallaAttributeGenerator functions corresponding to the removed tests such as ValhallaAttributeGenerator.generateClassWithTwoImplicitCreationAttributes.
| if (!J9ROMCLASS_IS_VALUE(valueROMClass) | ||
| || J9_ARE_NO_BITS_SET(valueROMClass->optionalFlags, J9_ROMCLASS_OPTINFO_IMPLICITCREATION_ATTRIBUTE) | ||
| || J9_ARE_NO_BITS_SET(getImplicitCreationFlags(valueROMClass), J9AccImplicitCreateHasDefaultValue) | ||
| ) { |
There was a problem hiding this comment.
Please move this to the same line as the if statement.
| if (J9_ARE_ALL_BITS_SET(romClass->optionalFlags, J9_ROMCLASS_OPTINFO_IMPLICITCREATION_ATTRIBUTE)) { | ||
| U_16 implicitCreationFlags = getImplicitCreationFlags(romClass); | ||
| if (J9_ARE_ALL_BITS_SET(implicitCreationFlags, J9AccImplicitCreateNonAtomic)) { | ||
| classFlags |= J9ClassAllowsNonAtomicCreation; |
There was a problem hiding this comment.
Remove the definition of J9ClassAllowsNonAtomicCreation and comment referencing it in on line 3363.
There was a problem hiding this comment.
Please remove references to J9ClassIsPrimitiveValueType as well while you are here, this is very out of date. Chatting with Aditi and this is staying in for now due to references in the jit.
| } | ||
| } | ||
| #if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) | ||
| if (J9_ARE_ALL_BITS_SET(classFlags, J9ClassAllowsInitialDefaultValue)) { |
There was a problem hiding this comment.
This logic is still needed to measure classes for flattening. Instead of checking for J9ClassAllowsInitialDefaultValue this should be done for all value classes.
| classFlags |= J9ClassAllowsNonAtomicCreation; | ||
| } | ||
| if (J9_ARE_ALL_BITS_SET(implicitCreationFlags, J9AccImplicitCreateHasDefaultValue)) { | ||
| classFlags |= J9ClassAllowsInitialDefaultValue; |
There was a problem hiding this comment.
Please remove other references to J9ClassAllowsInitialDefaultValue in the code base.
| * the regular arrayClass will always be created first. | ||
| */ | ||
| if (J9_IS_J9CLASS_ALLOW_DEFAULT_VALUE(elementClass) | ||
| if (J9ROMCLASS_IS_VALUE(elementClass->romClass) |
There was a problem hiding this comment.
Actually sorry I don't think we need this section at all. Its no longer the case that a value type array will be initialized with default values.
| __attribute__ ((__gnu_inline__)) | ||
| #endif | ||
| #endif | ||
|
|
There was a problem hiding this comment.
This line does not need to be added.
| * | ||
| * + J9ClassEnsureHashed (inherited) | ||
| * + J9ClassHasOffloadAllowSubtasksNatives | ||
| * + J9ClassIsPrimitiveValueType | J9ClassAllowsInitialDefaultValue |
There was a problem hiding this comment.
Please leave the J9ClassIsPrimitiveValueType since it hasn't been fully removed from the code base.
|
|
||
| if (isStatic) { | ||
| U_32 fieldModifiers = entry->field->modifiers; | ||
| if (J9_ARE_ALL_BITS_SET(fieldModifiers, J9FieldFlagIsNullRestricted)) { |
There was a problem hiding this comment.
While you're here can you add back the test testStaticNullRestrictedFieldMustBeInValueClass that was removed in #22922 ? I think I got rid of it too hastily.
| #endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */ | ||
| ) { | ||
| if (J9_ARE_ALL_BITS_SET(options, J9_FINDCLASS_FLAG_CLASS_OPTION_NULL_RESTRICTED_ARRAY)) { | ||
| ramArrayClass->classFlags |= J9ClassContainsUnflattenedFlattenables; |
There was a problem hiding this comment.
The J9ClassContainsUnflattenedFlattenables flag will automatically set default values for fields. This flag and the code that uses it will need to be removed as well. I expect this will be another large chunk of work so I suggest doing this in another pull request.
| * + J9ClassEnsureHashed (inherited) | ||
| * + J9ClassHasOffloadAllowSubtasksNatives | ||
| * + J9ClassIsPrimitiveValueType | J9ClassAllowsInitialDefaultValue | ||
| * + J9ClassAllowsNonAtomicCreation |
There was a problem hiding this comment.
Replace this with Unused instead of removing the line like is done in line 3387.
| classFlags |= J9ClassAllowsInitialDefaultValue; | ||
| } | ||
| } | ||
| UDATA instanceSize = state->ramClass->totalInstanceSize; |
There was a problem hiding this comment.
I would suggest getting rid of this variable and directly adding state->ramClass->totalInstanceSize in the if statement.
Related: eclipse-openj9#22642 Remove the implicit creation work. Update the tests to follow the new spec.
|
Jenkins test sanity.functional,extended plinuxval jdknext |
|
Jenkins compile amac,win jdk21 |
|
Jenkins test sanity.functional,extended.functional zlinux jdk17 |
Related: #22642
Remove the implicit creation work.
Update the ValhallaAttribute tests to follow the new spec.