diff --git a/.github/workflows/auto-merge-inner.yml b/.github/workflows/auto-merge-inner.yml index 75be7642ac..2219fecf6a 100644 --- a/.github/workflows/auto-merge-inner.yml +++ b/.github/workflows/auto-merge-inner.yml @@ -37,9 +37,9 @@ jobs: run: | if [[ "${{ inputs.repo }}" == ${{ inputs.base_repo }} ]] && [[ "${{ inputs.ref }}" == "master" ]]; then echo "Conditions not met" - echo "::set-output name=skip::true" + echo "skip=true" >> $GITHUB_OUTPUT else - echo "::set-output name=skip::false" + echo "skip=false" >> $GITHUB_OUTPUT fi shell: bash @@ -63,7 +63,7 @@ jobs: id: get-pr run: | PR_NUMBER=$(gh pr list --head ${{ inputs.ref }} --repo ${{ inputs.base_repo }} --json number --jq '.[0].number') - echo "::set-output name=pr_number::$PR_NUMBER" + echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/perf-compare-ci.yml b/.github/workflows/perf-compare-ci.yml index 7d84e7b035..a6cfbf17c8 100644 --- a/.github/workflows/perf-compare-ci.yml +++ b/.github/workflows/perf-compare-ci.yml @@ -61,8 +61,8 @@ jobs: return res.data.head.sha - id: print run: | - echo "::set-output name=mmtk_repo::${{ steps.core-repo.outputs.result }}" - echo "::set-output name=mmtk_ref::${{ steps.core-ref.outputs.result }}" + echo "mmtk_repo=${{ steps.core-repo.outputs.result }}" >> $GITHUB_OUTPUT + echo "mmtk_ref=${{ steps.core-ref.outputs.result }}" >> $GITHUB_OUTPUT # Run perf compare for JikesRVM jikesrvm-perf-compare: diff --git a/.github/workflows/perf-regression-ci.yml b/.github/workflows/perf-regression-ci.yml index ce6e1d7b61..95635e2519 100644 --- a/.github/workflows/perf-regression-ci.yml +++ b/.github/workflows/perf-regression-ci.yml @@ -61,7 +61,7 @@ jobs: sed -i 's/^#[[:space:]]mmtk/mmtk/g' mmtk-jikesrvm/mmtk/Cargo.toml - id: branch # we cannot use env vars in action input (the deploy step). So put the env var to this step's outputs. - run: echo "::set-output name=branch_name::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" + run: echo "branch_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT # run - name: Performance Run run: | @@ -137,7 +137,7 @@ jobs: sed -i 's/^#[[:space:]]mmtk/mmtk/g' mmtk-openjdk/mmtk/Cargo.toml - id: branch # we cannot use env vars in action input (the deploy step). So put the env var to this step's outputs. - run: echo "::set-output name=branch_name::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" + run: echo "branch_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT # run - name: Performance Run run: | @@ -207,7 +207,7 @@ jobs: rm -rf mmtk-openjdk/repos/openjdk/build - id: branch # we cannot use env vars in action input (the deploy step). So put the env var to this step's outputs. - run: echo "::set-output name=branch_name::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" + run: echo "branch_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT - name: Setup run: | ./ci-perf-kit/scripts/history-run-setup.sh diff --git a/.github/workflows/pr-binding-refs.yml b/.github/workflows/pr-binding-refs.yml index a4ab694a57..ead250df80 100644 --- a/.github/workflows/pr-binding-refs.yml +++ b/.github/workflows/pr-binding-refs.yml @@ -89,13 +89,13 @@ jobs: default_env: 'OPENJDK_BINDING_REPO=mmtk/mmtk-openjdk,OPENJDK_BINDING_REF=master,JIKESRVM_BINDING_REPO=mmtk/mmtk-jikesrvm,JIKESRVM_BINDING_REF=master,V8_BINDING_REPO=mmtk/mmtk-v8,V8_BINDING_REF=master,JULIA_BINDING_REPO=mmtk/mmtk-julia,JULIA_BINDING_REF=master,RUBY_BINDING_REPO=mmtk/mmtk-ruby,RUBY_BINDING_REF=master' - id: print run: | - echo "::set-output name=openjdk_binding_repo::${{ env.OPENJDK_BINDING_REPO }}" - echo "::set-output name=openjdk_binding_ref::${{ env.OPENJDK_BINDING_REF }}" - echo "::set-output name=jikesrvm_binding_repo::${{ env.JIKESRVM_BINDING_REPO }}" - echo "::set-output name=jikesrvm_binding_ref::${{ env.JIKESRVM_BINDING_REF }}" - echo "::set-output name=v8_binding_repo::${{ env.V8_BINDING_REPO }}" - echo "::set-output name=v8_binding_ref::${{ env.V8_BINDING_REF }}" - echo "::set-output name=julia_binding_repo::${{ env.JULIA_BINDING_REPO }}" - echo "::set-output name=julia_binding_ref::${{ env.JULIA_BINDING_REF }}" - echo "::set-output name=ruby_binding_repo::${{ env.RUBY_BINDING_REPO }}" - echo "::set-output name=ruby_binding_ref::${{ env.RUBY_BINDING_REF }}" + echo "openjdk_binding_repo=${{ env.OPENJDK_BINDING_REPO }}" >> $GITHUB_OUTPUT + echo "openjdk_binding_ref=${{ env.OPENJDK_BINDING_REF }}" >> $GITHUB_OUTPUT + echo "jikesrvm_binding_repo=${{ env.JIKESRVM_BINDING_REPO }}" >> $GITHUB_OUTPUT + echo "jikesrvm_binding_ref=${{ env.JIKESRVM_BINDING_REF }}" >> $GITHUB_OUTPUT + echo "v8_binding_repo=${{ env.V8_BINDING_REPO }}" >> $GITHUB_OUTPUT + echo "v8_binding_ref=${{ env.V8_BINDING_REF }}" >> $GITHUB_OUTPUT + echo "julia_binding_repo=${{ env.JULIA_BINDING_REPO }}" >> $GITHUB_OUTPUT + echo "julia_binding_ref=${{ env.JULIA_BINDING_REF }}" >> $GITHUB_OUTPUT + echo "ruby_binding_repo=${{ env.RUBY_BINDING_REPO }}" >> $GITHUB_OUTPUT + echo "ruby_binding_ref=${{ env.RUBY_BINDING_REF }}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/pre-review-ci.yml b/.github/workflows/pre-review-ci.yml index ccd1f1453f..23c0944d2b 100644 --- a/.github/workflows/pre-review-ci.yml +++ b/.github/workflows/pre-review-ci.yml @@ -26,7 +26,7 @@ jobs: run: | export MSRV=`cargo read-manifest | python -c 'import json,sys; print(json.load(sys.stdin)["rust_version"])'` export TEST=`cat rust-toolchain` - echo "::set-output name=array::[\"$MSRV\", \"$TEST\", \"stable\"]" + echo "array=[\"$MSRV\", \"$TEST\", \"stable\"]" >> $GITHUB_OUTPUT pre-code-review-checks: needs: setup-test-matrix diff --git a/macros/src/util.rs b/macros/src/util.rs index 19e9249338..5be31b6413 100644 --- a/macros/src/util.rs +++ b/macros/src/util.rs @@ -12,7 +12,7 @@ pub fn get_field_attribute<'f>(field: &'f Field, attr_name: &str) -> Option<&'f abort! { second_attr.path().span(), "Duplicated attribute: #[{}]", attr_name } }; - attrs.get(0).cloned() + attrs.first().cloned() } pub fn get_fields_with_attribute<'f>(fields: &'f FieldsNamed, attr_name: &str) -> Vec<&'f Field> { diff --git a/src/policy/marksweepspace/malloc_ms/mod.rs b/src/policy/marksweepspace/malloc_ms/mod.rs index 623c3cc234..e185be587d 100644 --- a/src/policy/marksweepspace/malloc_ms/mod.rs +++ b/src/policy/marksweepspace/malloc_ms/mod.rs @@ -2,4 +2,3 @@ mod global; mod metadata; pub use global::*; -pub use metadata::*; diff --git a/src/util/rust_util/mod.rs b/src/util/rust_util/mod.rs index e3596ff4a1..efd7224881 100644 --- a/src/util/rust_util/mod.rs +++ b/src/util/rust_util/mod.rs @@ -102,6 +102,29 @@ impl std::ops::Deref for InitializeOnce { unsafe impl Sync for InitializeOnce {} +/// This implements `std::array::from_fn` introduced in Rust 1.63. +/// We should replace this with the standard counterpart after bumping MSRV, +/// but we also need to evaluate whether it would use too much stack space (see code comments). +pub(crate) fn array_from_fn(mut cb: F) -> [T; N] +where + F: FnMut(usize) -> T, +{ + // Note on unsafety: An alternative to the unsafe implementation below is creating a fixed + // array of `[0, 1, 2, ..., N-1]` and using the `.map(cb)` method to create the result. + // However, the `array::map` method implemented in the standard library consumes a surprisingly + // large amount of stack space. For VMs that run on confined stacks, such as JikesRVM, that + // would cause stack overflow. Therefore we implement it manually using unsafe primitives. + let mut result_array: MaybeUninit<[T; N]> = MaybeUninit::zeroed(); + let array_ptr = result_array.as_mut_ptr(); + for index in 0..N { + let item = cb(index); + unsafe { + std::ptr::addr_of_mut!((*array_ptr)[index]).write(item); + } + } + unsafe { result_array.assume_init() } +} + #[cfg(test)] mod initialize_once_tests { use super::*; @@ -138,26 +161,3 @@ mod initialize_once_tests { assert_eq!(INITIALIZE_COUNT.load(Ordering::SeqCst), 1); } } - -/// This implements `std::array::from_fn` introduced in Rust 1.63. -/// We should replace this with the standard counterpart after bumping MSRV, -/// but we also need to evaluate whether it would use too much stack space (see code comments). -pub(crate) fn array_from_fn(mut cb: F) -> [T; N] -where - F: FnMut(usize) -> T, -{ - // Note on unsafety: An alternative to the unsafe implementation below is creating a fixed - // array of `[0, 1, 2, ..., N-1]` and using the `.map(cb)` method to create the result. - // However, the `array::map` method implemented in the standard library consumes a surprisingly - // large amount of stack space. For VMs that run on confined stacks, such as JikesRVM, that - // would cause stack overflow. Therefore we implement it manually using unsafe primitives. - let mut result_array: MaybeUninit<[T; N]> = MaybeUninit::zeroed(); - let array_ptr = result_array.as_mut_ptr(); - for index in 0..N { - let item = cb(index); - unsafe { - std::ptr::addr_of_mut!((*array_ptr)[index]).write(item); - } - } - unsafe { result_array.assume_init() } -} diff --git a/src/util/statistics/mod.rs b/src/util/statistics/mod.rs index 301bfed371..835d8e3cfd 100644 --- a/src/util/statistics/mod.rs +++ b/src/util/statistics/mod.rs @@ -1,4 +1,3 @@ -pub use self::counter::Counter; pub use self::counter::Timer; pub mod counter;