Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove flattening flag from nullable arrays #20250

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions runtime/oti/j9.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ static const struct { \
#define J9CLASS_UNPADDED_INSTANCE_SIZE(clazz) J9_VALUETYPE_FLATTENED_SIZE(clazz)
#define J9_IS_J9CLASS_ALLOW_DEFAULT_VALUE(clazz) J9_ARE_ALL_BITS_SET((clazz)->classFlags, J9ClassAllowsInitialDefaultValue)
#define J9_IS_J9CLASS_PRIMITIVE_VALUETYPE(clazz) J9_ARE_ALL_BITS_SET((clazz)->classFlags, J9ClassIsPrimitiveValueType)
/**
* This macro can only be used to determine vm flattening for a J9ArrayClass.
* For non-array classes use J9_IS_FIELD_FLATTENED.
*/
#define J9_IS_J9CLASS_FLATTENED(clazz) J9_ARE_ALL_BITS_SET((clazz)->classFlags, J9ClassIsFlattened)

#define J9ROMFIELD_IS_NULL_RESTRICTED(romField) J9_ARE_ALL_BITS_SET((romField)->modifiers, J9FieldFlagIsNullRestricted)
Expand Down
8 changes: 6 additions & 2 deletions runtime/vm/BytecodeInterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,9 +1234,13 @@ class INTERPRETER_CLASS
}
} else if (J9_IS_J9CLASS_FLATTENED(srcClazz)
|| J9_IS_J9CLASS_FLATTENED(destClazz)
|| J9_IS_J9CLASS_ALLOW_DEFAULT_VALUE(destComponentClass)
|| J9_IS_J9ARRAYCLASS_NULL_RESTRICTED(destClazz)
) {
/* VM_ArrayCopyHelpers::referenceArrayCopy cannot handle flattened arrays or null elements being copied into arrays of primitive value types, so for those cases use copyFlattenableArray instead */
/* VM_ArrayCopyHelpers::referenceArrayCopy cannot handle
* flattened arrays or null elements being copied into
* arrays of null-restricted value types, so for those
* cases use copyFlattenableArray instead.
*/
updateVMStruct(REGISTER_ARGS);
I_32 value = VM_ValueTypeHelpers::copyFlattenableArray(_currentThread, _objectAccessBarrier, _objectAllocate, srcObject, destObject, srcStart, destStart, elementCount);
VMStructHasBeenUpdated(REGISTER_ARGS);
Expand Down
11 changes: 4 additions & 7 deletions runtime/vm/createramclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3451,16 +3451,13 @@ internalCreateRAMClassFromROMClassImpl(J9VMThread *vmThread, J9ClassLoader *clas
* elements may be flattened arrays.
*/
U_32 arrayFlags = J9ClassLargestAlignmentConstraintReference | J9ClassLargestAlignmentConstraintDouble;
if (J9_ARE_ALL_BITS_SET(javaVM->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_ENABLE_VT_ARRAY_FLATTENING)) {
/* TODO restrict this flag to be set only for null-restricted
* arrays once value type command line tests are updated.
*/
arrayFlags |= J9ClassIsFlattened;
}
ramArrayClass->classFlags |= (elementClass->classFlags & arrayFlags);
if (J9_ARE_ALL_BITS_SET(options, J9_FINDCLASS_FLAG_CLASS_OPTION_NULL_RESTRICTED_ARRAY)) {
if (J9_ARE_ALL_BITS_SET(javaVM->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_ENABLE_VT_ARRAY_FLATTENING)) {
arrayFlags |= J9ClassIsFlattened;
}
ramArrayClass->classFlags |= J9ClassArrayIsNullRestricted;
}
ramArrayClass->classFlags |= (elementClass->classFlags & arrayFlags);
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
arity = 1;
leafComponentType = elementClass;
Expand Down
Loading