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

Simplify windows rescue block codegen #6649

Merged

Conversation

RX14
Copy link
Contributor

@RX14 RX14 commented Sep 2, 2018

Fixes #6605

@RX14 RX14 added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler platform:windows Windows support based on the MSVC toolchain / Win32 API labels Sep 2, 2018
@RX14 RX14 force-pushed the bugfix/windows-exceptions-break-next branch from 98c363c to ce5bf8e Compare September 3, 2018 12:49
@RX14 RX14 requested a review from bcardiff September 4, 2018 14:52
@RX14
Copy link
Contributor Author

RX14 commented Sep 7, 2018

Please can someone review this. The code comments should be fairly self-explanatory.

@ysbaddaden
Copy link
Contributor

Sorry, I'm not capable to review this correctly without deep diving into exceptions and the windows specific stuff. I'm going to trust you here.

@RX14
Copy link
Contributor Author

RX14 commented Sep 7, 2018

@ysbaddaden I was largely expecting bcardiff to review it, since he reviewed the original PR.

Copy link
Member

@bcardiff bcardiff left a comment

Choose a reason for hiding this comment

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

Double checking: the llvm for non windows seems to be the same, right?

I would like to translate the: .. It's difficult .., to a minimal snippet at least in a comment in the PR for future reference. What is the scenario in crystal code that is hard to track and is not handle by the current code structure and needs this change in how @rescue_block value is kept?

@catch_pad = old_catch_pad

# We are generating code for rescues, so set up the rescue block.
@rescue_block = rescue_ensure_block
Copy link
Member

Choose a reason for hiding this comment

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

why there is a need to set the rescue_block in every codegen of the node_rescues instead of setting the @rescue_block only once as before?

Copy link
Contributor Author

@RX14 RX14 Sep 8, 2018

Choose a reason for hiding this comment

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

match_any_type_id can generate a call, and in that case on windows, the call would be before we catchret, but it would be inside the rescue_ensure_block so would generate an invoke. This would mean we'd have invokes to the a catchswitch which is outside the catchpad from inside the catchpad which is disallowed. All this moving around is simply to prevent the call to ~match<Type> from being inside the rescue_ensure_block.

@RX14 RX14 added this to the 0.27.0 milestone Sep 8, 2018
@RX14 RX14 merged commit 1cbafcb into crystal-lang:master Sep 8, 2018
ezrast pushed a commit to ezrast/crystal that referenced this pull request Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. platform:windows Windows support based on the MSVC toolchain / Win32 API topic:compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants