When I am tunning ZPageSizeSmall to 16 MB from 2MB:
```
const size_t ZPlatformGranuleSizeShift = 24; // 16MB
// Granule shift/size
const size_t ZGranuleSizeShift = ZPlatformGranuleSizeShift;
// Page size shifts
const size_t ZPageSizeSmallShift = ZGranuleSizeShift;
// Page sizes
const size_t ZPageSizeSmall = (size_t)1 << ZPageSizeSmallShift;
```
zBitField failed to work:
```
Internal Error
(/home/zhaixiang/jdk/src/hotspot/share/gc/z/zBitField.hpp:76), pid=923047, tid=923069
# assert(((ContainerType)value & (FieldMask << ValueShift)) == (ContainerType)value) failed: Invalid value
#
# JRE version: OpenJDK Runtime Environment (20.0) (fastdebug build 20-internal-adhoc.root.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 20-internal-adhoc.root.jdk, mixed mode, sharing, tiered, compressed class ptrs, z gc, linux-aarch64)
```
Perhaps mask also need to be adjusted:
```
static size_t object_index(oop obj) {
const uintptr_t addr = ZOop::to_address(obj);
const uintptr_t offset = ZAddress::offset(addr);
const uintptr_t mask = ZGranuleSize - 1;
return (offset & mask) >> ZObjectAlignmentSmallShift;
}
```
Back to the point: ZPlatformGranuleSizeShift is redundant due to it can not be modified, for example, 24, so I removed the ZPlatformGranuleSizeShift from cpu backends, just keep it for debugging AArch64 to see the issue.
```
const size_t ZPlatformGranuleSizeShift = 24; // 16MB
// Granule shift/size
const size_t ZGranuleSizeShift = ZPlatformGranuleSizeShift;
// Page size shifts
const size_t ZPageSizeSmallShift = ZGranuleSizeShift;
// Page sizes
const size_t ZPageSizeSmall = (size_t)1 << ZPageSizeSmallShift;
```
zBitField failed to work:
```
Internal Error
(/home/zhaixiang/jdk/src/hotspot/share/gc/z/zBitField.hpp:76), pid=923047, tid=923069
# assert(((ContainerType)value & (FieldMask << ValueShift)) == (ContainerType)value) failed: Invalid value
#
# JRE version: OpenJDK Runtime Environment (20.0) (fastdebug build 20-internal-adhoc.root.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 20-internal-adhoc.root.jdk, mixed mode, sharing, tiered, compressed class ptrs, z gc, linux-aarch64)
```
Perhaps mask also need to be adjusted:
```
static size_t object_index(oop obj) {
const uintptr_t addr = ZOop::to_address(obj);
const uintptr_t offset = ZAddress::offset(addr);
const uintptr_t mask = ZGranuleSize - 1;
return (offset & mask) >> ZObjectAlignmentSmallShift;
}
```
Back to the point: ZPlatformGranuleSizeShift is redundant due to it can not be modified, for example, 24, so I removed the ZPlatformGranuleSizeShift from cpu backends, just keep it for debugging AArch64 to see the issue.