Repository navigation
Emit switch in wasm - #4769
Emit switch in wasm#4769
Conversation
|
@jacano, |
|
Forget to mention, I also refactor the HelloWasm sample a little. Not sure if I took too much freedom here. |
| { | ||
| var target = _basicBlocks[_currentOffset + jmpDelta[i]]; | ||
| LLVM.AddCase(@switch, LLVM.ConstInt(LLVM.Int32Type(), (ulong)i, false), GetLLVMBasicBlockForBlock(target)); | ||
| ImportFallthrough(target); |
There was a problem hiding this comment.
Why did you end up calling ImportFallthrough here? It looks like for other branching we don't need that.
There was a problem hiding this comment.
I used it to add a valid terminator at the end of the switch block
| PrintLine("Hello from C#!"); | ||
| } | ||
|
|
||
| TwoByteStr str = new TwoByteStr() { first = 1, second = 2 }; |
There was a problem hiding this comment.
Nit -- indentation and tabs
| { | ||
| string s = "Hello from C#!"; | ||
| PrintString(s); | ||
| PrintLine("Hello from C#!"); |
There was a problem hiding this comment.
Nit -- indentation. Also, is this a tab? If so, please use spaces (and if I missed other tabs in this, please fix them as well)
There was a problem hiding this comment.
Yes, I got this wrong in the merge.
| { | ||
| PrintString("\n"); | ||
| PrintString("negInt test: Ok."); | ||
| PrintLine("negInt test: Ok."); |
There was a problem hiding this comment.
I'm replacing all of them
* Implement switch opcode Fix dotnet#4519
This is emit switch in LLVM for the WASM target.
As I said in my last contribution, I tried to implement the newarr op before this one but I think we first need the newobj.