Skip to content

Assert frame ownership is correct when popping a frame (debug only) - #2172

Merged
BCSharp merged 2 commits into
IronLanguages:mainfrom
BCSharp:pop-own-frame
Nov 18, 2026
Merged

BCSharp merged 2 commits into
IronLanguages:mainfrom
BCSharp:pop-own-frame

Conversation

@BCSharp

@BCSharp BCSharp commented Nov 17, 2026

Copy link
Copy Markdown
Member

No functional/performance changes in release builds (except for a small bugfix in OnDiskScriptCode.Run; is it even being used?)

In debug builds, frame pops from the framestack check if the frame being poped is the frame that was pushed by the same function. Popping a wrong frame can silently (or loudly) corrupt the frame stack. This check for generators was already done in #2146 and for coroutines in #2167. There was no such check for regular functions.

The check has already proven worthwhile: it exposed a bug in the DLR; I'll come with a PR for that.

@slozier slozier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Looks good to me!

@BCSharp
BCSharp merged commit 817a385 into IronLanguages:main Nov 18, 2026
41 checks passed
@BCSharp
BCSharp deleted the pop-own-frame branch November 18, 2026 19:48
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