-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Support exception handling on windows #6419
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,14 @@ module Crystal | |
value | ||
end | ||
|
||
def printf(format, args = [] of LLVM::Value) | ||
call @printf, [global_string_pointer(format)] + args | ||
def printf(format, args = [] of LLVM::Value, catch_pad = nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. call to printf do really need to be handled with the funclet? Up to know the call was never replaced by an invoke, so it was assumed to never raise AFAIK. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. every call inside a catch pad needs a funclet. This is not about call/invoke and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. I also missed this was inside the builder, outside the codegen where the handling of the operand bundle is already handled. |
||
if catch_pad | ||
funclet = build_operand_bundle_def("funclet", [catch_pad]) | ||
else | ||
funclet = LLVM::OperandBundleDef.null | ||
end | ||
|
||
call @printf, [global_string_pointer(format)] + args, bundle: funclet | ||
end | ||
|
||
def position_at_end(block) | ||
|
@@ -54,6 +60,10 @@ module Crystal | |
@builder.insert_block | ||
end | ||
|
||
def build_operand_bundle_def(name, values : Array(LLVM::Value)) | ||
@builder.build_operand_bundle_def(name, values) | ||
end | ||
|
||
def to_unsafe | ||
@builder.to_unsafe | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, returns inside a catch_pad section needs to be handled different. I fail to see that the current specs handle return with values. I neither find specs added on this topic, so maybe is something to add in the suite. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I didn't really look at the spec suite since it's impossible to run the compiler spec suite on windows yet because the compiler depends on a bunch of stuff thats not ported.