Skip to content

Commit 6e907e0

Browse files
committed
Merge branch 'master' into feature/fork
2 parents f0e2755 + 86a94ca commit 6e907e0

File tree

23 files changed

+153
-31
lines changed

23 files changed

+153
-31
lines changed

.github/workflows/link-check.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Check broken links in docs
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check-broken-links-in-docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Restore lychee cache
14+
uses: actions/cache@v3
15+
with:
16+
path: .lycheecache
17+
key: cache-lychee-${{ github.sha }}
18+
restore-keys: cache-lychee-
19+
- name: Check links in docs/*.md
20+
uses: lycheeverse/lychee-action@v1.9.0
21+
with:
22+
fail: true
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
args: --base docs --accept '200,201,202,203,204,429,500' --no-progress --cache --max-cache-age 1d './docs/**/*.md' --exclude https://users.cecs.anu.edu.au/~steveb/pubs/papers/**
25+
- name: Save lychee cache
26+
uses: actions/cache/save@v3
27+
if: always()
28+
with:
29+
path: .lycheecache
30+
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

.github/workflows/merge-check.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
# - this action
2121
# - minimal tests for stable Rust (we allow them to fail)
2222
# - binding tests (it may take long to run)
23-
ignoreActions: "ready-to-merge,check-public-api-changes,minimal-tests-core/x86_64-unknown-linux-gnu/stable,minimal-tests-core/i686-unknown-linux-gnu/stable,minimal-tests-core/x86_64-apple-darwin/stable,v8-binding-test,openjdk-binding-test,jikesrvm-binding-test,julia-binding-test,ruby-binding-test (release),ruby-binding-test (debug)"
23+
ignoreActions: "ready-to-merge,check-broken-links-in-docs,check-public-api-changes,minimal-tests-core/x86_64-unknown-linux-gnu/stable,minimal-tests-core/i686-unknown-linux-gnu/stable,minimal-tests-core/x86_64-apple-darwin/stable,v8-binding-test,openjdk-binding-test,jikesrvm-binding-test,julia-binding-test,ruby-binding-test (release),ruby-binding-test (debug)"
2424
# This action uses API. We have a quota of 1000 per hour.
2525
checkInterval: 600
2626
env:

CHANGELOG.md

