Closed Bug 1636235 Opened 5 years ago Closed 5 years ago

Baseline: assorted SIMD corner case bugs

Categories

(Core :: JavaScript: WebAssembly, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: lth, Assigned: lth)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

needResultRegisters() only allocates SIMD registers if which == RegKind::All, so we must free only in that situation too. Slightly surprising that we've not stumbled across that in an assertion, but needIntegerResultRegisters() is only used by br_table and it could be that no v128 test uses br_table; will test this hypothesis.

Test case, run with --wasm-simd in a debug build and we trigger the expected assert:

new WebAssembly.Module(wasmTextToBinary(`
  (module
    (memory (export "mem") 1 1)
    (func $f (result v128)
      (block $B1 (result v128)
        (v128.const i32x4 1 2 3 4)
        (br_table $B1 (i32.const 0)))))`))
Summary: Baseline: freeResultRegisters must free V128 regs only if which == RegKind::All → Baseline: assorted SIMD corner case bugs

Another one: when materializing values during popStackResults, we need to handle the ConstV128 case. (This is yet another instance of the general badness of allowing a default on an enum class, as an exhaustive switch would have caught this problem a long time ago.)

There was a missing guard when freeing the SIMD result register; it
was freed unconditionally, but this would fail for br_table, when only
the int register is needed.

There was a missing case when materializing constants during
popStackResults, we need to handle V128 here.

In both cases the underlying cause was iffy test coverage, though in
the latter case the problem is also that we allow the use of switch
with default for enum class value sets, thus masking problems where a
case that must be covered is not covered.

Attachment #9146711 - Attachment description: Bug 1636235 - Fix corner case SIMD bugs. → Bug 1636235 - Fix corner case SIMD bugs. r=wingo
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: