Closed Bug 1661723 Opened 4 years ago Closed 4 years ago

Cranelift: test failure when running WPT wasm/jsapi/constructors/multi-value.any.js

Categories

(Core :: JavaScript: WebAssembly, defect)

defect

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: bbouvier, Assigned: bbouvier)

References

Details

Attachments

(2 files)

Can be reproduced with the following mach line:

./mach jstests --shell /path/to/shell/dist/bin/js --wpt=enabled wasm

Results:

## wasm/jsapi/constructor/multi-value.any.js: rc = -11, run time = 1.634538

Harness status: CRASH (Exit code reported crash)
REGRESSION - wasm/jsapi/constructor/multi-value.any.js

Still needs to be investigated.

Reduced test case, definitely related to multi-value:

let { exports } = new WebAssembly.Instance(
    new WebAssembly.Module(wasmTextToBinary(`
    (module
        (func (import "module" "fn") (param f64 i32) (result i32 f64))
        (func (export "f") (result i32)
            f64.const 4.2
            i32.const 7
            call 0
            drop
        )
    )
    `)),
    {
        "module": {
          fn(f32, i32) {
            assertEq(f32, 4.2);
            assertEq(i32, 7);
            return [2, 7.3];
          },
        }
    });

assertEq(exports.f(), 2);

looking at the assembly of the cranelift's function body, right before the call, it seems that the double and the integer parameters are put in registers, and no stack space is provided to the callee for the multiple returns. This might be the fallout of a recent call ABI refactoring; will look on monday.

[Codegen] 0x7f8748a170b4  5c000040  ldr     d0, pc+8 (addr 0x7f8748a170bc)
[Codegen] 0x7f8748a170b8  14000003  b       #+0xc (addr 0x7f8748a170c4)
[Codegen] 0x7f8748a170bc  cccccccd  unallocated (Unallocated)
[Codegen] 0x7f8748a170c0  4010cccc  unallocated (Unallocated)
[Codegen] 0x7f8748a170c4  d28000e0  mov     x0, #0x7
[Codegen] 0x7f8748a170c8  2a0003e0  mov     w0, w0
[Codegen] 0x7f8748a170cc  d63f0020  blr     x1

Fixed by https://github.com/bytecodealliance/wasmtime/pull/2177; we'll need a crate bump, and I'll add the test to Spidermonkey, since it's simple enough and I recall it's the second time I run into this (at least in Cranelift).

Assignee: nobody → bbouvier
Status: NEW → ASSIGNED

Depends on D88784

Attachment #9173003 - Attachment description: Bug 1661723; Bump Cranelift to a7f7c23bf9c37c642da962d575b7c99007918872; r?lth → Bug 1661723; Bump Cranelift to a7f7c23bf9c37c642da962d575b7c99007918872; r=lth
Attachment #9173004 - Attachment description: Bug 1661723: Add test case; r?lth → Bug 1661723: Add test case; r=lth
Pushed by bbouvier@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e3be5f8c4f2a
; Bump Cranelift to a7f7c23bf9c37c642da962d575b7c99007918872; r=lth
https://hg.mozilla.org/integration/autoland/rev/03aa9e68f1a5
Add test case; r=lth
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: