diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4deeb91b3..48e136132 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,7 @@ jobs: with: fetch-depth: 0 persist-credentials: false + - uses: ./.github/actions/cleanup-runner - &install-rust name: Install Rust run: | @@ -64,6 +65,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - *checkout + - uses: ./.github/actions/cleanup-runner - *install-rust - name: Determine midenc release tag id: midenc-release @@ -138,6 +140,7 @@ jobs: cancel-in-progress: false steps: - *checkout + - uses: ./.github/actions/cleanup-runner - *install-rust - name: Create release PR id: release-pr diff --git a/.github/workflows/release_old.yml b/.github/workflows/release_old.yml index 36fc3852d..5a11b2e59 100644 --- a/.github/workflows/release_old.yml +++ b/.github/workflows/release_old.yml @@ -22,6 +22,7 @@ jobs: contents: read steps: - uses: actions/checkout@v5 + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update diff --git a/hir/src/ir/value/aliasing.rs b/hir/src/ir/value/aliasing.rs index 2c2a82ac2..7cae284c8 100644 --- a/hir/src/ir/value/aliasing.rs +++ b/hir/src/ir/value/aliasing.rs @@ -17,22 +17,30 @@ pub struct ValueOrAlias { /// on the operand stack as a unique value. The alias identifier is usually generated from a /// counter of the unique instances of the value, but can be any unique integer value. alias_id: u8, + /// Cached result of `value.borrow().ty().size_in_felts()`, stored to avoid repeated + /// virtual dispatch through `dyn Value` in hot loops (solver, spill analysis). + stack_size: u8, } impl ValueOrAlias { /// Create a new [ValueOrAlias] from the given [ValueRef] pub fn new(value: ValueRef) -> Self { - let value_id = value.borrow().id(); + let borrowed = value.borrow(); + let value_id = borrowed.id(); + let stack_size = borrowed.ty().size_in_felts() as u8; + drop(borrowed); Self { value, value_id, + stack_size, alias_id: 0, } } /// Gets the effective size of this type on the Miden operand stack + #[inline(always)] pub fn stack_size(&self) -> usize { - self.value.borrow().ty().size_in_felts() + self.stack_size as usize } /// Create an aliased copy of this value, using `id` to uniquely identify the alias.