bb483f34a3
TEST=tests/ffi/* CoreLibraryReviewExempt: VM only Closes: https://github.com/dart-lang/sdk/issues/52366 Change-Id: I545a323f48d955b591cedf2dae7106d9004242e2 Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398621 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
128 lines
5.9 KiB
Plaintext
128 lines
5.9 KiB
Plaintext
library #lib;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "dart:ffi" as ffi;
|
|
import "dart:typed_data" as typ;
|
|
|
|
import "dart:ffi";
|
|
|
|
@#C9
|
|
final class MyStruct extends ffi::Struct {
|
|
synthetic constructor •() → self::MyStruct
|
|
: super ffi::Struct::•()
|
|
;
|
|
constructor #fromTypedDataBase(synthesized core::Object #typedDataBase, synthesized core::int #offsetInBytes) → self::MyStruct
|
|
: super ffi::Struct::_fromTypedDataBase(#typedDataBase, #offsetInBytes)
|
|
;
|
|
@#C11
|
|
constructor #fromTypedData(synthesized typ::TypedData #typedData, synthesized core::int #offset, synthesized core::int #sizeInBytes) → self::MyStruct
|
|
: super ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
|
|
;
|
|
@#C12
|
|
@#C11
|
|
get a() → ffi::Array<ffi::Int8>
|
|
return new ffi::Array::_<ffi::Int8>(this.{ffi::_Compound::_typedDataBase}{core::Object}, self::MyStruct::a#offsetOf.{core::num::+}(this.{ffi::_Compound::_offsetInBytes}{core::int}){(core::num) → core::num}, #C3, #C4, #C13);
|
|
@#C12
|
|
@#C11
|
|
set a(synthesized ffi::Array<ffi::Int8> #externalFieldValue) → void
|
|
return ffi::_memCopy(this.{ffi::_Compound::_typedDataBase}{core::Object}, self::MyStruct::a#offsetOf.{core::num::+}(this.{ffi::_Compound::_offsetInBytes}{core::int}){(core::num) → core::num}, #externalFieldValue.{ffi::_Compound::_typedDataBase}{core::Object}, #externalFieldValue.{ffi::_Compound::_offsetInBytes}{core::int}, #C14.{core::List::[]}(ffi::_abi()){(core::int) → core::int});
|
|
@#C11
|
|
static get a#offsetOf() → core::int
|
|
return #C16.{core::List::[]}(ffi::_abi()){(core::int) → core::int};
|
|
@#C11
|
|
static get #sizeOf() → core::int
|
|
return #C14.{core::List::[]}(ffi::_abi()){(core::int) → core::int};
|
|
}
|
|
@#C19
|
|
final class MyUnion extends ffi::Union {
|
|
synthetic constructor •() → self::MyUnion
|
|
: super ffi::Union::•()
|
|
;
|
|
constructor #fromTypedDataBase(synthesized core::Object #typedDataBase, synthesized core::int #offsetInBytes) → self::MyUnion
|
|
: super ffi::Union::_fromTypedDataBase(#typedDataBase, #offsetInBytes)
|
|
;
|
|
@#C11
|
|
constructor #fromTypedData(synthesized typ::TypedData #typedData, synthesized core::int #offset, synthesized core::int #sizeInBytes) → self::MyUnion
|
|
: super ffi::Union::_fromTypedData(#typedData, #offset, #sizeInBytes)
|
|
;
|
|
@#C20
|
|
@#C11
|
|
get a() → core::int
|
|
return ffi::_loadInt8(this.{ffi::_Compound::_typedDataBase}{core::Object}, self::MyUnion::a#offsetOf.{core::num::+}(this.{ffi::_Compound::_offsetInBytes}{core::int}){(core::num) → core::num});
|
|
@#C20
|
|
@#C11
|
|
set a(synthesized core::int #externalFieldValue) → void
|
|
return ffi::_storeInt8(this.{ffi::_Compound::_typedDataBase}{core::Object}, self::MyUnion::a#offsetOf.{core::num::+}(this.{ffi::_Compound::_offsetInBytes}{core::int}){(core::num) → core::num}, #externalFieldValue);
|
|
@#C11
|
|
static get a#offsetOf() → core::int
|
|
return #C16.{core::List::[]}(ffi::_abi()){(core::int) → core::int};
|
|
@#C11
|
|
static get #sizeOf() → core::int
|
|
return #C22.{core::List::[]}(ffi::_abi()){(core::int) → core::int};
|
|
}
|
|
static method main() → void {
|
|
final self::MyStruct myStruct = new self::MyStruct::#fromTypedDataBase(typ::Uint8List::•(self::MyStruct::#sizeOf), #C15);
|
|
self::myNative#C(myStruct);
|
|
final self::MyUnion myUnion = new self::MyUnion::#fromTypedDataBase(typ::Uint8List::•(self::MyUnion::#sizeOf), #C15);
|
|
self::myNative2#C(myUnion);
|
|
self::myNative3#C(myStruct.{self::MyStruct::a}{ffi::Array<ffi::Int8>});
|
|
}
|
|
@#C28
|
|
@#C30
|
|
external static method myNative(ffi::Pointer<self::MyStruct> pointer) → void;
|
|
@#C33
|
|
@#C34
|
|
external static method myNative2(ffi::Pointer<self::MyUnion> pointer) → void;
|
|
@#C37
|
|
@#C38
|
|
external static method myNative3(ffi::Pointer<ffi::Int8> pointer) → void;
|
|
@#C28
|
|
@#C30
|
|
external static method myNative#C(ffi::_Compound pointer) → void;
|
|
@#C33
|
|
@#C34
|
|
external static method myNative2#C(ffi::_Compound pointer) → void;
|
|
@#C37
|
|
@#C38
|
|
external static method myNative3#C(ffi::_Compound pointer) → void;
|
|
constants {
|
|
#C1 = "vm:ffi:struct-fields"
|
|
#C2 = TypeLiteralConstant(ffi::Int8)
|
|
#C3 = 10
|
|
#C4 = false
|
|
#C5 = ffi::_FfiInlineArray {elementType:#C2, length:#C3, variableLength:#C4}
|
|
#C6 = <core::Type>[#C5]
|
|
#C7 = null
|
|
#C8 = ffi::_FfiStructLayout {fieldTypes:#C6, packing:#C7}
|
|
#C9 = core::pragma {name:#C1, options:#C8}
|
|
#C10 = "vm:prefer-inline"
|
|
#C11 = core::pragma {name:#C10, options:#C7}
|
|
#C12 = ffi::_ArraySize<ffi::NativeType> {dimension1:#C3, dimension2:#C7, dimension3:#C7, dimension4:#C7, dimension5:#C7, dimensions:#C7, variableDimension:#C7}
|
|
#C13 = <core::int>[]
|
|
#C14 = <core::int>[#C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3, #C3]
|
|
#C15 = 0
|
|
#C16 = <core::int>[#C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15, #C15]
|
|
#C17 = <core::Type>[#C2]
|
|
#C18 = ffi::_FfiStructLayout {fieldTypes:#C17, packing:#C7}
|
|
#C19 = core::pragma {name:#C1, options:#C18}
|
|
#C20 = ffi::Int8 {}
|
|
#C21 = 1
|
|
#C22 = <core::int>[#C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21, #C21]
|
|
#C23 = "cfe:ffi:native-marker"
|
|
#C24 = "myNative"
|
|
#C25 = "#lib"
|
|
#C26 = true
|
|
#C27 = ffi::Native<(ffi::Pointer<self::MyStruct>) → ffi::Void> {symbol:#C24, assetId:#C25, isLeaf:#C26}
|
|
#C28 = core::pragma {name:#C23, options:#C27}
|
|
#C29 = "vm:ffi:native"
|
|
#C30 = core::pragma {name:#C29, options:#C27}
|
|
#C31 = "myNative2"
|
|
#C32 = ffi::Native<(ffi::Pointer<self::MyUnion>) → ffi::Void> {symbol:#C31, assetId:#C25, isLeaf:#C26}
|
|
#C33 = core::pragma {name:#C23, options:#C32}
|
|
#C34 = core::pragma {name:#C29, options:#C32}
|
|
#C35 = "myNative3"
|
|
#C36 = ffi::Native<(ffi::Pointer<ffi::Int8>) → ffi::Void> {symbol:#C35, assetId:#C25, isLeaf:#C26}
|
|
#C37 = core::pragma {name:#C23, options:#C36}
|
|
#C38 = core::pragma {name:#C29, options:#C36}
|
|
}
|