Skip to content
Draft
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
1754 commits
Select commit Hold shift + click to select a range
9351018
Add regression test results
wenyuzhao Nov 28, 2023
2dc90ac
Fix potential leak and virtual memory OOM
wenyuzhao Nov 29, 2023
be2fdb5
minor
wenyuzhao Nov 29, 2023
466ffd3
lxr_precise_incs_counter
wenyuzhao Nov 30, 2023
9e9f916
minor
wenyuzhao Nov 30, 2023
110b5fd
minor
wenyuzhao Nov 30, 2023
cf5bf17
minor
wenyuzhao Nov 30, 2023
5d6c0fa
Flush barrier-generated mark queue before `FinishConcurrentWork` buck…
wenyuzhao Dec 4, 2023
4c45354
Fix SATB without lazy decrements
wenyuzhao Dec 4, 2023
a56e00b
Fix lazy sweep counters
wenyuzhao Dec 4, 2023
cf1faf2
Improve SATB performance
wenyuzhao Dec 5, 2023
7d83dae
wip: simple SATB trigger
wenyuzhao Dec 5, 2023
af39191
wip: limit number of concurrent workers
wenyuzhao Dec 5, 2023
2f9c481
wip
wenyuzhao Dec 5, 2023
fda36aa
Minor SATB optimizations
wenyuzhao Dec 5, 2023
598228e
Trigger final mark pause right after SATB is finished
wenyuzhao Dec 5, 2023
9dda971
wip
wenyuzhao Dec 6, 2023
896011f
working
wenyuzhao Dec 6, 2023
f51a58a
wip
wenyuzhao Dec 6, 2023
9ec3b58
cleanup
wenyuzhao Dec 7, 2023
2f11502
cleanup
wenyuzhao Dec 7, 2023
432c273
minor
wenyuzhao Dec 12, 2023
6ca0a55
Concurrent marking optimizations
wenyuzhao Dec 12, 2023
281aed8
Fix space check optimization
wenyuzhao Dec 12, 2023
2dedda9
measure trace rate
wenyuzhao Dec 12, 2023
43d912e
lxr_no_mature_defrag
wenyuzhao Dec 12, 2023
7502428
minor fix
wenyuzhao Dec 12, 2023
b094de6
wip
wenyuzhao Dec 13, 2023
9ed9544
Optimize defrag check
wenyuzhao Dec 13, 2023
da40c1b
Fix CM array slice enqueuing
wenyuzhao Dec 13, 2023
4ab99bb
Change lxr_simple_satb_trigger threshold
wenyuzhao Dec 13, 2023
62334af
Update performance history
wenyuzhao Dec 18, 2023
044d204
More concurrent marking optimizations
wenyuzhao Dec 19, 2023
4ea7c56
Update history.md
wenyuzhao Dec 19, 2023
8ef25ab
log class unloading finish time
wenyuzhao Dec 19, 2023
292f48d
Add cls unloading timer
wenyuzhao Dec 19, 2023
0f1d2a7
Fix typo
wenyuzhao Dec 20, 2023
af8c570
Fix GC counter
wenyuzhao Dec 20, 2023
da032dc
Minor optimizations
wenyuzhao Dec 20, 2023
c62b108
Fix lxr_no_rc_in_cm
wenyuzhao Dec 21, 2023
7ce7904
Enable opt by default
wenyuzhao Jan 3, 2024
04218e9
Remove minor optimization switches
wenyuzhao Jan 3, 2024
04e8d13
Cleanup
wenyuzhao Jan 3, 2024
52a5075
Fix unmark performance
wenyuzhao Jan 3, 2024
1535fbb
More const fn
wenyuzhao Jan 3, 2024
6610752
Minor tweaks
wenyuzhao Jan 3, 2024
0c5a0c6
Increase marking threads only after al mutators are yielded
wenyuzhao Jan 4, 2024
26cc31d
Minor
wenyuzhao Jan 4, 2024
08a1df1
Fix long yieldpoint time
wenyuzhao Jan 4, 2024
3b8a743
aggressive_mature_evac
wenyuzhao Jan 5, 2024
432d320
Fix build error
wenyuzhao Jan 5, 2024
f3481a7
Minor
wenyuzhao Jan 5, 2024
c76d050
Add more counters
wenyuzhao Jan 5, 2024
f7eef77
Add a flag to disable decrements completely
wenyuzhao Jan 7, 2024
89a9fce
Don't enqueue marked objects in barrier slow-path when decs are disabled
wenyuzhao Jan 10, 2024
77e8ea6
SATB: Don't enqueue marked fields
wenyuzhao Jan 10, 2024
00a74c0
Remove unused block dead bytes counter
wenyuzhao Jan 11, 2024
7d91263
Update fragmentation_analysis to measure SATB fragmentation
wenyuzhao Jan 12, 2024
c208787
Fix LOS object release
wenyuzhao Jan 16, 2024
08ba80d
heap demographics dump to stderr
wenyuzhao Jan 16, 2024
2567d72
Higher fragmentation_analysis frequency
wenyuzhao Jan 16, 2024
2dd7e41
no_meta_counting by default
wenyuzhao Jan 17, 2024
2d03fb0
Fix mature defrag
wenyuzhao Jan 18, 2024
27b4353
cleanup
wenyuzhao Jan 18, 2024
919f427
WIP: Fix code cache unloading
wenyuzhao Jan 18, 2024
e5a40d4
Fix class unloading
wenyuzhao Jan 19, 2024
33c617e
WIP: Fix class unloading
wenyuzhao Jan 19, 2024
f233051
Fix weak roots marking
wenyuzhao Jan 19, 2024
09c28f5
Update lxr_release_stage_timer
wenyuzhao Jan 19, 2024
225c7cc
Refactor
wenyuzhao Jan 22, 2024
439409d
More mature defrag
wenyuzhao Jan 22, 2024
a71f526
revert
wenyuzhao Jan 22, 2024
7846038
cleanup
wenyuzhao Jan 22, 2024
5f98c0f
Fix sanity checker
wenyuzhao Jan 23, 2024
23dfdd2
Fix sanity checker
wenyuzhao Jan 23, 2024
2eef0f5
cleanup
wenyuzhao Jan 23, 2024
0cdb5f6
wip
wenyuzhao Jan 23, 2024
990ca74
wip
wenyuzhao Jan 23, 2024
220b174
fix
wenyuzhao Jan 23, 2024
d8030f2
Incs rate measurement support
wenyuzhao Jan 23, 2024
6c27ccd
Merge branch 'lxr' of https://github.com/wenyuzhao/mmtk-core into lxr
wenyuzhao Jan 23, 2024
163db5f
Merge branch 'lxr' into lxr-fix-unload
wenyuzhao Jan 24, 2024
de7c632
cleanup
wenyuzhao Jan 24, 2024
39d7621
g3_compatibilities
wenyuzhao Jan 30, 2024
1665a55
Update README.md
wenyuzhao Feb 2, 2024
740704a
Add latest performance result
wenyuzhao Mar 24, 2024
0803c73
Fix date
wenyuzhao Mar 24, 2024
e1fb265
ebpf scripts
wenyuzhao Mar 24, 2024
9aae0cc
fix
wenyuzhao Mar 25, 2024
5584f5a
Update README.md
wenyuzhao Apr 24, 2024
d0b7293
Update README.md
wenyuzhao Apr 24, 2024
d275944
Fix crash when disabling compressed oops
wenyuzhao May 15, 2024
eded7e1
Fix clippy and rust-analyzer warnings
wenyuzhao May 22, 2024
5206227
cleanup
wenyuzhao May 22, 2024
ae56f4c
WIP: Fix immix
wenyuzhao May 24, 2024
e8cc39e
Fix immix barrier
wenyuzhao May 27, 2024
aa14275
Fix immix barrier
wenyuzhao May 27, 2024
8f76a35
Remove no_meta_counting
wenyuzhao Jun 1, 2024
ff8cf7d
Remove one not-working CM optimization
wenyuzhao Jun 10, 2024
e24e371
Minor optimization to RC decrements
wenyuzhao Jul 19, 2024
e8ba336
initial prefetch support
wenyuzhao Jul 21, 2024
e45466b
prefetch
wenyuzhao Jul 23, 2024
5264be6
cas optimizations
wenyuzhao Jul 23, 2024
723deac
prefetch steps
wenyuzhao Jul 23, 2024
ea730f1
More prefetch
wenyuzhao Jul 24, 2024
0a901cf
write prefetch
wenyuzhao Jul 24, 2024
b41321c
cleanup
wenyuzhao Aug 1, 2024
d51d9d4
Merge tag 'v0.21.0' into lxr-merge
wenyuzhao Aug 1, 2024
089822a
Fix gc phase counter
wenyuzhao Aug 1, 2024
de15100
Merge tag 'v0.22.0' into lxr-merge
wenyuzhao Aug 2, 2024
4160431
Merge tag 'v0.23.0' into lxr-merge
wenyuzhao Aug 2, 2024
97bec3b
Merge tag 'v0.24.0' into lxr-merge
wenyuzhao Aug 2, 2024
afd94fd
Merge commit '5ab62f96c006475285b00b6d20a8b1bf83b74a4d' into lxr-merge
wenyuzhao Aug 6, 2024
d4ff692
Fix Immix GC
wenyuzhao Aug 6, 2024
e26c1e0
Merge commit '1b9cfe40a8bd34fd0c7cc3681a4fe5e7cdb7e167' into lxr-merge
wenyuzhao Aug 6, 2024
e3ba5e6
Merge commit 'a02803b4104519ff2289234101a2dd8ceedd1bc7' into lxr-merge
wenyuzhao Aug 6, 2024
aec3fa2
Merge tag 'v0.25.0' into lxr-merge
wenyuzhao Aug 6, 2024
9ccbfc3
Merge commit '56b2521d2b99848ee0613a0a5288fe6d81b754ba' into lxr-merge
wenyuzhao Aug 6, 2024
ada2732
Merge tag 'v0.26.0' into lxr-merge
wenyuzhao Aug 6, 2024
abd73a8
cleanup
wenyuzhao Aug 6, 2024
b383f7c
Fix Immix GC
wenyuzhao Aug 8, 2024
163e6ea
Update performance history
wenyuzhao Aug 8, 2024
344a97f
Minor markdown tweaks
wenyuzhao Aug 8, 2024
905850e
batched chunk packets
wenyuzhao Sep 17, 2024
3ca9c80
cleanup
wenyuzhao Sep 19, 2024
6be6a84
Minor
wenyuzhao Sep 19, 2024
e7d9dd9
[immix] batched chunk processing
wenyuzhao Sep 24, 2024
10da2ea
[immix] optimizations and refactoring
wenyuzhao Sep 24, 2024
598820f
cleanup
wenyuzhao Sep 24, 2024
138c204
Fix rust 1.80 warnings
wenyuzhao Sep 24, 2024
cad4370
Fix Immix OOM
wenyuzhao Sep 24, 2024
d65b83b
refactor and cleanup
wenyuzhao Sep 24, 2024
9d4dafd
cleanup & refactor
wenyuzhao Oct 2, 2024
76c5060
Merge tag 'v0.27.0' into lxr-merge
wenyuzhao Apr 16, 2025
8886357
Merge tag 'v0.28.0' into lxr-merge
wenyuzhao Apr 16, 2025
db37c51
Merge tag 'v0.29.0' into lxr-merge
wenyuzhao Apr 17, 2025
1f8128b
Merge tag 'v0.30.0' into lxr-merge
wenyuzhao Apr 20, 2025
fe3430b
Merge branch 'master' into lxr-merge
wenyuzhao Apr 20, 2025
432ce91
fmt and fix warnings
wenyuzhao Apr 22, 2025
fb5002c
fix transparent huge page
wenyuzhao Apr 24, 2025
2952f6f
Merge branch 'lxr-merge' of https://github.com/wenyuzhao/mmtk-core in…
wenyuzhao Apr 24, 2025
97443c0
fix transparent huge page
wenyuzhao Apr 24, 2025
8355c0a
Fix STW-LXR
wenyuzhao Jul 16, 2025
363c959
Remove spin lock in field barrier slow-path
wenyuzhao Feb 13, 2026
b8f5bcc
fix: Prevent re-logging already logged slots in the LXR barrier.
wenyuzhao Feb 23, 2026
e1af7fc
No perf_counter by default
wenyuzhao Feb 23, 2026
4122b10
Merge tag 'v0.31.0' into lxr-merge
wenyuzhao Feb 23, 2026
8ca2f67
Merge commit '74dadfd112070f6b6cadca3df44d2c6375d742dc' into lxr-merge
wenyuzhao Feb 24, 2026
00018e3
Merge commit '8b32d04e883e26ffc91ab74504ae62b5b3b65afd' into lxr-merge
wenyuzhao Feb 24, 2026
50be332
Merge commit 'c5ead72a87bcc8cc49b5e7a62cf71d848b4b4c9b' into lxr-merge
wenyuzhao Feb 24, 2026
51ebea6
Merge commit '3d89bb51c191d3077278684ec5059726128d3e2b' into lxr-merge
wenyuzhao Feb 24, 2026
580fed6
Merge commit '54b5e152e43af3ea18d6d90768690cd89adcc7b8' into lxr-merge
wenyuzhao Feb 24, 2026
116ed16
Merge commit '7d798ad8a71aa6df80f58f5e565e4f9274d06871' into lxr-merge
wenyuzhao Feb 24, 2026
6557678
Merge commit '0721d12609ff85f91fef9342462d15db36dd0711' into lxr-merge
wenyuzhao Feb 24, 2026
113014c
Merge commit 'e5284edf293face97a3f2f17c168962e116e38cd' into lxr-merge
wenyuzhao Feb 24, 2026
1dcf01f
Merge commit '6eb1328bfce34a7e0fc4b84fd0b65a849b083e0e' into lxr-merge
wenyuzhao Feb 24, 2026
0b5aa3c
Merge commit 'd7d0bdcd823c5608b6968c12ca463b07c0b021a0' into lxr-merge
wenyuzhao Feb 24, 2026
f13ba7d
Merge commit '29fa871998821ddfdbb95066d9b111769aa1b940' into lxr-merge
wenyuzhao Feb 24, 2026
c84130b
Merge commit 'a4dd70cb70a116a32b1bbb20501c48f77f49181b' into lxr-merge
wenyuzhao Feb 25, 2026
ff7e64d
Merge commit '63c007e9c6f426f08f2ca30b2bfda7e7499f98bd' into lxr-merge
wenyuzhao Feb 25, 2026
603e29b
Merge tag 'v0.32.0' into lxr-merge
wenyuzhao Feb 25, 2026
c05ab30
Skip marking for weak roots
wenyuzhao Mar 4, 2026
dd43553
Fix concurrent work scheduling when gc_threads == 1
wenyuzhao Mar 12, 2026
201d2df
Fix the identification of invalid remset entries
wenyuzhao Mar 13, 2026
bc5d833
Minor fix
wenyuzhao Mar 14, 2026
5f7e2dc
Fix dead object scanning during RC decs
wenyuzhao Mar 16, 2026
6790b6d
Add a cargo flag to measure barrier takerate
wenyuzhao Mar 16, 2026
6ee63ab
Fix CLD scan in RC decs
wenyuzhao Mar 25, 2026
8c17aa5
Arraycopy barrier optimization
wenyuzhao Mar 25, 2026
fc3a6fc
Fix jme on jdk21
wenyuzhao Mar 29, 2026
67dbb8f
Fix
wenyuzhao Mar 30, 2026
78e2eec
WIP
wenyuzhao Mar 31, 2026
7cf1c4f
Fix
wenyuzhao Mar 31, 2026
cb1ae9d
optimiza
wenyuzhao Mar 31, 2026
62748d8
cleanup
wenyuzhao Mar 31, 2026
c853057
cleanup
wenyuzhao Apr 1, 2026
7548423
cleanup
wenyuzhao Apr 1, 2026
5893ee8
cleanup
wenyuzhao Apr 1, 2026
e8d9d36
cleanup
wenyuzhao Apr 1, 2026
d3c3500
cleanup
wenyuzhao Apr 1, 2026
9cf4db3
cleanup
wenyuzhao Apr 1, 2026
68f2117
Revert block allocator changes
wenyuzhao Apr 3, 2026
142546a
Minor
wenyuzhao Apr 3, 2026
d0cdc39
cleanup
wenyuzhao Apr 3, 2026
7d132d5
cleanup
wenyuzhao Apr 3, 2026
d5c53d2
cleanup
wenyuzhao Apr 3, 2026
b2b5b1e
Revert class unloading support
wenyuzhao Apr 4, 2026
f7d3604
Revert weak refs
wenyuzhao Apr 7, 2026
101c93e
WIP: simplify
wenyuzhao Apr 7, 2026
2b2640f
Remove custom gc_log instrumentation infrastructure
wenyuzhao Apr 7, 2026
bcbbf54
Remove bulk thread scanning, non-LXR features, and instrumentation code
wenyuzhao Apr 7, 2026
4d26907
Remove array scanning optimization from LXR GC
wenyuzhao Apr 7, 2026
c9272a6
Refactor GC work and scheduler components
wenyuzhao Apr 7, 2026
9aaaf21
Refactor LXR plan components and remove unused code
wenyuzhao Apr 8, 2026
ad00c8e
Fix xalan crash
wenyuzhao Apr 8, 2026
c37b993
Refactor: move LXR global state and constants into plan::lxr module
wenyuzhao Apr 9, 2026
69c9746
Refactor: simplify object tracing methods and replace HashMap with Ha…
wenyuzhao Apr 16, 2026
6bbaa69
Revert LOS to use treadmill
wenyuzhao Apr 16, 2026
0bc746f
revert freelistpageresource.rs changes
wenyuzhao Apr 16, 2026
d289533
revert blockpageresource.rs changes
wenyuzhao Apr 16, 2026
a65353b
Refactor: remove unnecessary parameters and clean up code in various …
wenyuzhao Apr 17, 2026
19edce0
refactor: consolidate LXR/RC work packets under plan/lxr/
wenyuzhao Apr 17, 2026
6b10d79
refactor: move BlockAllocation to plan/lxr behind ImmixHooks trait
wenyuzhao Apr 17, 2026
d3477a5
refactor: clean up code by removing unused parameters and simplifying…
wenyuzhao Apr 17, 2026
fe4230d
Implement ConcurrentPlan
wenyuzhao Apr 18, 2026
a63f8d9
Remove VMCollection::set_concurrent_marking_state
wenyuzhao Apr 18, 2026
c757d56
Fix LOS metadata
wenyuzhao Apr 18, 2026
1903618
refactor: remove unused methods and simplify logic in global and LXR …
wenyuzhao Apr 18, 2026
c2fa409
Refactor concurrent packet scheduling
wenyuzhao Apr 20, 2026
9ff8fd9
Scheduler cleanups
wenyuzhao Apr 20, 2026
7b2a415
cleanup
wenyuzhao Apr 22, 2026
8a4ead9
Refactor and cleanup
wenyuzhao Apr 22, 2026
618959f
cleanup
wenyuzhao Apr 23, 2026
371fc4f
Minor fix
wenyuzhao Apr 24, 2026
30d1646
Minor
wenyuzhao Apr 24, 2026
f3b5ef7
Refactor work bucket stages and update root scanning logic
wenyuzhao Apr 28, 2026
35b1ee9
Merge remote-tracking branch 'origin/master' into lxr-x/simplified-merge
wenyuzhao Jul 26, 2026
3003925
Fix CI issues (done by Claude)
qinsoon Jul 27, 2026
9b1ff4c
Fix docs. Done by claude
qinsoon Jul 27, 2026
3ce65fb
Merge branch 'master' into lxr-x/simplified
qinsoon Jul 28, 2026
71778fa
Merge branch 'master' into lxr-x/simplified
wks Jul 28, 2026
d5616d7
Work around the null check in one test
qinsoon Jul 28, 2026
c7cf45d
Allow 1/4 global side metadata on 32bits (to accomodate LXR with vo bit)
qinsoon Jul 28, 2026
d83a4f5
Fix a test case for 32 bits (worst ratio changed)
qinsoon Jul 29, 2026
c286843
Fix clippy check
qinsoon Jul 29, 2026
d72e64b
Revert changes to Block::sweep
wks Jul 29, 2026
8f3c129
Use -1 as invalid chunk
wks Jul 29, 2026
b147e1e
GC status transition logging
wks Jul 31, 2026
3027b79
Use `add_deferred` for concurrent bucket.
wks Jul 31, 2026
b37aba1
Revert "Use `add_deferred` for concurrent bucket."
qinsoon Aug 3, 2026
e04e7ec
Don't flip queues for non-lxr plans
qinsoon Aug 3, 2026
9997259
Merge branch 'master' into lxr-x/simplified
qinsoon Aug 3, 2026
4f608cc
Gate two places: reusable block flush and allocate as live. They are …
qinsoon Aug 3, 2026
f824670
Log LXR GC scheduling
wks Aug 3, 2026
6d9956f
cargo fmt
wks Aug 3, 2026
087bab9
Enable VO bits for LXR
wks Aug 5, 2026
e8edabd
Remove methods already implemented by Region
wks Aug 6, 2026
824bbfe
Merge branch 'master' into lxr-x/simplified
wks Aug 6, 2026
8af79ad
Fix build and merge pause start/end hooks
wks Aug 6, 2026
7bc24da
Merge branch 'master' into lxr-x/simplified
qinsoon Aug 7, 2026
7609f50
Add missing cfg(feature = "vo_bit")
qinsoon Aug 7, 2026
6424b73
Add UnstraddlableRegion
wks Aug 7, 2026
e64a162
Merge remote-tracking branch 'refs/remotes/wenyuzhao/lxr-x/simplified…
wks Aug 7, 2026
41d579d
Cleanup
wks Aug 7, 2026
ddb2f2e
Fix clippy warning
wks Aug 7, 2026
a92d9e9
Merge the two SlotIterator implementations.
wks Aug 7, 2026
ff05c9d
Restore unreachable! in unreachable_prepare_func
wks Aug 7, 2026
7925414
Remove assert_is_flushed
wks Aug 7, 2026
3d69aa9
Move LOGGED_VALUE and UNLOGGED_VALUE to log_bit
wks Aug 7, 2026
0a8ce6e
Restore the create_process_roots_work API
wks Aug 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ Cargo.lock
# Generated for testing tutorial code build
/src/plan/mygc

