mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
![Daco Harkes](/assets/img/avatar_default.png)
Fixes: https://github.com/dart-lang/sdk/issues/39063 Change-Id: I33e86d48620dcbe90966fec3d379c5165506e380 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-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,flutter-engine-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122640 Reviewed-by: Martin Kustermann <kustermann@google.com>
70 lines
1.3 KiB
Dart
70 lines
1.3 KiB
Dart
// 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.
|
|
//
|
|
// Check that the optimizer does not fuse constants with different
|
|
// representations.
|
|
//
|
|
// SharedObjects=ffi_test_functions
|
|
|
|
import "dart:ffi";
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
import "dylib_utils.dart";
|
|
|
|
typedef VigesimalOp = double Function(
|
|
int,
|
|
double,
|
|
int,
|
|
double,
|
|
int,
|
|
double,
|
|
int,
|
|
double,
|
|
int,
|
|
double,
|
|
int,
|
|
double,
|
|
int,
|
|
double,
|
|
int,
|
|
double,
|
|
int,
|
|
double,
|
|
int,
|
|
double);
|
|
|
|
typedef NativeVigesimalOp = Double Function(
|
|
IntPtr,
|
|
Float,
|
|
IntPtr,
|
|
Double,
|
|
IntPtr,
|
|
Float,
|
|
IntPtr,
|
|
Double,
|
|
IntPtr,
|
|
Float,
|
|
IntPtr,
|
|
Double,
|
|
IntPtr,
|
|
Float,
|
|
IntPtr,
|
|
Double,
|
|
IntPtr,
|
|
Float,
|
|
IntPtr,
|
|
Double);
|
|
|
|
main() {
|
|
final ffiTestFunctions = dlopenPlatformSpecific("ffi_test_functions");
|
|
|
|
final sumManyNumbers = ffiTestFunctions
|
|
.lookupFunction<NativeVigesimalOp, VigesimalOp>("SumManyNumbers");
|
|
|
|
// Should not crash.
|
|
sumManyNumbers(1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9, 10.0, 11, 12.0, 13, 14.0,
|
|
15, 16.0, 17, 18.0, 19, 20.0);
|
|
}
|