+23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
0.23.0 (2024-02-09)
2+
===
3+
4+
## What's Changed
5+
6+
### API
7+
* Ask from binding if GC is disabled by @udesou in https://github.com/mmtk/mmtk-core/pull/1075
8+
9+
### CI
10+
* Stop using the deprecated set-output in our CI configs by @qinsoon in https://github.com/mmtk/mmtk-core/pull/1059
11+
* Rename CI tests to minimal/extended tests by @qinsoon in https://github.com/mmtk/mmtk-core/pull/1073
12+
* Properly get PR number for merge group by @qinsoon in https://github.com/mmtk/mmtk-core/pull/1077
13+
14+
### Misc
15+
* MMTk Enhancement Proposal by @wks in https://github.com/mmtk/mmtk-core/pull/1056
16+
* Timeline visualization tool by @wks in https://github.com/mmtk/mmtk-core/pull/1022
17+
* Add a document for project principles by @qinsoon in https://github.com/mmtk/mmtk-core/pull/1069
18+
* Fix un-cleared VO bits for contiguous monotone PR by @wks in https://github.com/mmtk/mmtk-core/pull/1071
19+
* Use live memory to estimate collection pages in mem balancer by @qinsoon in https://github.com/mmtk/mmtk-core/pull/1050
20+
* Fix issues in sanity GC by @qinsoon in https://github.com/mmtk/mmtk-core/pull/1079
21+
22+
**Full Changelog**: https://github.com/mmtk/mmtk-core/compare/v0.22.1...v0.23.0
23+
124
0.22.1 (2024-01-11)
225
===
326

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mmtk"
3-
version = "0.22.1"
3+
version = "0.23.0"
44
authors = ["The MMTk Developers <>"]
55
edition = "2021"
66
license = "MIT OR Apache-2.0"
@@ -38,7 +38,7 @@ log = { version = "0.4", features = ["max_level_trace", "release_max_level_off"]
3838
memoffset = "0.9"
3939
mimalloc-sys = { version = "0.1.6", optional = true }
4040
# 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.
41-
mmtk-macros = { version="0.22.1", path = "macros/" }
41+
mmtk-macros = { version="0.23.0", path = "macros/" }
4242
num_cpus = "1.8"
4343
num-traits = "0.2"
4444
pfm = { version = "0.1.1", optional = true }

docs/userguide/src/portingguide/howto/nogc.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ You want to set up the binding repository/directory structure before starting th
1313

1414
[^1]: In fact some bindings may not be able to have such a directory structure due to the build tools used by the runtime.
1515

16-
- `mmtk-X/mmtk`: The MMTk side of the binding. To start with, this can be an almost direct copy of the [Dummy VM binding](https://github.com/mmtk/mmtk-core/tree/master/vmbindings/dummyvm). This is implemented in Rust.
16+
- `mmtk-X/mmtk`: The MMTk side of the binding. This includes the implementation of [the `VMBinding` trait](https://docs.mmtk.io/api/mmtk/vm/trait.VMBinding.html),
17+
and any necessary Rust code to integrate MMTk with the VM code (e.g. exposing MMTk functions to native, allowing up-calls from the MMTk binding to the runtime, etc).
18+
To start with, you can take a look at one of our officially maintained language bindings as an example: [OpenJDK](https://github.com/mmtk/mmtk-openjdk/tree/master/mmtk),
19+
[JikesRVM](https://github.com/mmtk/mmtk-jikesrvm/tree/master/mmtk), [V8](https://github.com/mmtk/mmtk-v8/tree/master/mmtk), [Julia](https://github.com/mmtk/mmtk-julia/tree/master/mmtk),
20+
[V8](https://github.com/mmtk/mmtk-v8/tree/master/mmtk).
1721
- `mmtk-X/X`: Runtime-specific code for integrating with MMTk. This should act as a bridge between the generic GC interface offered by the runtime and the MMTk side of the binding. This is implemented in the runtime's implementation language. Often this will be one of C or C++.
1822
- You can place your runtime repository at any path. For the sake of this guide, we assume you will place the runtime repo as a sibling of the binding repo. You can also clone `mmtk-core` to a local path. Using a local repo of `mmtk-core` can be beneficial to your development in case you need to make certain changes to the core (though this is unlikely).
1923

@@ -107,7 +111,7 @@ We recommend going through the [list of constants in the documentation](https://
107111
Now that we have most of the boilerplate set up, the next step is to initialize MMTk so that we can start allocating objects.
108112

109113
### Runtime-side changes
110-
Create a `mmtk.h` header file in the runtime folder of the binding (i.e. `mmtk-X/X`) which exposes the functions required to implement NoGC and `#include` it in the relevant runtime code. You can use the [DummyVM `mmtk.h` header file](https://github.com/mmtk/mmtk-core/blob/master/vmbindings/dummyvm/api/mmtk.h) as an example.
114+
Create a `mmtk.h` header file in the runtime folder of the binding (i.e. `mmtk-X/X`) which exposes the functions required to implement NoGC and `#include` it in the relevant runtime code. You can use the [example `mmtk.h` header file](https://github.com/mmtk/mmtk-core/blob/master/docs/header/mmtk.h) as an example.
111115

112116
**Note:** It is convention to prefix all MMTk API functions exposed with `mmtk_` in order to avoid name clashes. It is *highly* recommended that you follow this convention.
113117

docs/userguide/src/tutorial/code/mygc_semispace/global.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::scheduler::*; // Modify
1313
use crate::util::alloc::allocators::AllocatorSelector;
1414
use crate::util::copy::*;
1515
use crate::util::heap::VMRequest;
16+
use crate::util::heap::gc_trigger::SpaceStats;
1617
use crate::util::metadata::side_metadata::SideMetadataContext;
1718
use crate::util::opaque_pointer::*;
1819
use crate::vm::VMBinding;
@@ -78,7 +79,7 @@ impl<VM: VMBinding> Plan for MyGC<VM> {
7879
// ANCHOR_END: schedule_collection
7980

8081
// ANCHOR: collection_required()
81-
fn collection_required(&self, space_full: bool, _space: Option<&dyn Space<Self::VM>>) -> bool {
82+
fn collection_required(&self, space_full: bool, _space: Option<SpaceStats<Self::VM>>) -> bool {
8283
self.base().collection_required(self, space_full)
8384
}
8485
// ANCHOR_END: collection_required()

macros/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "mmtk-macros"
33
# the macro crate uses the same version as mmtk-core
4-
version = "0.22.1"
4+
version = "0.23.0"
55
edition = "2021"
66
license = "MIT OR Apache-2.0"
77
description = "MMTk macros provides procedural macros used by mmtk-core."

src/mmtk.rs

+5
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ impl<VM: VMBinding> MMTK<VM> {
371371
self.state.is_emergency_collection()
372372
}
373373

374+
/// Return true if the current GC is trigger manually by the user/binding.
375+
pub fn is_user_triggered_collection(&self) -> bool {
376+
self.state.is_user_triggered_collection()
377+
}
378+
374379
/// The application code has requested a collection. This is just a GC hint, and
375380
/// we may ignore it.
376381
///

src/plan/generational/copying/global.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::policy::space::Space;
1616
use crate::scheduler::*;
1717
use crate::util::alloc::allocators::AllocatorSelector;
1818
use crate::util::copy::*;
19+
use crate::util::heap::gc_trigger::SpaceStats;
1920
use crate::util::heap::VMRequest;
2021
use crate::util::Address;
2122
use crate::util::ObjectReference;
@@ -64,7 +65,7 @@ impl<VM: VMBinding> Plan for GenCopy<VM> {
6465
}
6566
}
6667

67-
fn collection_required(&self, space_full: bool, space: Option<&dyn Space<Self::VM>>) -> bool
68+
fn collection_required(&self, space_full: bool, space: Option<SpaceStats<Self::VM>>) -> bool
6869
where
6970
Self: Sized,
7071
{

src/plan/generational/global.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::policy::copyspace::CopySpace;
66
use crate::policy::space::Space;
77
use crate::scheduler::*;
88
use crate::util::copy::CopySemantics;
9+
use crate::util::heap::gc_trigger::SpaceStats;
910
use crate::util::heap::VMRequest;
1011
use crate::util::statistics::counter::EventCounter;
1112
use crate::util::Address;
@@ -98,7 +99,7 @@ impl<VM: VMBinding> CommonGenPlan<VM> {
9899
&self,
99100
plan: &P,
100101
space_full: bool,
101-
space: Option<&dyn Space<VM>>,
102+
space: Option<SpaceStats<VM>>,
102103
) -> bool {
103104
let cur_nursery = self.nursery.reserved_pages();
104105
let max_nursery = self.common.base.options.get_max_nursery_pages();
@@ -120,7 +121,7 @@ impl<VM: VMBinding> CommonGenPlan<VM> {
120121
// - if space is none, it is not. Return false immediately.
121122
// - if space is some, we further check its descriptor.
122123
let is_triggered_by_nursery = space.map_or(false, |s| {
123-
s.common().descriptor == self.nursery.common().descriptor
124+
s.0.common().descriptor == self.nursery.common().descriptor
124125
});
125126
// If space is full and the GC is not triggered by nursery, next GC will be full heap GC.
126127
if space_full && !is_triggered_by_nursery {

src/plan/generational/immix/global.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use crate::scheduler::GCWorkScheduler;
1717
use crate::scheduler::GCWorker;
1818
use crate::util::alloc::allocators::AllocatorSelector;
1919
use crate::util::copy::*;
20+
use crate::util::heap::gc_trigger::SpaceStats;
2021
use crate::util::heap::VMRequest;
2122
use crate::util::Address;
2223
use crate::util::ObjectReference;
@@ -90,7 +91,7 @@ impl<VM: VMBinding> Plan for GenImmix<VM> {
9091
)
9192
}
9293

93-
fn collection_required(&self, space_full: bool, space: Option<&dyn Space<Self::VM>>) -> bool
94+
fn collection_required(&self, space_full: bool, space: Option<SpaceStats<Self::VM>>) -> bool
9495
where
9596
Self: Sized,
9697
{

src/plan/global.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::scheduler::*;
1414
use crate::util::alloc::allocators::AllocatorSelector;
1515
use crate::util::copy::{CopyConfig, GCWorkerCopyContext};
1616
use crate::util::heap::gc_trigger::GCTrigger;
17+
use crate::util::heap::gc_trigger::SpaceStats;
1718
use crate::util::heap::layout::Mmapper;
1819
use crate::util::heap::layout::VMMap;
1920
use crate::util::heap::HeapMeta;
@@ -213,7 +214,7 @@ pub trait Plan: 'static + HasSpaces + Sync + Downcast {
213214
/// # Arguments
214215
/// * `space_full`: the allocation to a specific space failed, must recover pages within 'space'.
215216
/// * `space`: an option to indicate if there is a space that has failed in an allocation.
216-
fn collection_required(&self, space_full: bool, space: Option<&dyn Space<Self::VM>>) -> bool;
217+
fn collection_required(&self, space_full: bool, space: Option<SpaceStats<Self::VM>>) -> bool;
217218

218219
// Note: The following methods are about page accounting. The default implementation should
219220
// work fine for non-copying plans. For copying plans, the plan should override any of these methods

src/plan/immix/global.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::policy::space::Space;
1313
use crate::scheduler::*;
1414
use crate::util::alloc::allocators::AllocatorSelector;
1515
use crate::util::copy::*;
16+
use crate::util::heap::gc_trigger::SpaceStats;
1617
use crate::util::heap::VMRequest;
1718
use crate::util::metadata::side_metadata::SideMetadataContext;
1819
use crate::vm::VMBinding;
@@ -45,7 +46,7 @@ pub const IMMIX_CONSTRAINTS: PlanConstraints = PlanConstraints {
4546
};
4647

4748
impl<VM: VMBinding> Plan for Immix<VM> {
48-
fn collection_required(&self, space_full: bool, _space: Option<&dyn Space<Self::VM>>) -> bool {
49+
fn collection_required(&self, space_full: bool, _space: Option<SpaceStats<Self::VM>>) -> bool {
4950
self.base().collection_required(self, space_full)
5051
}
5152

src/plan/markcompact/global.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::scheduler::gc_work::*;
1515
use crate::scheduler::*;
1616
use crate::util::alloc::allocators::AllocatorSelector;
1717
use crate::util::copy::CopySemantics;
18+
use crate::util::heap::gc_trigger::SpaceStats;
1819
use crate::util::heap::VMRequest;
1920
use crate::util::metadata::side_metadata::SideMetadataContext;
2021
#[cfg(not(feature = "vo_bit"))]
@@ -159,7 +160,7 @@ impl<VM: VMBinding> Plan for MarkCompact<VM> {
159160
.add(crate::util::sanity::sanity_checker::ScheduleSanityGC::<Self>::new(self));
160161
}
161162

162-
fn collection_required(&self, space_full: bool, _space: Option<&dyn Space<Self::VM>>) -> bool {
163+
fn collection_required(&self, space_full: bool, _space: Option<SpaceStats<Self::VM>>) -> bool {
163164
self.base().collection_required(self, space_full)
164165
}
165166

src/plan/marksweep/global.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::plan::PlanConstraints;
1010
use crate::policy::space::Space;
1111
use crate::scheduler::GCWorkScheduler;
1212
use crate::util::alloc::allocators::AllocatorSelector;
13+
use crate::util::heap::gc_trigger::SpaceStats;
1314
use crate::util::heap::VMRequest;
1415
use crate::util::metadata::side_metadata::SideMetadataContext;
1516
use crate::util::VMWorkerThread;
@@ -64,7 +65,7 @@ impl<VM: VMBinding> Plan for MarkSweep<VM> {
6465
self.common.release(tls, true);
6566
}
6667

67-
fn collection_required(&self, space_full: bool, _space: Option<&dyn Space<Self::VM>>) -> bool {
68+
fn collection_required(&self, space_full: bool, _space: Option<SpaceStats<Self::VM>>) -> bool {
6869
self.base().collection_required(self, space_full)
6970
}
7071

src/plan/nogc/global.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::policy::immortalspace::ImmortalSpace;
99
use crate::policy::space::Space;
1010
use crate::scheduler::GCWorkScheduler;
1111
use crate::util::alloc::allocators::AllocatorSelector;
12+
use crate::util::heap::gc_trigger::SpaceStats;
1213
#[allow(unused_imports)]
1314
use crate::util::heap::VMRequest;
1415
use crate::util::metadata::side_metadata::SideMetadataContext;
@@ -45,7 +46,7 @@ impl<VM: VMBinding> Plan for NoGC<VM> {
4546
&NOGC_CONSTRAINTS
4647
}
4748

48-
fn collection_required(&self, space_full: bool, _space: Option<&dyn Space<Self::VM>>) -> bool {
49+
fn collection_required(&self, space_full: bool, _space: Option<SpaceStats<Self::VM>>) -> bool {
4950
self.base().collection_required(self, space_full)
5051
}
5152

src/plan/pageprotect/global.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::plan::PlanConstraints;
88
use crate::policy::space::Space;
99
use crate::scheduler::*;
1010
use crate::util::alloc::allocators::AllocatorSelector;
11+
use crate::util::heap::gc_trigger::SpaceStats;
1112
use crate::util::heap::VMRequest;
1213
use crate::util::metadata::side_metadata::SideMetadataContext;
1314
use crate::{plan::global::BasePlan, vm::VMBinding};
@@ -57,7 +58,7 @@ impl<VM: VMBinding> Plan for PageProtect<VM> {
5758
self.space.release(true);
5859
}
5960

60-
fn collection_required(&self, space_full: bool, _space: Option<&dyn Space<Self::VM>>) -> bool {
61+
fn collection_required(&self, space_full: bool, _space: Option<SpaceStats<Self::VM>>) -> bool {
6162
self.base().collection_required(self, space_full)
6263
}
6364

src/plan/semispace/global.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::policy::space::Space;
1111
use crate::scheduler::*;
1212
use crate::util::alloc::allocators::AllocatorSelector;
1313
use crate::util::copy::*;
14+
use crate::util::heap::gc_trigger::SpaceStats;
1415
use crate::util::heap::VMRequest;
1516
use crate::util::metadata::side_metadata::SideMetadataContext;
1617
use crate::util::opaque_pointer::VMWorkerThread;
@@ -95,7 +96,7 @@ impl<VM: VMBinding> Plan for SemiSpace<VM> {
9596
self.fromspace().release();
9697
}
9798

98-
fn collection_required(&self, space_full: bool, _space: Option<&dyn Space<Self::VM>>) -> bool {
99+
fn collection_required(&self, space_full: bool, _space: Option<SpaceStats<Self::VM>>) -> bool {
99100
self.base().collection_required(self, space_full)
100101
}
101102

src/plan/sticky/immix/global.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::policy::space::Space;
1010
use crate::util::copy::CopyConfig;
1111
use crate::util::copy::CopySelector;
1212
use crate::util::copy::CopySemantics;
13+
use crate::util::heap::gc_trigger::SpaceStats;
1314
use crate::util::metadata::side_metadata::SideMetadataContext;
1415
use crate::util::statistics::counter::EventCounter;
1516
use crate::vm::ObjectModel;
@@ -138,14 +139,13 @@ impl<VM: VMBinding> Plan for StickyImmix<VM> {
138139
.store(next_gc_full_heap, Ordering::Relaxed);
139140
}
140141

141-
fn collection_required(
142-
&self,
143-
space_full: bool,
144-
space: Option<&dyn crate::policy::space::Space<Self::VM>>,
145-
) -> bool {
142+
fn collection_required(&self, space_full: bool, space: Option<SpaceStats<Self::VM>>) -> bool {
146143
let nursery_full =
147144
self.immix.immix_space.get_pages_allocated() > self.options().get_max_nursery_pages();
148-
if space_full && space.is_some() && space.unwrap().name() != self.immix.immix_space.name() {
145+
if space_full
146+
&& space.is_some()
147+
&& space.as_ref().unwrap().0.name() != self.immix.immix_space.name()
148+
{
149149
self.next_gc_full_heap.store(true, Ordering::SeqCst);
150150
}
151151
self.immix.collection_required(space_full, space) || nursery_full

0 commit comments

Comments
 (0)