/*.log
/_*
# Python script cache
__pycache__
23 changes: 18 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mmtk"
version = "0.32.0"
authors = ["The MMTk Developers <>"]
edition = "2021" # TODO: Switch to 2024 after bumping MSRV to 1.85
edition = "2021" # TODO: Switch to 2024 after bumping MSRV to 1.85
license = "MIT OR Apache-2.0"
description = "MMTk is a framework for the design and implementation of high-performance and portable memory managers."
homepage = "https://www.mmtk.io"
Expand Down Expand Up @@ -31,13 +31,16 @@ doctest = false

[dependencies]
# MMTk macros - we have to specify a version here in order to publish the crate, even though we use the dependency from a local path.
mmtk-macros = { version="0.32.0", path = "macros/" }
mmtk-macros = { version = "0.32.0", path = "macros/" }

# Third party dependencies
atomic = "0.6.0"
atomic_refcell = "0.1.7"
atomic-traits = "0.4.0"
bytemuck = { version = "1.14.0", features = ["derive", "zeroable_maybe_uninit"] }
bytemuck = { version = "1.14.0", features = [
"derive",
"zeroable_maybe_uninit",
] }
cfg-if = "1.0"
crossbeam = "0.8.1"
delegate = "0.13.2"
Expand All @@ -46,7 +49,9 @@ enum-map = "2.7.3"
env_logger = { version = "0.11.3", optional = true }
is-terminal = "0.4.7"
itertools = "0.14.0"
jemalloc-sys = { version = "0.5.3", features = ["disable_initial_exec_tls"], optional = true }
jemalloc-sys = { version = "0.5.3", features = [
"disable_initial_exec_tls",
], optional = true }
lazy_static = "1.1"
libc = "0.2"
log = { version = "0.4", features = ["max_level_trace"] }
Expand Down Expand Up @@ -106,6 +111,14 @@ builtin_env_logger = ["dep:env_logger"]
# Enable this feature if you want to use nightly features and compiler
nightly = []

# LXR Features
lxr_no_cm = []
lxr_no_lazy = []
lxr_stw = ["lxr_no_cm", "lxr_no_lazy"]
lxr_no_nursery_evac = []
lxr_no_mature_evac = []
lxr_no_evac = ["lxr_no_nursery_evac", "lxr_no_mature_evac"]

# This feature is only supported on x86-64 for now
# It's manually added to CI scripts
perf_counter = ["dep:pfm"]
Expand Down Expand Up @@ -141,7 +154,7 @@ set_unlog_bits_vm_space = []
# TODO: This is not properly implemented yet. We currently use an immortal space instead, and do not guarantee read-only semantics.
ro_space = []
# A code space with execution permission.
code_space = []
code_space = []

# By default, we only allow execution permission for code spaces. With this feature, all the spaces have execution permission.
# Use with care.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ MMTk uses a pinned Rust version in the repository (recorded in the `rust-toolcha
our tests and benchmarks using the pinned Rust version. We recommend using the pinned Rust version
for development. We update the pinned Rust version between releases of mmtk-core to keep it close to
the latest Rust stable release. The release cycle of mmtk-core is six weeks, roughly the same as
Rust itself.
Rust itself.

Our minimum support Rust version (MSRV) policy is "N-1" (note that N is *NOT* the current stable Rust release). That means we also ensure mmtk-core works
properly with the Rust toolchain that is one minor version before the version specified in
Expand Down
4 changes: 2 additions & 2 deletions docs/dummyvm/include/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ extern bool mmtk_is_in_mmtk_spaces(void* object);
// Return if the address pointed to by `addr` is in memory that is mapped by MMTk
extern bool mmtk_is_mapped_address(void* addr);

// Request MMTk to trigger a GC. Note that this may not actually trigger a GC
extern void mmtk_handle_user_collection_request(void* tls);
// Request MMTk to trigger a GC. Note that this may not actually trigger a GC unless `force` is true
extern void mmtk_handle_user_collection_request(void* tls, bool force);

// Add a reference to the list of weak references
extern void mmtk_add_weak_candidate(void* ref);
Expand Down
4 changes: 2 additions & 2 deletions docs/dummyvm/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ pub extern "C" fn mmtk_is_mapped_address(address: Address) -> bool {
}

#[no_mangle]
pub extern "C" fn mmtk_handle_user_collection_request(tls: VMMutatorThread) {
memory_manager::handle_user_collection_request::<DummyVM>(mmtk(), tls);
pub extern "C" fn mmtk_handle_user_collection_request(tls: VMMutatorThread, force: bool) {
memory_manager::handle_user_collection_request::<DummyVM>(mmtk(), tls, force);
}

#[no_mangle]
Expand Down
2 changes: 2 additions & 0 deletions docs/dummyvm/src/object_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ impl ObjectModel<DummyVM> for VMObjectModel {
// Global metadata

const GLOBAL_LOG_BIT_SPEC: VMGlobalLogBitSpec = VMGlobalLogBitSpec::side_first();
const GLOBAL_FIELD_UNLOG_BIT_SPEC: VMGlobalFieldUnlogBitSpec =
VMGlobalFieldUnlogBitSpec::side_after(Self::GLOBAL_LOG_BIT_SPEC.as_spec());

// Local metadata

Expand Down
4 changes: 2 additions & 2 deletions docs/dummyvm/src/scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ impl Scanning<DummyVM> for VMScanning {
fn scan_vm_specific_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory<DummyVMSlot>) {
unimplemented!()
}
fn scan_object<SV: SlotVisitor<DummyVMSlot>>(
fn scan_object(
_tls: VMWorkerThread,
_object: ObjectReference,
_slot_visitor: &mut SV,
_slot_visitor: &mut impl SlotVisitor<DummyVMSlot>,
) {
unimplemented!()
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(static_mut_refs)]
// Use the `{likely, unlikely}` provided by compiler when using nightly
#![cfg_attr(feature = "nightly", feature(core_intrinsics))]

Expand Down Expand Up @@ -39,6 +40,7 @@ pub use mmtk::MMTK;
mod global_state;
pub use crate::global_state::{GcStatus, LiveBytesStats};

#[macro_use]
mod policy;

pub mod build_info;
Expand Down
14 changes: 13 additions & 1 deletion src/memory_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ use crate::vm::slot::MemorySlice;
use crate::vm::ReferenceGlue;
use crate::vm::VMBinding;

/// Notify MMTk that a GC has started, so that MMTk can update its internal statistics (e.g. GC counts
/// and timers) to reflect this. A binding does not normally need to call this directly, as MMTk calls it
/// itself when it triggers a GC; it is only needed if the binding drives GC start/stop outside of MMTk's
/// own scheduling.
///
/// Arguments:
/// * `mmtk`: A reference to an MMTk instance.
pub fn report_gc_start<VM: VMBinding>(mmtk: &MMTK<VM>) {
mmtk.stats.start_gc();
}

use std::collections::HashMap;

/// Initialize an MMTk instance. A VM should call this method after creating an [`crate::MMTK`]
Expand Down Expand Up @@ -677,8 +688,9 @@ pub fn total_bytes<VM: VMBinding>(mmtk: &MMTK<VM>) -> usize {
pub fn handle_user_collection_request<VM: VMBinding>(
mmtk: &MMTK<VM>,
tls: VMMutatorThread,
force: bool,
) -> bool {
mmtk.handle_user_collection_request(tls, false, false)
mmtk.handle_user_collection_request(tls, force, false)
}

/// Is the object alive?
Expand Down
20 changes: 16 additions & 4 deletions src/mmtk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ impl Default for MMTKBuilder {
/// An MMTk instance. MMTk allows multiple instances to run independently, and each instance gives users a separate heap.
/// *Note that multi-instances is not fully supported yet*
pub struct MMTK<VM: VMBinding> {
pub(crate) options: Arc<Options>,
/// The command line options for this MMTk instance, shared with the VM binding.
pub options: Arc<Options>,
pub(crate) state: Arc<GlobalState>,
pub(crate) plan: UnsafeCell<Box<dyn Plan<VM = VM>>>,
pub(crate) reference_processors: ReferenceProcessors,
pub(crate) finalizable_processor:
Mutex<FinalizableProcessor<<VM::VMReferenceGlue as ReferenceGlue<VM>>::FinalizableType>>,
pub(crate) scheduler: Arc<GCWorkScheduler<VM>>,
/// The GC work scheduler that schedules and executes GC work packets on GC worker threads.
pub scheduler: Arc<GCWorkScheduler<VM>>,
#[cfg(feature = "sanity")]
pub(crate) sanity_checker: Mutex<SanityChecker<VM::VMSlot>>,
#[cfg(feature = "extreme_assertions")]
Expand Down Expand Up @@ -152,7 +154,11 @@ impl<VM: VMBinding> MMTK<VM> {
*options.threads
};

let scheduler = GCWorkScheduler::new(num_workers, (*options.thread_affinity).clone());
let scheduler = GCWorkScheduler::new(
num_workers,
usize::min(num_workers, *options.conc_threads),
(*options.thread_affinity).clone(),
);

let state = Arc::new(GlobalState::default());

Expand Down Expand Up @@ -343,6 +349,10 @@ impl<VM: VMBinding> MMTK<VM> {
pub fn harness_begin(&self, tls: VMMutatorThread) {
probe!(mmtk, harness_begin);
self.handle_user_collection_request(tls, true, true);
if tls.0 .0.is_null() {
use crate::vm::Collection;
VM::VMCollection::block_for_gc(tls);
}
Comment on lines +350 to +353

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even in master, mmtk-openjdk has always been passing NULL tls when calling mmtk.harness_begin, and MMTk passes the NULL tls back to mmtk-openjdk via VM::VMCollection::block_for_gc, and mmtk-openjdk simply ignores the tls parameter in Collection::block_for_gc.

So why do we skip the block_for_gc here when tls is null (which is always true for OpenJDK)? There may be some LXR-specific considerations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly in handle_user_collection_request, block_for_gc is only called if tls is not null. This causes one test to hang (as tls in the test is null and block_for_gc is never called).

if !tls.0 .0.is_null() {
    VM::VMCollection::block_for_gc(tls);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the test tls to 1 to work around the issue. There is a FIXME to remind us to remove the workaround before merging the PR.

@wenyuzhao wenyuzhao Jul 28, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LXR openjdk binding enables vm thread triggered GC. This is mainly to support metaspace GC.

Such GC requests are triggered by VM threads, and handle_user_collection_request should not block so that VM thread can continue execution. For these GC requests there is no TLS available.

The one in harness_begin is to just force block current thread again, since harness_begin has TLS == NULL as well.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LXR openjdk binding enables vm thread triggered GC. This is mainly to support metaspace GC.

We can add an argument for handle_user_collection_request to indicate non blocking. Or, we could have a different API, as requests from vm thread are not 'user requests' anyway.

self.state.inside_harness.store(true, Ordering::SeqCst);
self.stats.start_all();
self.scheduler.enable_stat();
Expand Down Expand Up @@ -450,7 +460,9 @@ impl<VM: VMBinding> MMTK<VM> {
.handle_user_collection_request(force, exhaustive)
{
use crate::vm::Collection;
VM::VMCollection::block_for_gc(tls);
if !tls.0 .0.is_null() {
VM::VMCollection::block_for_gc(tls);
}
true
} else {
false
Expand Down
83 changes: 83 additions & 0 deletions src/plan/barriers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub enum BarrierSelector {
NoBarrier,
/// Object remembering post-write barrier is used.
ObjectBarrier,
/// Field remembering post-write barrier is used, using a per-field (rather than per-object) unlogged bit.
FieldBarrier,
/// Object remembering pre-write barrier with weak reference loading barrier.
// TODO: We might be able to generalize this to object remembering pre-write barrier.
SATBBarrier,
Expand Down Expand Up @@ -149,8 +151,11 @@ impl<VM: VMBinding> Barrier<VM> for NoBarrier {}
/// A barrier is a combination of fast-path behaviour + slow-path semantics.
/// The fast-path code will decide whether to call the slow-path calls.
pub trait BarrierSemantics: 'static + Send {
/// The VM binding type that this barrier semantics is specialized for.
type VM: VMBinding;

/// The metadata spec used to store the unlogged bit that this barrier's fast-path checks and
/// slow-path clears/sets.
const UNLOG_BIT_SPEC: MetadataSpec =
*<Self::VM as VMBinding>::VMObjectModel::GLOBAL_LOG_BIT_SPEC.as_spec();

Expand Down Expand Up @@ -271,6 +276,84 @@ impl<S: BarrierSemantics> Barrier<S::VM> for ObjectBarrier<S> {
}
}

/// Generic object barrier with a type argument defining it's slow-path behaviour.
pub struct FieldBarrier<S: BarrierSemantics> {
semantics: S,
}

impl<S: BarrierSemantics> FieldBarrier<S> {
/// Create a new FieldBarrier with the given semantics.
pub fn new(semantics: S) -> Self {
Self { semantics }
}
}

impl<S: BarrierSemantics> Barrier<S::VM> for FieldBarrier<S> {
fn flush(&mut self) {
self.semantics.flush();
}

fn load_weak_reference(&mut self, o: ObjectReference) {
self.semantics.load_weak_reference(o)
}

fn object_probable_write(&mut self, obj: ObjectReference) {
self.semantics.object_probable_write_slow(obj);
}

fn object_reference_write_pre(
&mut self,
src: ObjectReference,
slot: <S::VM as VMBinding>::VMSlot,
target: Option<ObjectReference>,
) {
self.semantics
.object_reference_write_slow(src, slot, target);
}

fn object_reference_write_post(
&mut self,
_src: ObjectReference,
_slot: <S::VM as VMBinding>::VMSlot,
_target: Option<ObjectReference>,
) {
unimplemented!()
}

fn object_reference_write_slow(
&mut self,
src: ObjectReference,
slot: <S::VM as VMBinding>::VMSlot,
target: Option<ObjectReference>,
) {
self.semantics
.object_reference_write_slow(src, slot, target);
}

fn memory_region_copy_pre(
&mut self,
src: <S::VM as VMBinding>::VMMemorySlice,
dst: <S::VM as VMBinding>::VMMemorySlice,
) {
self.semantics.memory_region_copy_slow(src, dst);
}

fn memory_region_copy_post(
&mut self,
_src: <S::VM as VMBinding>::VMMemorySlice,
_dst: <S::VM as VMBinding>::VMMemorySlice,
) {
unimplemented!()
}
}

/// The value stored in the log bit/byte indicating that the object or field is unlogged, i.e. it
/// has not yet been recorded in the remembered set and the write barrier should still take its slow path.
pub const UNLOGGED_VALUE: u8 = 0b1;
/// The value stored in the log bit/byte indicating that the object or field is logged, i.e. it
/// has already been recorded in the remembered set and the write barrier can skip its slow path.
pub const LOGGED_VALUE: u8 = 0b0;
Comment thread
wks marked this conversation as resolved.
Outdated

/// A SATB (Snapshot-At-The-Beginning) barrier implementation.
/// This barrier is basically a pre-write object barrier with a weak reference loading barrier.
pub struct SATBBarrier<S: BarrierSemantics> {
Expand Down
5 changes: 5 additions & 0 deletions src/plan/concurrent/barrier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ use crate::{
MMTK,
};

/// A snapshot-at-the-beginning (SATB) barrier, used by concurrent plans (e.g. concurrent Immix)
/// to preserve the objects that were reachable at the start of concurrent marking. Old values
/// overwritten by mutators, and referents loaded from weak references, are buffered and later
/// enqueued as roots for concurrent marking, so they are not incorrectly reclaimed as garbage.
pub struct SATBBarrierSemantics<
VM: VMBinding,
P: ConcurrentPlan<VM = VM> + PlanTraceObject<VM>,
Expand All @@ -30,6 +34,7 @@ pub struct SATBBarrierSemantics<
impl<VM: VMBinding, P: ConcurrentPlan<VM = VM> + PlanTraceObject<VM>, const KIND: TraceKind>
SATBBarrierSemantics<VM, P, KIND>
{
/// Create a new SATB barrier for the given mutator, with empty SATB/weak-reference buffers.
pub fn new(mmtk: &'static MMTK<VM>, tls: VMMutatorThread) -> Self {
Self {
mmtk,
Expand Down
4 changes: 2 additions & 2 deletions src/plan/concurrent/concurrent_marking_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::plan::concurrent::Pause;
use crate::plan::tracing::{PlanTrace, Trace};
use crate::plan::PlanTraceObject;
use crate::policy::gc_work::TraceKind;
use crate::scheduler::{GCWork, GCWorker, WorkBucketStage};
use crate::scheduler::{gc_work::RootKind, GCWork, GCWorker, WorkBucketStage};
use crate::util::{scanning_helper, ObjectReference};
use crate::vm::slot::Slot;
use crate::vm::{RootsKind, RootsWorkFactory, VMBinding};
Expand Down Expand Up @@ -202,7 +202,7 @@ impl<VM: VMBinding, P: ConcurrentPlan<VM = VM> + PlanTraceObject<VM>, const KIND
impl<VM: VMBinding, P: ConcurrentPlan<VM = VM> + PlanTraceObject<VM>, const KIND: TraceKind>
RootsWorkFactory<VM::VMSlot> for ConcurrentMarkingRootsWorkFactory<VM, P, KIND>
{
fn create_process_roots_work(&mut self, slots: Vec<VM::VMSlot>) {
fn create_process_roots_work(&mut self, slots: Vec<VM::VMSlot>, _kind: RootKind) {
probe!(mmtk, roots, RootsKind::NORMAL, slots.len());

self.debug_assert_initial_mark();
Expand Down
Loading
Loading