mmtk-core icon indicating copy to clipboard operation
mmtk-core copied to clipboard

Cyclic mark states

Open wenyuzhao opened this issue 3 years ago • 4 comments

Looks like at the moment, we use VMLocalMarkBitSpec to define per-object mark metadata, and it only allows one bit of metadata for each object. This prevents from the implementation of cyclic mark bits.

Normally the cyclic mark state will take up more than one bits in the header or on the side, act as a N-bit integer IntN. At the start of each GC the mark state is increased by one, and all existing objects in the heap will automatically become "unmarked" states. So the GC does not need to zero all the mark bits at the start of each GC. When the mark state overflows the max value of IntN, it will cyclic back to the minimum valid value of IntN (usually 0 or 1).

wenyuzhao avatar Jul 29 '21 05:07 wenyuzhao

1 bit is int1. If 1 means marked, after flipping, 1 means unmarked. Why does this not work?

qinsoon avatar Jul 29 '21 05:07 qinsoon

See: https://github.com/mmtk/mmtk-core/pull/994

wks avatar Nov 27 '23 02:11 wks

We should look further into this. MMTk panics if we try use header mark bit for Immix.

[2024-01-15T04:42:30Z INFO  mmtk::memory_manager] Initialized MMTk with Immix (FixedHeapSize(20971520))
===== DaCapo antlr starting =====
Running antlr on grammar antlr/cpp/calc.g
ANTLR Parser Generator   Version 2.7.2   1989-2003 jGuru.com
Running antlr on grammar antlr/cpp/column.g
ANTLR Parser Generator   Version 2.7.2   1989-2003 jGuru.com
Running antlr on grammar antlr/cpp/data.g
ANTLR Parser Generator   Version 2.7.2   1989-2003 jGuru.com
Running antlr on grammar antlr/cpp/expr.g
ANTLR Parser Generator   Version 2.7.2   1989-2003 jGuru.com
Running antlr on grammar antlr/cpp/html.g
ANTLR Parser Generator   Version 2.7.2   1989-2003 jGuru.com
[2024-01-15T04:42:31Z INFO  mmtk::util::heap::gc_trigger] [POLL] immix: Triggering collection (5123/5120 pages)
thread '<unnamed>' panicked at 'not implemented: cyclic mark bits is not supported at the moment', /home/runner/.cargo/git/checkouts/mmtk-core-3306bdeb8eb4322b/79fb0bb/src/policy/immix/immixspace.rs:370:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

qinsoon avatar Jan 15 '24 04:01 qinsoon

In Java MMTk, immix space and mark sweep space use cyclic mark state. It uses the remaining GC bits (3 or 4 bits) for the mark state, and does not require metadata initialization in post alloc. Other policies uses 1 bit mark state. A write for the mark bit is needed to initialize the object metadata in post alloc.

qinsoon avatar Jan 17 '24 00:01 qinsoon