Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute max call depth #282

Merged
merged 1 commit into from
Nov 9, 2022
Merged

Compute max call depth #282

merged 1 commit into from
Nov 9, 2022

Conversation

eponier
Copy link
Contributor

@eponier eponier commented Nov 7, 2022

Proof of concept @bgregoir
Should a function that calls no other function have 0 or 1 for "max call depth"?

@eponier eponier marked this pull request as ready for review November 9, 2022 12:04
@eponier
Copy link
Contributor Author

eponier commented Nov 9, 2022

Should be ready. It computes the max call depth at stack allocation time and puts this piece of information in stk_fun_extra. There is also an annotation if the user wants to specify an expected value.

Copy link
Member

@vbgl vbgl left a comment

Choose a reason for hiding this comment

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

Can you please add a test-case showing the annotation in use?

Also, this deserves an entry in the change log.

compiler/src/stackAlloc.ml Outdated Show resolved Hide resolved
@eponier eponier force-pushed the call_depth branch 3 times, most recently from df93aa7 to f404880 Compare November 9, 2022 13:23
@eponier
Copy link
Contributor Author

eponier commented Nov 9, 2022

I added a changelog entry, and two test cases: one succeeding, the other failing.

@vbgl
Copy link
Member

vbgl commented Nov 9, 2022

Please add an export function in the successful example. (The compiler has unspecified behavior on programs without any export function.)

@eponier
Copy link
Contributor Author

eponier commented Nov 9, 2022

Done.

Copy link
Member

@vbgl vbgl left a comment

Choose a reason for hiding this comment

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

Thanks. I’ll merge as soon as CI gets green.

@vbgl vbgl merged commit 6a79c48 into main Nov 9, 2022
@vbgl vbgl deleted the call_depth branch November 9, 2022 14:07
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