How does the compressed pointer implementation in V8 differ from JVM's compressed Oops?

后端 未结 1 555
盖世英雄少女心
盖世英雄少女心 2021-01-27 07:30

Background: V8 announced a feature called pointer compression (What\'s happening in V8? - Benedikt Meurer), which is intended to reduce the memory overhead of pointers for 64-bi

相关标签:
1条回答
  • 2021-01-27 08:04

    I think the links you provided already contain the answer? In short:

    JVM's "compressed Oops" save 3 bits via shifting and thereby make it possible to address 2³ * 4 GB using 32-bit pointers at 8-byte granularity. (At least that's what your link says; I know nothing about the JVM so I cannot confirm or deny that this is accurate information.)

    V8's "compressed pointers" pick a base address somewhere in the 64 (well, 48 really) bit address space and then store all heap pointers as 32-bit offsets from that base address, so the maximum heap size that can be addressed in this mode is 4GB.

    I would guess that the JVM also needs to employ some variant of a base address, otherwise the shifted pointers would be limited to a very small and fixed subset of the full address space. V8's approach leaves the bits around that the JVM shifts away, which is nice for V8's purposes because it uses those bits to store other information (its pointers are tagged, and the tags are in those bits).

    0 讨论(0)
提交回复
热议问题