bde9578a39
Introduces the class `_Compound extends NativeType`, for sharing between `Struct` and `Union`. Does minimal changes to CFE and IL construction. Follow up refactor CLs rename everything. Bug: https://github.com/dart-lang/sdk/issues/38491 tools/test.py ffi ffi_2 TEST=tests/ffi(_2)/(.*)by_value_(*.)_test.dart Change-Id: I276ceb9249c20bd331c2f8b6ef64e35acb525e9c Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194765 Reviewed-by: Aske Simon Christensen <askesc@google.com>
65 lines
2.6 KiB
Plaintext
65 lines
2.6 KiB
Plaintext
library /*isNonNullableByDefault*/;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "dart:ffi" as ffi;
|
|
|
|
import "dart:ffi";
|
|
import "package:ffi/ffi.dart";
|
|
|
|
@#C7
|
|
class Coordinate extends ffi::Struct {
|
|
static final field core::int* #sizeOf = (#C10).{core::List::[]}(ffi::_abi())/*isLegacy*/;
|
|
constructor #fromTypedDataBase(core::Object #typedDataBase) → self::Coordinate
|
|
: super ffi::Struct::_fromTypedDataBase(#typedDataBase)
|
|
;
|
|
@#C11
|
|
get x() → core::double
|
|
return ffi::_loadDouble(this.{ffi::_Compound::_typedDataBase}, (#C13).{core::List::[]}(ffi::_abi()));
|
|
@#C11
|
|
set x(core::double #externalFieldValue) → void
|
|
return ffi::_storeDouble(this.{ffi::_Compound::_typedDataBase}, (#C13).{core::List::[]}(ffi::_abi()), #externalFieldValue);
|
|
@#C11
|
|
get y() → core::double
|
|
return ffi::_loadDouble(this.{ffi::_Compound::_typedDataBase}, (#C15).{core::List::[]}(ffi::_abi()));
|
|
@#C11
|
|
set y(core::double #externalFieldValue) → void
|
|
return ffi::_storeDouble(this.{ffi::_Compound::_typedDataBase}, (#C15).{core::List::[]}(ffi::_abi()), #externalFieldValue);
|
|
get next() → ffi::Pointer<self::Coordinate>
|
|
return ffi::_fromAddress<self::Coordinate>(ffi::_loadIntPtr(this.{ffi::_Compound::_typedDataBase}, (#C17).{core::List::[]}(ffi::_abi())));
|
|
set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void
|
|
return ffi::_storeIntPtr(this.{ffi::_Compound::_typedDataBase}, (#C17).{core::List::[]}(ffi::_abi()), #externalFieldValue.{ffi::Pointer::address});
|
|
static factory allocate(ffi::Allocator allocator, core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
|
|
return let final self::Coordinate #t1 = new self::Coordinate::#fromTypedDataBase(allocator.{ffi::Allocator::allocate}<self::Coordinate>(self::Coordinate::#sizeOf)!) in block {
|
|
#t1.{self::Coordinate::x} = x;
|
|
#t1.{self::Coordinate::y} = y;
|
|
#t1.{self::Coordinate::next} = next;
|
|
} =>#t1;
|
|
}
|
|
}
|
|
static method main() → dynamic {}
|
|
|
|
constants {
|
|
#C1 = "vm:ffi:struct-fields"
|
|
#C2 = TypeLiteralConstant(ffi::Double)
|
|
#C3 = TypeLiteralConstant(ffi::Pointer<ffi::NativeType>)
|
|
#C4 = <core::Type>[#C2, #C2, #C3]
|
|
#C5 = null
|
|
#C6 = ffi::_FfiStructLayout {fieldTypes:#C4, packing:#C5}
|
|
#C7 = core::pragma {name:#C1, options:#C6}
|
|
#C8 = 24
|
|
#C9 = 20
|
|
#C10 = <core::int*>[#C8, #C9, #C8]
|
|
#C11 = ffi::Double {}
|
|
#C12 = 0
|
|
#C13 = <core::int*>[#C12, #C12, #C12]
|
|
#C14 = 8
|
|
#C15 = <core::int*>[#C14, #C14, #C14]
|
|
#C16 = 16
|
|
#C17 = <core::int*>[#C16, #C16, #C16]
|
|
}
|
|
|
|
|
|
Constructor coverage from constants:
|
|
org-dartlang-testcase:///ffi_sample.dart:
|
|
- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:122:9)
|