Repository navigation
Throw opcode with trap. - #4736
Conversation
Name parameter updated in LLVM build methods to reflect the operation being built. Use PushExpression method instead of direct push to stack.
# Conflicts: # tests/src/Simple/HelloWasm/Program.cs
|
@jacano, |
|
I didn't notice I included a draft version of the newarr op. Sorry for that. I'm removing it. |
|
@dotnet-bot test Ubuntu Release please |
| { | ||
| var exceptionObject = _stack.Pop(); | ||
|
|
||
| if (TrapFunction.Pointer == IntPtr.Zero) |
There was a problem hiding this comment.
Rather than copying this logic, can you please factor it out into the property getter or somewhere else? I imagine we'll need trap in another couple of places too
There was a problem hiding this comment.
Of course, in fact I did it but them I discarded it because I wanted to focus only on the throw method : S
| } | ||
| LLVM.BuildCall(_builder, TrapFunction, Array.Empty<LLVMValueRef>(), string.Empty); | ||
|
|
||
| LLVM.BuildUnreachable(_builder); |
There was a problem hiding this comment.
Out of curiosity, was this required? My reading on llvm.trap is that LLVM already knows code afterward is unreachable.
There was a problem hiding this comment.
Yes, right now it's completely useless. I guess the same, trap would also instruct the optimizer to discard the rest of the code. I just thought that it could be useful (as a hint for me or other committers) when a real implementation for throw gets implemented.
I'm going to remove it.
|
Thanks, @jacano! |
* Implement neg (float/integer) and not IL instructions. Fixes dotnet#4524 and dotnet#4525 * Neg and not basic tests added to HelloWasm. Name parameter updated in LLVM build methods to reflect the operation being built. Use PushExpression method instead of direct push to stack. * Implement throw opcode. Fix for dotnet#4528 * Unreachable removed and trap call refactored in throw import method.
I was unable to add a test for this. Without try ... catch I don't know how to really check.
Anyway, I tried with "throw null;" and the trap gets generated.