Here's a reduced test case: ``` let { exports } = new WebAssembly.Instance(new WebAssembly.Module( wasmTextToBinary(` (module (func (export "g") (drop (block (result i32) (i32.clz (i32.const 1)) (if (i32.const 1) (return))))))`))); exports.g(); ``` And the corresponding generated code, annotated manually: ``` .balign 16, 0xf4 ;; hlt .Llabel0: cmpl $0x1, %r10d je .Lfrom10 ud2 .Lfrom10: push %r14 ; tls push %rbp ; saved bp movq %rsp, %rbp ; movq %rsp, %rax addq $0x0000, %rax ; reserve stack cmpq %rax, 0x28(%r14) ; check stack jb .Lfrom41 ud2 .Lfrom41: ;; beginFunction: enter body with masm.framePushed = 0 movl $0x1, %eax ; i32.const 1 bsrl %eax, %eax ; clz jne .Lfrom57 ; if clz operand wasn't zero, go ahead movl $0x3f, %eax ; in the zero case, consider as having 63 leading zeroes (?) .Lfrom57: xorl $31, %eax ; truncate to maximum 31 zeroes movl $0x1, %ecx ; push if test operand: 1 push %rax ; save clz result testl %ecx, %ecx ; test if operand je .Lfrom79 jmp .Lfrom84 .Llabel84: .Lfrom79: addq $8, %rsp jmp .Lfrom93 ;; endFunction: start of function epilogue int3 .Lfrom93: pop %rbp pop %r14 ret ;; endFunction: end of function epilogue ;; endFunction: start of OOL code ;; endFunction: end of OOL code for index 0 ud2 ``` It would seem that the "return" isn't getting compiled correctly in this case. I will poke. @gkw -- I am not able to see the pernosco session; though I auth'd my github, it says "You successfully logged in, but either you are not authorized to view this trace OR the debugging database for this trace has expired (typically 7 days after the trace was collected) and needs to be rebuilt. "
Bug 1590920 Comment 6 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Here's a reduced test case: ```js let { exports } = new WebAssembly.Instance(new WebAssembly.Module( wasmTextToBinary(` (module (func (export "g") (drop (block (result i32) (i32.clz (i32.const 1)) (if (i32.const 1) (return))))))`))); exports.g(); ``` And the corresponding generated code, annotated manually: ```asm .balign 16, 0xf4 ;; hlt .Llabel0: cmpl $0x1, %r10d je .Lfrom10 ud2 .Lfrom10: push %r14 ; tls push %rbp ; saved bp movq %rsp, %rbp ; movq %rsp, %rax addq $0x0000, %rax ; reserve stack cmpq %rax, 0x28(%r14) ; check stack jb .Lfrom41 ud2 .Lfrom41: ;; beginFunction: enter body with masm.framePushed = 0 movl $0x1, %eax ; i32.const 1 bsrl %eax, %eax ; clz jne .Lfrom57 ; if clz operand wasn't zero, go ahead movl $0x3f, %eax ; in the zero case, consider as having 63 leading zeroes (?) .Lfrom57: xorl $31, %eax ; truncate to maximum 31 zeroes movl $0x1, %ecx ; push if test operand: 1 push %rax ; save clz result testl %ecx, %ecx ; test if operand je .Lfrom79 jmp .Lfrom84 .Llabel84: .Lfrom79: addq $8, %rsp jmp .Lfrom93 ;; endFunction: start of function epilogue int3 .Lfrom93: pop %rbp pop %r14 ret ;; endFunction: end of function epilogue ;; endFunction: start of OOL code ;; endFunction: end of OOL code for index 0 ud2 ``` It would seem that the "return" isn't getting compiled correctly in this case. I will poke. @gkw -- I am not able to see the pernosco session; though I auth'd my github, it says "You successfully logged in, but either you are not authorized to view this trace OR the debugging database for this trace has expired (typically 7 days after the trace was collected) and needs to be rebuilt. "