Skip to content

fix(interpreter): remove redundant stack underflow check in LOG instruction#3028

Merged
rakita merged 2 commits intobluealloy:mainfrom
Galoretka:fix/remove-redundant-log-stack-check
Oct 1, 2025
Merged

fix(interpreter): remove redundant stack underflow check in LOG instruction#3028
rakita merged 2 commits intobluealloy:mainfrom
Galoretka:fix/remove-redundant-log-stack-check

Conversation

@Galoretka
Copy link
Contributor

This change removes a duplicate stack length check before calling popn::() in the LOG instruction and uses halt_underflow() in the None arm for consistency. The explicit len() < N guard is unnecessary because popn::() already performs an underflow-safe check and returns None when insufficient items are present. Keeping both checks adds duplication without improving safety and can confuse future maintenance.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 30, 2025

CodSpeed Performance Report

Merging #3028 will not alter performance

Comparing Galoretka:fix/remove-redundant-log-stack-check (7f9153b) with main (c56206a)

Summary

✅ 173 untouched

}
let Some(topics) = context.interpreter.stack.popn::<N>() else {
context.interpreter.halt(InstructionResult::StackUnderflow);
context.interpreter.halt_underflow();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant check from line 370 was not removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant check from line 370 was not removed.

Yes, sorry , corrected

@rakita rakita merged commit fedda54 into bluealloy:main Oct 1, 2025
31 checks passed
@github-actions github-actions bot mentioned this pull request Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants