2019-02-13 12:42:47 +00:00
|
|
|
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
import 'dart:ffi';
|
2019-02-13 12:42:47 +00:00
|
|
|
|
|
|
|
/// Large sample struct for dart:ffi library.
|
[vm/ffi] Remove Struct type argument
This has coupled changes in package:ffi and package:tflite_native which are pinned in DEPS.
This CL includes the required analyzer changes from https://dart-review.googlesource.com/c/sdk/+/121647.
Issue: https://github.com/dart-lang/sdk/issues/38611
Change-Id: I712a886fd28ce0a2954fc42c90e1dfa495057732
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-reload-mac-release-simdbc64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-mac-release-simarm_x64-try,dart-sdk-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121422
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-15 18:35:57 +00:00
|
|
|
class VeryLargeStruct extends Struct {
|
2019-07-02 23:12:13 +00:00
|
|
|
@Int8()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int a;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
@Int16()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int b;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
@Int32()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int c;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
@Int64()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int d;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
@Uint8()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int e;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
@Uint16()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int f;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
@Uint32()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int g;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
@Uint64()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int h;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
@IntPtr()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int i;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
Reland "[vm/ffi] Support structs on 32bit architectures"
Fixes alignment checks on GCC <= 7 and Clang <= 7.
Fixes: https://github.com/dart-lang/sdk/issues/37559
Fixes: https://github.com/dart-lang/sdk/issues/36334
Original CL is in patchset 1.
Tested GCC 7 and Clang 7 behavior of alignof and offsetof manually (our CQ uses newer tooling).
Change-Id: I828b00ad3d36be68a0d28b0a710fea938ca17784
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try, app-kernel-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-ffi-android-product-arm-try,vm-dartkb-linux-release-x64-abi-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112254
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-08-09 14:14:32 +00:00
|
|
|
@Double()
|
2020-05-18 12:22:50 +00:00
|
|
|
external double j;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
Reland "[vm/ffi] Support structs on 32bit architectures"
Fixes alignment checks on GCC <= 7 and Clang <= 7.
Fixes: https://github.com/dart-lang/sdk/issues/37559
Fixes: https://github.com/dart-lang/sdk/issues/36334
Original CL is in patchset 1.
Tested GCC 7 and Clang 7 behavior of alignof and offsetof manually (our CQ uses newer tooling).
Change-Id: I828b00ad3d36be68a0d28b0a710fea938ca17784
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try, app-kernel-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-ffi-android-product-arm-try,vm-dartkb-linux-release-x64-abi-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112254
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-08-09 14:14:32 +00:00
|
|
|
@Float()
|
2020-05-18 12:22:50 +00:00
|
|
|
external double k;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2020-05-18 12:22:50 +00:00
|
|
|
external Pointer<VeryLargeStruct> parent;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
@IntPtr()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int numChildren;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2020-05-18 12:22:50 +00:00
|
|
|
external Pointer<VeryLargeStruct> children;
|
2019-02-13 12:42:47 +00:00
|
|
|
|
2019-07-02 23:12:13 +00:00
|
|
|
@Int8()
|
2020-05-18 12:22:50 +00:00
|
|
|
external int smallLastField;
|
2019-02-13 12:42:47 +00:00
|
|
|
}
|