RFR: 8305898: Alternative self-forwarding mechanism [v4]
Axel Boldt-Christmas
aboldtch at openjdk.org
Thu Feb 15 14:10:56 UTC 2024
On Thu, 15 Feb 2024 13:50:39 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> This is a problem with x86_32 builds, where oopDesc is only 4 byte. It is only a problem in this test, in real world, objects in the heap are always at least 8-byte-aligned.
>
> Even on 32bits system, shouldn't `_mark` = 4 bytes and `_metadata` = 4 bytes, so the total size of `oopDesc` is 8 bytes?
The alignment of a struct must just ensure that the alignments requirement of its fields are satisfied (in the general case) So a struct of two 4 byte ints will have an `alignof` 4 bytes and a `sizeof` 8 bytes
```c++
#include <cstdint>
struct S {
uint32_t a;
uint32_t b;
};
static_assert(alignof(S) == 4);
static_assert(sizeof(S) == 8);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17755#discussion_r1491064467
More information about the hotspot-gc-dev
mailing list