[master] RFR: Fix self-forwarding on 32 bit platforms

Roman Kennke rkennke at openjdk.java.net
Fri Oct 15 10:54:27 UTC 2021


Self-forwarding as implemented by #10 uses the 3rd header bit to indicate self-forwarded object. However, on 32bit platforms, oops are only 4-byte-aligned, and a regular forwarding may set the 3rd bit, and thus make it look like self-forwarded. This breaks one of the gtests, and potentially causes severe heap corruption. OTOH, on 32 bit platforms we don't need to preserve the upper header bits, and can therefore use regular forwarding mechanism to do self-forwarding (as it was before #10).

The change also changes the test_preservedMarks.cpp gtest to install 0b1 as original mark, not 0b11 which would also look like a forwarded object. It has not caused failure because it was not tested before the forwarding gets installed, but is wrong nonetheless.

Testing:
 - [x] gtest (which was failing before)
 - [x] tier1
 - [x] tier2
 - [x] hotspot_gc

-------------

Commit messages:
 - Fix self-forwarding on 32 bit platforms

Changes: https://git.openjdk.java.net/lilliput/pull/23/files
 Webrev: https://webrevs.openjdk.java.net/?repo=lilliput&pr=23&range=00
  Stats: 9 lines in 2 files changed: 7 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/lilliput/pull/23.diff
  Fetch: git fetch https://git.openjdk.java.net/lilliput pull/23/head:pull/23

PR: https://git.openjdk.java.net/lilliput/pull/23


More information about the lilliput-dev mailing list