Skip to content

Commit e29efea

Browse files
committed
wit: change the ABI alignment of list<T> from 8 to 4
Fixes #288.
1 parent c53528d commit e29efea

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

wit/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func (*List) Size() uintptr { return 8 } // [2]int32
1717
// Align returns the [ABI byte alignment] a [List].
1818
//
1919
// [ABI byte alignment]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#alignment
20-
func (*List) Align() uintptr { return 8 } // [2]int32
20+
func (*List) Align() uintptr { return 4 }
2121

2222
// Flat returns the [flattened] ABI representation of [List].
2323
//

wit/list_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package wit
2+
3+
import "testing"
4+
5+
// https://github.com/bytecodealliance/go-modules/issues/288
6+
func TestListAlign(t *testing.T) {
7+
var l List
8+
got, want := l.Align(), uintptr(4)
9+
if got != want {
10+
t.Errorf("ABI alignment for list<T> is %d, expected %d", got, want)
11+
}
12+
}

0 commit comments

Comments
 (0)