-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[WebAssembly] Generate invokes with llvm.wasm.(re)throw #128105
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fexceptions -fcxx-exceptions -target-feature +reference-types -target-feature +exception-handling -target-feature +multivalue -exception-model=wasm -emit-llvm -o - %s | FileCheck %s | ||
|
||
// Check if __builtin_wasm_throw and __builtin_wasm_rethrow are correctly | ||
// invoked when placed in try-catch. | ||
|
||
void throw_in_try(void *obj) { | ||
try { | ||
__builtin_wasm_throw(0, obj); | ||
} catch (...) { | ||
} | ||
// CHECK: invoke void @llvm.wasm.throw(i32 0, ptr %{{.*}}) | ||
} | ||
|
||
void rethrow_in_try() { | ||
try { | ||
__builtin_wasm_rethrow(); | ||
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. This code actually does not make sense because this call is not within a |
||
} catch (...) { | ||
} | ||
// CHECK: invoke void @llvm.wasm.rethrow() | ||
} |
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.
do we also expect there to be an invoke when not placed in a try, or does
EmitRuntimeCallOrInvoke
handle that case automatically?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.
It handles the case automatically (hence
CallOrInvoke
)