-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.area-dart2wasmIssues for the dart2wasm compiler.Issues for the dart2wasm compiler.library-ffi
Description
Currently, dart2wasm assumes that all structs are backed by a Pointer
.
sdk/pkg/dart2wasm/lib/intrinsics.dart
Lines 186 to 193 in 42ccd79
// _Compound._typedDataBase | |
if (cls == translator.ffiCompoundClass && name == '_typedDataBase') { | |
// A compound (subclass of Struct or Union) is represented by its i32 | |
// address. The _typedDataBase field contains a Pointer pointing to the | |
// compound, whose representation is the same. | |
codeGen.wrap(receiver, w.NumType.i32); | |
return w.NumType.i32; | |
} |
dart2wasm can currently assume this, because it does not implement support for:
- Returning struct by value from FFI calls.
Struct.create
.
If either of these features is implemented in dart2wasm, compounds cannot be represented as the int address of the pointer.
Also, it would break nested compounds if the suggestion in #54892 is implemented, as the _offsetInBytes
would not be saved anywhere.
Metadata
Metadata
Assignees
Labels
area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.area-dart2wasmIssues for the dart2wasm compiler.Issues for the dart2wasm compiler.library-ffi