• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. Lilliput
  4. Main

Main

  • Created by Iris Clark, last modified by Roman Kennke on Apr 15, 2021

Project Lilliput

Goals

  1. Reduce the object header to 64 bits. It may be possible to shrink it down to 32 bits as a secondary goal.
  2. Make the header layout more flexible, i.e. allow some build-time (possibly even run-time) configuration of how we use the bits.

Motivation

In 64-bit Hotspot, Java objects have an object header of 128 bits: a 64 bit multi-purpose header (‘mark’ or ‘lock’) word and a 64-bit class pointer. With typical average object sizes of 5-6 words, this is quite significant: 2 of those words are always taken by the header. If it were possible to reduce the size of the header, we could significantly reduce memory pressure, which directly translates to one or more of (depending what you care about or what your workload does):

  • Reduced heap usage

  • Higher object allocation rate

  • Reduced GC activity

  • Tighter packing of objects -> better cache locality

In other words, we could reduce the overall CPU and/or memory usage of all Java workloads, whether it's a large in-memory database or a small containerized application.

Current situation

The object header (in 64 bit Hotspot builds) is currently 128 bits long. The first 64 bits are the so-called 'lock' or 'mark' word, the subsequent 64 bits are the class-pointer.

+------------------+
| Lock-word        |
+------------------+
| Class pointer    |
+------------------+
| Field 1          |
+--------+---------+
| Field 2| Field 3 |
+--------+---------+
| etc              |

For arrays, we will reserve an additional field for the arraylength:

+------------------+
| Lock-word        |
+------------------+
| Class pointer    |
+------------------+
| Array-Length     |
+--------+---------+
| Elem 1 | Elem 2  |
+--------+---------+
| etc              |

The lock/mark word

The lock word (for simplicity I'll continue to call it that, even if it's grossly imprecise) is overloaded with various purpuses:

  • Locking: The 3 lowest bits are used for locking, and can take the following combinations:

    • [ ptr        | 00 ] Locked, the upper bits interpreted as a pointer point to real header on stack

    • [ header | 0 | 01 ] Unlocked, upper bits are regular object header

    • [ ptr        | 10 ] Monitor, the upper bits point to inflated lock, header is swapped out

    • [ 0 ...... 0 | 00 ] Inflating in progress

    • [ ptr        | 11 ] Forwarded, used by GC to indicate that upper bits point to forwarded object, which also contains the real header



Resources

  • Lilliput Project
  • Repository
  • Mailing list: lilliput-dev (archives)


Recent space activity

    • Roman Kennke
    • Performance Testing for JEP 450: Compact Object Headers updated Oct 28, 2024 view change
    • Thomas Stuefe
    • Performance Testing for JEP 450: Compact Object Headers updated Oct 21, 2024 view change
    • JEP-450 Review Todo updated Sep 17, 2024 view change
    • Roman Kennke
    • JEP-450 Review Todo updated Sep 17, 2024 view change
    • Stefan Karlsson
    • JEP-450 Review Todo updated Sep 03, 2024 view change
Show More Please wait

Space contributors

{"mode":"list","scope":"descendants","limit":"5","showLastTime":"true","order":"update","contextEntityId":66650455}


Overview
Content Tools
ThemeBuilder
  • No labels

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.23
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 1871, "requestCorrelationId": "9355b93c6f0b19ba"}