Skip to content

avm2: Don't store num_locals in Activation#23069

Open
moulins wants to merge 1 commit intoruffle-rs:masterfrom
moulins:avm2-activation-no-num-locals
Open

avm2: Don't store num_locals in Activation#23069
moulins wants to merge 1 commit intoruffle-rs:masterfrom
moulins:avm2-activation-no-num-locals

Conversation

@moulins
Copy link
Contributor

@moulins moulins commented Feb 18, 2026

A (micro-)optimization that saves one usize per Activation on the stack.

To enable this:

  • in Op::Debug, store whether the stack slot is out-of-bounds or not;
  • in exception handling, retrieve the number of locals (used for resetting the stack) directly from the current method's body; this is slightly slower but catching errors is rare so this doesn't matter much.

@moulins moulins added A-avm2 Area: AVM2 (ActionScript 3) T-perf Type: Performance Improvements labels Feb 18, 2026
To enable this:
- in `Op::Debug`, store whether the stack slot is out-of-bounds or not;
- in exception handling, retrieve the number of locals (used for resetting the
  stack) directly from the current method's body; this is slightly slower but
  catching errors is rare so this doesn't matter much.
@moulins moulins force-pushed the avm2-activation-no-num-locals branch from e03a52a to 3b23c62 Compare February 18, 2026 17:00
@moulins moulins added the waiting-on-review Waiting on review from a Ruffle team member label Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm2 Area: AVM2 (ActionScript 3) T-perf Type: Performance Improvements waiting-on-review Waiting on review from a Ruffle team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant