WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
252719
[Wasm-GC] Air and B3 generate struct.get/set code with wrong offsets
https://bugs.webkit.org/show_bug.cgi?id=252719
Summary
[Wasm-GC] Air and B3 generate struct.get/set code with wrong offsets
Tim Chevalier
Reported
2023-02-21 19:27:04 PST
The following test: ``` //@ runWebAssemblySuite("--useWebAssemblyTypedFunctionReferences=true", "--useWebAssemblyGC=true") import * as assert from "../assert.js"; import { compile, instantiate } from "./wast-wrapper.js"; function module(bytes, valid = true) { let buffer = new ArrayBuffer(bytes.length); let view = new Uint8Array(buffer); for (let i = 0; i < bytes.length; ++i) { view[i] = bytes.charCodeAt(i); } return new WebAssembly.Module(buffer); } let iterations = 10; function testIntFields() { let m = instantiate(` (module (type $s (struct (field i32) (field i32))) (func $new (export "new") (result (ref $s)) (struct.new_canon $s (i32.const 1) (i32.const 5))) (func (export "len0") (result i32) (struct.get $s 0 (call $new))) (func (export "len1") (result i32) (struct.get $s 1 (call $new))))`); for (var i = 0; i < 10; i++) { assert.eq(m.exports.len0(), 1); assert.eq(m.exports.len1(), 5); } } testIntFields(); ``` fails, because the `addStructGet` and `addStructSet` methods in `WasmAirIRGeneratorBase.h` emit a load of `s.m_payload.m_storage` (if `s` is the struct object being operated on) followed by a load or store with the offset for the field being read from/written to. This is incorrect because the field offset is relative to `s.m_payload.m_storage.data()`, not `s.m_payload.m_storage`. I'll be submitting a PR.
Attachments
Add attachment
proposed patch, testcase, etc.
Tim Chevalier
Comment 1
2023-02-21 20:02:52 PST
Pull request:
https://github.com/WebKit/WebKit/pull/10490
Radar WebKit Bug Importer
Comment 2
2023-02-28 19:28:14 PST
<
rdar://problem/106065099
>
EWS
Comment 3
2023-03-20 17:33:45 PDT
Committed
261899@main
(2e2ee48591cd): <
https://commits.webkit.org/261899@main
> Reviewed commits have been landed. Closing PR #10490 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug