Last active
October 7, 2024 03:11
-
-
Save arturmkrtchyan/43d6135e8a15798cc46c to your computer and use it in GitHub Desktop.
Java Object Header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|----------------------------------------------------------------------------------------|--------------------| | |
| Object Header (64 bits) | State | | |
|-------------------------------------------------------|--------------------------------|--------------------| | |
| Mark Word (32 bits) | Klass Word (32 bits) | | | |
|-------------------------------------------------------|--------------------------------|--------------------| | |
| identity_hashcode:25 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Normal | | |
|-------------------------------------------------------|--------------------------------|--------------------| | |
| thread:23 | epoch:2 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Biased | | |
|-------------------------------------------------------|--------------------------------|--------------------| | |
| ptr_to_lock_record:30 | lock:2 | OOP to metadata object | Lightweight Locked | | |
|-------------------------------------------------------|--------------------------------|--------------------| | |
| ptr_to_heavyweight_monitor:30 | lock:2 | OOP to metadata object | Heavyweight Locked | | |
|-------------------------------------------------------|--------------------------------|--------------------| | |
| | lock:2 | OOP to metadata object | Marked for GC | | |
|-------------------------------------------------------|--------------------------------|--------------------| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|------------------------------------------------------------------------------------------------------------|--------------------| | |
| Object Header (128 bits) | State | | |
|------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| Mark Word (64 bits) | Klass Word (64 bits) | | | |
|------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| unused:25 | identity_hashcode:31 | unused:1 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Normal | | |
|------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| thread:54 | epoch:2 | unused:1 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Biased | | |
|------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| ptr_to_lock_record:62 | lock:2 | OOP to metadata object | Lightweight Locked | | |
|------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| ptr_to_heavyweight_monitor:62 | lock:2 | OOP to metadata object | Heavyweight Locked | | |
|------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| | lock:2 | OOP to metadata object | Marked for GC | | |
|------------------------------------------------------------------------------|-----------------------------|--------------------| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|--------------------------------------------------------------------------------------------------------------|--------------------| | |
| Object Header (96 bits) | State | | |
|--------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| Mark Word (64 bits) | Klass Word (32 bits) | | | |
|--------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| unused:25 | identity_hashcode:31 | cms_free:1 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Normal | | |
|--------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| thread:54 | epoch:2 | cms_free:1 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Biased | | |
|--------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| ptr_to_lock_record | lock:2 | OOP to metadata object | Lightweight Locked | | |
|--------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| ptr_to_heavyweight_monitor | lock:2 | OOP to metadata object | Heavyweight Locked | | |
|--------------------------------------------------------------------------------|-----------------------------|--------------------| | |
| | lock:2 | OOP to metadata object | Marked for GC | | |
|--------------------------------------------------------------------------------|-----------------------------|--------------------| |
Nice~
thanks 😆
Love it
Thanks!
thanks
Thanks!
Thanks
Thanks!!
Awesome ~~~
Why hashcode takes 31 bite ? Hashcode in Java is an int which is 4 bytes or 32 bits . Did I miss something ?
Your previous blog can’t be accessed. I bookmarked your article before, address: http://arturmkrtchyan.com/java-object-header.
is multi-byte value use little-endian?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Love it