Skip to content

Static check for noalloc: better user error#826

Merged
gretay-js merged 3 commits intooxcaml:mainfrom
gretay-js:alloc-check-better-error
Oct 4, 2022
Merged

Static check for noalloc: better user error#826
gretay-js merged 3 commits intooxcaml:mainfrom
gretay-js:alloc-check-better-error

Conversation

@gretay-js
Copy link
Copy Markdown
Contributor

On top of #825 - only the last two commits are new.

Print the source location of the function in the user error message when the [@assert noalloc] annotation on the function fails with -alloc-check flag.

The message is still not great: the debug info points to the function (not the annotation) because that's what we have in the backend. Perhaps we can carry around the location (or Debuginfo.t) along with the attribute, as part of Lambda.check_attribute, but it's not done for anything else of this sort, and seems not worth it (code complexity and memory footprint).

As it is, the check will already hold on to all the fun_dbg of the entire compilation unit until the end. If this becomes a problem, we can try checking annotations earlier, instead of waiting until the end of the compilation unit, but somethings cannot be resolved until the end.

Copy link
Copy Markdown
Contributor

@xclerc xclerc left a comment

Choose a reason for hiding this comment

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

(For 6229322, 114ab99, and 8853289.)

@gretay-js gretay-js force-pushed the alloc-check-better-error branch from 8853289 to 25e27c5 Compare October 4, 2022 13:49
@gretay-js gretay-js merged commit b830ed1 into oxcaml:main Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants