Integrated: 8334220: Optimize Klass layout after JDK-8180450
Xiaolong Peng
xpeng at openjdk.org
Wed Jul 3 02:58:31 UTC 2024
On Sat, 29 Jun 2024 19:58:23 GMT, Xiaolong Peng <xpeng at openjdk.org> wrote:
> Hi all,
> This PR is created to optimize the layout of Klass in hotspot, after JDK-8180450 the layout of Klsss seems broken, there are 3 holes, they are caused by alignment issue introduced by the 1 byte ```_hash_slot```.
>
>
> (gdb) ptype /ox Klass
> /* offset | size */ type = class Klass : public Metadata {
> public:
> static const uint KLASS_KIND_COUNT;
> protected:
> /* 0x000c | 0x0004 */ jint _layout_helper;
> /* 0x0010 | 0x0004 */ const enum Klass::KlassKind _kind;
> /* 0x0014 | 0x0004 */ jint _modifier_flags;
> /* 0x0018 | 0x0004 */ juint _super_check_offset;
> /* XXX 4-byte hole */
> /* 0x0020 | 0x0008 */ class Symbol *_name;
> /* 0x0028 | 0x0008 */ class Klass *_secondary_super_cache;
> /* 0x0030 | 0x0008 */ class Array<Klass*> *_secondary_supers;
> /* 0x0038 | 0x0040 */ class Klass *_primary_supers[8];
> /* 0x0078 | 0x0008 */ class OopHandle {
> private:
> /* 0x0078 | 0x0008 */ class oop *_obj;
>
> /* total size (bytes): 8 */
> } _java_mirror;
> /* 0x0080 | 0x0008 */ class Klass *_super;
> /* 0x0088 | 0x0008 */ class Klass * volatile _subklass;
> /* 0x0090 | 0x0008 */ class Klass * volatile _next_sibling;
> /* 0x0098 | 0x0008 */ class Klass *_next_link;
> /* 0x00a0 | 0x0008 */ class ClassLoaderData *_class_loader_data;
> /* 0x00a8 | 0x0008 */ uintx _bitmap;
> /* 0x00b0 | 0x0001 */ uint8_t _hash_slot;
> /* XXX 3-byte hole */
> /* 0x00b4 | 0x0004 */ int _vtable_len;
> /* 0x00b8 | 0x0004 */ class AccessFlags {
> private:
> /* 0x00b8 | 0x0004 */ jint _flags;
>
> /* total size (bytes): 4 */
> } _access_flags;
> /* XXX 4-byte hole */
> /* 0x00c0 | 0x0008 */ traceid _trace_id;
> private:
> /* 0x00c8 | 0x0002 */ s2 _shared_class_path_index;
> /* 0x00ca | 0x0002 */ u2 _shared_class_flags;
> /* 0x00cc | 0x0004 */ int _archived_mirror_index;
> public:
> static const int SECONDARY_SUPERS_TABLE_SIZE;
> static const int SECONDARY_SUPERS_TABLE_MASK;
> static const...
This pull request has now been integrated.
Changeset: f9b4ea13
Author: Xiaolong Peng <xpeng at openjdk.org>
Committer: David Holmes <dholmes at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/f9b4ea13e693da268c9aee27dee49f9c7f798bb1
Stats: 10 lines in 1 file changed: 5 ins; 5 del; 0 mod
8334220: Optimize Klass layout after JDK-8180450
Reviewed-by: coleenp, stuefe, dholmes
-------------
PR: https://git.openjdk.org/jdk/pull/19958
More information about the hotspot-dev
mailing list