Skip to content

Instantly share code, notes, and snippets.

@0x277F
Last active April 18, 2021 12:22
Show Gist options
  • Save 0x277F/33b14fe2d8fc29735a2873fcd04b48ea to your computer and use it in GitHub Desktop.
Save 0x277F/33b14fe2d8fc29735a2873fcd04b48ea to your computer and use it in GitHub Desktop.
Java klass.hpp memory layout
Index Field Name Size Offset Completely Useless Column Field Type
1 Header 8 +0 +0 Unknown
2 Klass Pointer Size +8 +8 *Klass to java/lang/Class
3 C++ Vtbl Pointer Size +16 +12 Unknown Pointer
4 Layout Helper 4 +24 +16 i32
5 Super Offset 4 +28 +20 u32
6 Name Pointer Size + 32 +24 *Symbol (linked list type?)
7 Secondary Super Cache Pointer Size +40 +28 *Klass
8 Secondary Supers Pointer Size +48 +32 Array<*Klass>
9 Primary Supers Pointer Size * 8 +56 +38 *Klass[]
10 Java Mirror Pointer Size +120 +68 oop (pointer type, representation of this class's java/lang/Class instance)
11 Super Pointer Size +128 +72 *Klass
12 First Subclass Pointer Size +126 +76 *Klass or NULL
13 Sibling Pointer Size +144 +80 *Klass for linked list
14 Modifiers 4 +152 + 84 i32
15 Access Flags 4 +156 +88 u32
@Yamakaja
Copy link

Yamakaja commented Sep 7, 2017

Offsets are not changed by compressed OOPs
Fixed, lazily. ~Hex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment