summaryrefslogtreecommitdiff
path: root/gc/mmtk
AgeCommit message (Collapse)Author
4 daysmmtk: Get rid of unused reference to FL_EXIVARJean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/13610
8 daysTake file and line in GC VM locksPeter Zhu
This commit adds file and line to GC VM locking functions for debugging purposes and adds upper case macros to pass __FILE__ and __LINE__. Notes: Merged: https://github.com/ruby/ruby/pull/13550
2025-06-03Allow pass special constants to the write barrierPeter Zhu
Some GC implementations want to always know when an object is written to, even if the written value is a special constant. Checking special constants in rb_obj_written was a micro-optimization that made assumptions about the GC implementation. Notes: Merged: https://github.com/ruby/ruby/pull/13497
2025-05-30[ruby/mmtk] Fix environment variable parsingKunshan Wang
Ues more idiomatic rust approaches. https://github.com/ruby/mmtk/commit/ef125f9eae
2025-05-30[ruby/mmtk] Fix clippy warnings and formatting.Kunshan Wang
We also enable `#![warn(unsafe_op_in_unsafe_fn)]` in the whole mmtk_ruby crate. https://github.com/ruby/mmtk/commit/8b8025f71a
2025-05-30[ruby/mmtk] Bump MMTk and dependencies versionKunshan Wang
https://github.com/ruby/mmtk/commit/de252637ec
2025-05-30[ruby/mmtk] Remove unused constantKunshan Wang
Remove the unused constant HAS_MOVED_GFIELDSTBL and related methods. In the mmtk/mmtk-ruby repo, we are now able to find the global field (IV) table of a moved object during copying GC without using the HAS_MOVED_GFIELDSTBL bit. We synchronize some of the code, although we haven't implemented moving GC in ruby/mmtk, yet. See: https://github.com/mmtk/mmtk-ruby/commit/13080acdf553f20a88a7ea9ab9f6877611017136 https://github.com/ruby/mmtk/commit/400ba4e747
2025-05-29[ruby/mmtk] Remove dependance on internal/object.hPeter Zhu
https://github.com/ruby/mmtk/commit/fdc13963f0
2025-05-26Add shape_id to RBasic under 32 bitJohn Hawthorn
This makes `RBobject` `4B` larger on 32 bit systems but simplifies the implementation a lot. [Feature #21353] Co-authored-by: Jean Boussier <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/13341
2025-05-21[ruby/mmtk] Fix object ID in rb_gc_impl_define_finalizerPeter Zhu
The 0th element of the finalizer table array should be the object ID. https://github.com/ruby/mmtk/commit/75e4a82652
2025-05-21[ruby/mmtk] Fix object ID for finalizersPeter Zhu
We should get the object ID for finalizers in rb_gc_impl_define_finalizer instead of when we create the finalizer job in make_final_job because when we are in multi-Ractor mode, object ID needs to walk the references which allocates an identity hash table. We cannot allocate in make_final_job because it is in a MMTk worker thread. https://github.com/ruby/mmtk/commit/922f22a690
2025-05-16rb_gc_impl_copy_finalizer: generate a new object idJean Boussier
Fix a regression introduced by: https://github.com/ruby/ruby/pull/13155 Notes: Merged: https://github.com/ruby/ruby/pull/13350
2025-05-16Add missing lock to `rb_gc_impl_copy_finalizer`Jean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/13350
2025-05-15Add missing lock in `rb_gc_impl_undefine_finalizer`Jean Boussier
The table is global so accesses must be synchronized. Notes: Merged: https://github.com/ruby/ruby/pull/13349
2025-05-15YJIT: ZJIT: Allow both JITs in the same buildAlan Wu
This commit allows building YJIT and ZJIT simultaneously, a "combo build". Previously, `./configure --enable-yjit --enable-zjit` failed. At runtime, though, only one of the two can be enabled at a time. Add a root Cargo workspace that contains both the yjit and zjit crate. The common Rust build integration mechanisms are factored out into defs/jit.mk. Combo YJIT+ZJIT dev builds are supported; if either JIT uses `--enable-*=dev`, both of them are built in dev mode. The combo build requires Cargo, but building one JIT at a time with only rustc in release build remains supported. Notes: Merged: https://github.com/ruby/ruby/pull/13262
2025-05-08Move `object_id` in object fields.Jean Boussier
And get rid of the `obj_to_id_tbl` It's no longer needed, the `object_id` is now stored inline in the object alongside instance variables. We still need the inverse table in case `_id2ref` is invoked, but we lazily build it by walking the heap if that happens. The `object_id` concern is also no longer a GC implementation concern, but a generic implementation. Co-Authored-By: Matt Valentine-House <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/13159
2025-05-08Rename `ivptr` -> `fields`, `next_iv_index` -> `next_field_index`Jean Boussier
Ivars will longer be the only thing stored inline via shapes, so keeping the `iv_index` and `ivptr` names would be confusing. Instance variables won't be the only thing stored inline via shapes, so keeping the `ivptr` name would be confusing. `field` encompass anything that can be stored in a VALUE array. Similarly, `gen_ivtbl` becomes `gen_fields_tbl`. Notes: Merged: https://github.com/ruby/ruby/pull/13159
2025-04-23rb_gc_impl_define_finalizer: unlock on early returnJean Boussier
2025-04-22Add missing lock in `rb_gc_impl_define_finalizer`Jean Boussier
`objspace->finalizer_table` must be synchronized, otherwise concurrent insertion from multiple ractors will cause a crash. Repro: ```ruby ractors = 5.times.map do |i| Ractor.new do 100_000.times.map do o = Object.new ObjectSpace.define_finalizer(o, ->(id) {}) o end end end ractors.each(&:take) ``` Notes: Merged: https://github.com/ruby/ruby/pull/13151
2025-04-15Bump crossbeam-channel from 0.5.13 to 0.5.15 in /gc/mmtkdependabot[bot]
Bumps [crossbeam-channel](https://github.com/crossbeam-rs/crossbeam) from 0.5.13 to 0.5.15. - [Release notes](https://github.com/crossbeam-rs/crossbeam/releases) - [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md) - [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-channel-0.5.13...crossbeam-channel-0.5.15) --- updated-dependencies: - dependency-name: crossbeam-channel dependency-version: 0.5.15 dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/13097
2025-04-15Lazily create `objspace->id_to_obj_tbl`Jean Boussier
This inverse table is only useful if `ObjectSpace._id2ref` is used, which is extremely rare. The only notable exception is the `drb` gem and even then it has an option not to rely on `_id2ref`. So if we assume this table will never be looked up, we can just not maintain it, and if it turns out `_id2ref` is called, we can lock the VM and re-build it. ``` compare-ruby: ruby 3.5.0dev (2025-04-10T09:44:40Z master 684cfa42d7) +YJIT +PRISM [arm64-darwin24] built-ruby: ruby 3.5.0dev (2025-04-10T10:13:43Z lazy-id-to-obj d3aa9626cc) +YJIT +PRISM [arm64-darwin24] warming up.. | |compare-ruby|built-ruby| |:----------|-----------:|---------:| |baseline | 26.364M| 25.974M| | | 1.01x| -| |object_id | 10.293M| 14.202M| | | -| 1.38x| ``` Notes: Merged: https://github.com/ruby/ruby/pull/13115
2025-04-08[ruby/mmtk] Do root scanning in scan_vm_specific_rootsKunshan Wang
We rely on scan_vm_specific_roots to reach all stacks via the following path: VM -> ractors -> threads -> fibers -> stacks https://github.com/ruby/mmtk/commit/0a6a835aaa
2025-04-01Remove incorrect assertionMatt Valentine-House
ractor_cache will always be NULL in this context Notes: Merged: https://github.com/ruby/ruby/pull/13031
2025-03-31Don't preserve `object_id` when moving object to another RactorJean Boussier
That seemed like the logical thing to do to me, but ko1 disagree. Notes: Merged: https://github.com/ruby/ruby/pull/13008
2025-03-31Ractor: Fix moving embedded objectsJean Boussier
[Bug #20271] [Bug #20267] [Bug #20255] `rb_obj_alloc(RBASIC_CLASS(obj))` will always allocate from the basic 40B pool, so if `obj` is larger than `40B`, we'll create a corrupted object when we later copy the shape_id. Instead we can use the same logic than ractor copy, which is to use `rb_obj_clone`, and later ask the GC to free the original object. We then must turn it into a `T_OBJECT`, because otherwise just changing its class to `RactorMoved` leaves a lot of ways to keep using the object, e.g.: ``` a = [1, 2, 3] Ractor.new{}.send(a, move: true) [].concat(a) # Should raise, but wasn't. ``` If it turns out that `rb_obj_clone` isn't performant enough for some uses, we can always have carefully crafted specialized paths for the types that would benefit from it. Notes: Merged: https://github.com/ruby/ruby/pull/13008
2025-03-13Output object_id in object metadata for MMTkPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12915
2025-02-24[ruby/mmtk] Trigger forced GC in GC.startKunshan Wang
We now use `MMTK::handle_user_collection_request(true, ...)` to force triggering a GC instead of enabling GC temporarily. https://github.com/ruby/mmtk/commit/02ef47f818
2025-02-20[ruby/mmtk] Fix compatibility for Rust 1.85Peter Zhu
https://github.com/ruby/mmtk/commit/9da566e26a
2025-02-19Implement rb_gc_object_metadata for MMTkPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12777
2025-02-10[ruby/mmtk] Set Immix as the default planPeter Zhu
https://github.com/ruby/mmtk/commit/e52b973611
2025-01-27Fix rb_gc_vm_weak_table_foreach compatibility for MMTKPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12629
2025-01-22[ruby/mmtk] Remove unused lazy_static dependencyPeter Zhu
https://github.com/ruby/mmtk/commit/f47a1e2d17
2025-01-21[ruby/mmtk] Bump mmtk-corePeter Zhu
Fixes a bug where there is an infinite loop when MMTK_HEAP_MIN is small. https://github.com/ruby/mmtk/commit/12c7ede20b
2025-01-17[ruby/mmtk] Add mmtk_heap_max to GC.configPeter Zhu
https://github.com/ruby/mmtk/commit/6a78ffaf16
2025-01-16[ruby/mmtk] Add mmtk_heap_min to GC.configPeter Zhu
https://github.com/ruby/mmtk/commit/5bbac70c69
2025-01-16[ruby/mmtk] Bump mmtk-corePeter Zhu
https://github.com/ruby/mmtk/commit/52b857ea04
2025-01-16[ruby/mmtk] Add mmtk_heap_mode to GC.configPeter Zhu
https://github.com/ruby/mmtk/commit/810f897603
2025-01-15[ruby/mmtk] Add mmtk_plan to GC.configPeter Zhu
https://github.com/ruby/mmtk/commit/67da9ea5b8
2025-01-15[ruby/mmtk] Fix mmtk.hPeter Zhu
https://github.com/ruby/mmtk/commit/dbb4036be9
2025-01-15[ruby/mmtk] Bump mmtk-corePeter Zhu
https://github.com/mmtk/mmtk-core/pull/1261 fixes an issue where the following script causes a Rust panic: GC.disable 10_000.times { Object.new } puts GC.stat https://github.com/ruby/mmtk/commit/6191ee994a
2025-01-14[ruby/mmtk] Add mmtk_worker_count to GC.configPeter Zhu
https://github.com/ruby/mmtk/commit/836a9059cb
2025-01-14[ruby/mmtk] Exit with error message if MMTK_PLAN is invalidPeter Zhu
https://github.com/ruby/mmtk/commit/79ce2008a3
2025-01-14[ruby/mmtk] Exit with error message if MMTK_HEAP_MODE is invalidPeter Zhu
https://github.com/ruby/mmtk/commit/c8b1f4c156
2025-01-14Simplify gc/mmtk/extconf.rbNobuyoshi Nakada
- Split static recipes to depend file. - Modify makefile configurations in the block to `create_makefile`. - Expand rust sources in extconf.rb instead of GNU make extension. TODO: pass `CARGO_TARGET_DIR` without shell syntax. Notes: Merged: https://github.com/ruby/ruby/pull/12572
2025-01-13[ruby/mmtk] Exit with error message if MMTK_HEAP_MAX is invalidPeter Zhu
https://github.com/ruby/mmtk/commit/4a24d55d91
2025-01-13[ruby/mmtk] Exit with error message if MMTK_HEAP_MIN is invalidPeter Zhu
https://github.com/ruby/mmtk/commit/1d2f7b9cfc
2025-01-13[ruby/mmtk] Exit with error message if MMTK_THREADS is invalidPeter Zhu
https://github.com/ruby/mmtk/commit/5c5c454f65
2025-01-13[ruby/mmtk] Enable immix_non_moving featurePeter Zhu
https://github.com/ruby/mmtk/commit/63ab563e04
2025-01-09[ruby/mmtk] Enable UNIQUE_OBJECT_ENQUEUING in MMTkPeter Zhu
UNIQUE_OBJECT_ENQUEUING guarantees that object marking is atomic so that an object cannot be marked more than once. https://github.com/ruby/mmtk/commit/2f97fd8207
2025-01-09[ruby/mmtk] Bump mmtk-core toPeter Zhu
https://github.com/ruby/mmtk/commit/68bf1b638263 https://github.com/ruby/mmtk/commit/ba1ec69bf6