| // Copyright (c) 2023, 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. |
| // |
| // This file has been automatically generated. Please do not edit it manually. |
| // Generated by tests/ffi/generator/structs_by_value_tests_generator.dart. |
| // |
| // SharedObjects=ffi_test_functions |
| // VMOptions= |
| // VMOptions=--deterministic --optimization-counter-threshold=20 |
| // VMOptions=--use-slow-path |
| // VMOptions=--use-slow-path --stacktrace-every=100 |
| |
| import 'dart:async'; |
| import 'dart:ffi'; |
| |
| import 'package:expect/expect.dart'; |
| // ignore: unused_import |
| import 'package:ffi/ffi.dart'; |
| |
| import 'async_callback_tests_utils.dart'; |
| |
| import 'dylib_utils.dart'; |
| |
| // Reuse the compound classes. |
| import 'function_structs_by_value_generated_compounds.dart'; |
| |
| final ffiTestFunctions = dlopenPlatformSpecific("ffi_test_functions"); |
| |
| Future<void> main() async { |
| for (final t in testCases) { |
| print("==== Running " + t.name); |
| await t.run(); |
| } |
| } |
| |
| final testCases = [ |
| AsyncCallbackTest( |
| "PassStruct1ByteIntx10", |
| Pointer.fromFunction<PassStruct1ByteIntx10Type>(passStruct1ByteIntx10), |
| passStruct1ByteIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct3BytesHomogeneousUint8x10", |
| Pointer.fromFunction<PassStruct3BytesHomogeneousUint8x10Type>( |
| passStruct3BytesHomogeneousUint8x10), |
| passStruct3BytesHomogeneousUint8x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct3BytesInt2ByteAlignedx10", |
| Pointer.fromFunction<PassStruct3BytesInt2ByteAlignedx10Type>( |
| passStruct3BytesInt2ByteAlignedx10), |
| passStruct3BytesInt2ByteAlignedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct4BytesHomogeneousInt16x10", |
| Pointer.fromFunction<PassStruct4BytesHomogeneousInt16x10Type>( |
| passStruct4BytesHomogeneousInt16x10), |
| passStruct4BytesHomogeneousInt16x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct7BytesHomogeneousUint8x10", |
| Pointer.fromFunction<PassStruct7BytesHomogeneousUint8x10Type>( |
| passStruct7BytesHomogeneousUint8x10), |
| passStruct7BytesHomogeneousUint8x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct7BytesInt4ByteAlignedx10", |
| Pointer.fromFunction<PassStruct7BytesInt4ByteAlignedx10Type>( |
| passStruct7BytesInt4ByteAlignedx10), |
| passStruct7BytesInt4ByteAlignedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesIntx10", |
| Pointer.fromFunction<PassStruct8BytesIntx10Type>(passStruct8BytesIntx10), |
| passStruct8BytesIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesHomogeneousFloatx10", |
| Pointer.fromFunction<PassStruct8BytesHomogeneousFloatx10Type>( |
| passStruct8BytesHomogeneousFloatx10), |
| passStruct8BytesHomogeneousFloatx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesMixedx10", |
| Pointer.fromFunction<PassStruct8BytesMixedx10Type>( |
| passStruct8BytesMixedx10), |
| passStruct8BytesMixedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct9BytesHomogeneousUint8x10", |
| Pointer.fromFunction<PassStruct9BytesHomogeneousUint8x10Type>( |
| passStruct9BytesHomogeneousUint8x10), |
| passStruct9BytesHomogeneousUint8x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct9BytesInt4Or8ByteAlignedx10", |
| Pointer.fromFunction<PassStruct9BytesInt4Or8ByteAlignedx10Type>( |
| passStruct9BytesInt4Or8ByteAlignedx10), |
| passStruct9BytesInt4Or8ByteAlignedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct12BytesHomogeneousFloatx6", |
| Pointer.fromFunction<PassStruct12BytesHomogeneousFloatx6Type>( |
| passStruct12BytesHomogeneousFloatx6), |
| passStruct12BytesHomogeneousFloatx6AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct16BytesHomogeneousFloatx5", |
| Pointer.fromFunction<PassStruct16BytesHomogeneousFloatx5Type>( |
| passStruct16BytesHomogeneousFloatx5), |
| passStruct16BytesHomogeneousFloatx5AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct16BytesMixedx10", |
| Pointer.fromFunction<PassStruct16BytesMixedx10Type>( |
| passStruct16BytesMixedx10), |
| passStruct16BytesMixedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct16BytesMixed2x10", |
| Pointer.fromFunction<PassStruct16BytesMixed2x10Type>( |
| passStruct16BytesMixed2x10), |
| passStruct16BytesMixed2x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct17BytesIntx10", |
| Pointer.fromFunction<PassStruct17BytesIntx10Type>( |
| passStruct17BytesIntx10), |
| passStruct17BytesIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct19BytesHomogeneousUint8x10", |
| Pointer.fromFunction<PassStruct19BytesHomogeneousUint8x10Type>( |
| passStruct19BytesHomogeneousUint8x10), |
| passStruct19BytesHomogeneousUint8x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct20BytesHomogeneousInt32x10", |
| Pointer.fromFunction<PassStruct20BytesHomogeneousInt32x10Type>( |
| passStruct20BytesHomogeneousInt32x10), |
| passStruct20BytesHomogeneousInt32x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct20BytesHomogeneousFloat", |
| Pointer.fromFunction<PassStruct20BytesHomogeneousFloatType>( |
| passStruct20BytesHomogeneousFloat), |
| passStruct20BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct32BytesHomogeneousDoublex5", |
| Pointer.fromFunction<PassStruct32BytesHomogeneousDoublex5Type>( |
| passStruct32BytesHomogeneousDoublex5), |
| passStruct32BytesHomogeneousDoublex5AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct40BytesHomogeneousDouble", |
| Pointer.fromFunction<PassStruct40BytesHomogeneousDoubleType>( |
| passStruct40BytesHomogeneousDouble), |
| passStruct40BytesHomogeneousDoubleAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct1024BytesHomogeneousUint64", |
| Pointer.fromFunction<PassStruct1024BytesHomogeneousUint64Type>( |
| passStruct1024BytesHomogeneousUint64), |
| passStruct1024BytesHomogeneousUint64AfterCallback), |
| AsyncCallbackTest( |
| "PassFloatStruct16BytesHomogeneousFloatFloatStruct1", |
| Pointer.fromFunction< |
| PassFloatStruct16BytesHomogeneousFloatFloatStruct1Type>( |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1), |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1AfterCallback), |
| AsyncCallbackTest( |
| "PassFloatStruct32BytesHomogeneousDoubleFloatStruct", |
| Pointer.fromFunction< |
| PassFloatStruct32BytesHomogeneousDoubleFloatStructType>( |
| passFloatStruct32BytesHomogeneousDoubleFloatStruct), |
| passFloatStruct32BytesHomogeneousDoubleFloatStructAfterCallback), |
| AsyncCallbackTest( |
| "PassInt8Struct16BytesMixedInt8Struct16BytesMixedIn", |
| Pointer.fromFunction< |
| PassInt8Struct16BytesMixedInt8Struct16BytesMixedInType>( |
| passInt8Struct16BytesMixedInt8Struct16BytesMixedIn), |
| passInt8Struct16BytesMixedInt8Struct16BytesMixedInAfterCallback), |
| AsyncCallbackTest( |
| "PassDoublex6Struct16BytesMixedx4Int32", |
| Pointer.fromFunction<PassDoublex6Struct16BytesMixedx4Int32Type>( |
| passDoublex6Struct16BytesMixedx4Int32), |
| passDoublex6Struct16BytesMixedx4Int32AfterCallback), |
| AsyncCallbackTest( |
| "PassInt32x4Struct16BytesMixedx4Double", |
| Pointer.fromFunction<PassInt32x4Struct16BytesMixedx4DoubleType>( |
| passInt32x4Struct16BytesMixedx4Double), |
| passInt32x4Struct16BytesMixedx4DoubleAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct40BytesHomogeneousDoubleStruct4BytesHomo", |
| Pointer.fromFunction< |
| PassStruct40BytesHomogeneousDoubleStruct4BytesHomoType>( |
| passStruct40BytesHomogeneousDoubleStruct4BytesHomo), |
| passStruct40BytesHomogeneousDoubleStruct4BytesHomoAfterCallback), |
| AsyncCallbackTest( |
| "PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int", |
| Pointer.fromFunction< |
| PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntType>( |
| passInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int), |
| passInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntAfterCallback), |
| AsyncCallbackTest( |
| "PassStructAlignmentInt16", |
| Pointer.fromFunction<PassStructAlignmentInt16Type>( |
| passStructAlignmentInt16), |
| passStructAlignmentInt16AfterCallback), |
| AsyncCallbackTest( |
| "PassStructAlignmentInt32", |
| Pointer.fromFunction<PassStructAlignmentInt32Type>( |
| passStructAlignmentInt32), |
| passStructAlignmentInt32AfterCallback), |
| AsyncCallbackTest( |
| "PassStructAlignmentInt64", |
| Pointer.fromFunction<PassStructAlignmentInt64Type>( |
| passStructAlignmentInt64), |
| passStructAlignmentInt64AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesNestedIntx10", |
| Pointer.fromFunction<PassStruct8BytesNestedIntx10Type>( |
| passStruct8BytesNestedIntx10), |
| passStruct8BytesNestedIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesNestedFloatx10", |
| Pointer.fromFunction<PassStruct8BytesNestedFloatx10Type>( |
| passStruct8BytesNestedFloatx10), |
| passStruct8BytesNestedFloatx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesNestedFloat2x10", |
| Pointer.fromFunction<PassStruct8BytesNestedFloat2x10Type>( |
| passStruct8BytesNestedFloat2x10), |
| passStruct8BytesNestedFloat2x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesNestedMixedx10", |
| Pointer.fromFunction<PassStruct8BytesNestedMixedx10Type>( |
| passStruct8BytesNestedMixedx10), |
| passStruct8BytesNestedMixedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct16BytesNestedIntx2", |
| Pointer.fromFunction<PassStruct16BytesNestedIntx2Type>( |
| passStruct16BytesNestedIntx2), |
| passStruct16BytesNestedIntx2AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct32BytesNestedIntx2", |
| Pointer.fromFunction<PassStruct32BytesNestedIntx2Type>( |
| passStruct32BytesNestedIntx2), |
| passStruct32BytesNestedIntx2AfterCallback), |
| AsyncCallbackTest( |
| "PassStructNestedIntStructAlignmentInt16", |
| Pointer.fromFunction<PassStructNestedIntStructAlignmentInt16Type>( |
| passStructNestedIntStructAlignmentInt16), |
| passStructNestedIntStructAlignmentInt16AfterCallback), |
| AsyncCallbackTest( |
| "PassStructNestedIntStructAlignmentInt32", |
| Pointer.fromFunction<PassStructNestedIntStructAlignmentInt32Type>( |
| passStructNestedIntStructAlignmentInt32), |
| passStructNestedIntStructAlignmentInt32AfterCallback), |
| AsyncCallbackTest( |
| "PassStructNestedIntStructAlignmentInt64", |
| Pointer.fromFunction<PassStructNestedIntStructAlignmentInt64Type>( |
| passStructNestedIntStructAlignmentInt64), |
| passStructNestedIntStructAlignmentInt64AfterCallback), |
| AsyncCallbackTest( |
| "PassStructNestedIrregularEvenBiggerx4", |
| Pointer.fromFunction<PassStructNestedIrregularEvenBiggerx4Type>( |
| passStructNestedIrregularEvenBiggerx4), |
| passStructNestedIrregularEvenBiggerx4AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesInlineArrayIntx4", |
| Pointer.fromFunction<PassStruct8BytesInlineArrayIntx4Type>( |
| passStruct8BytesInlineArrayIntx4), |
| passStruct8BytesInlineArrayIntx4AfterCallback), |
| AsyncCallbackTest( |
| "PassStructInlineArrayIrregularx4", |
| Pointer.fromFunction<PassStructInlineArrayIrregularx4Type>( |
| passStructInlineArrayIrregularx4), |
| passStructInlineArrayIrregularx4AfterCallback), |
| AsyncCallbackTest( |
| "PassStructInlineArray100Bytes", |
| Pointer.fromFunction<PassStructInlineArray100BytesType>( |
| passStructInlineArray100Bytes), |
| passStructInlineArray100BytesAfterCallback), |
| AsyncCallbackTest( |
| "PassStructStruct16BytesHomogeneousFloat2x5", |
| Pointer.fromFunction<PassStructStruct16BytesHomogeneousFloat2x5Type>( |
| passStructStruct16BytesHomogeneousFloat2x5), |
| passStructStruct16BytesHomogeneousFloat2x5AfterCallback), |
| AsyncCallbackTest( |
| "PassStructStruct32BytesHomogeneousDouble2x5", |
| Pointer.fromFunction<PassStructStruct32BytesHomogeneousDouble2x5Type>( |
| passStructStruct32BytesHomogeneousDouble2x5), |
| passStructStruct32BytesHomogeneousDouble2x5AfterCallback), |
| AsyncCallbackTest( |
| "PassStructStruct16BytesMixed3x10", |
| Pointer.fromFunction<PassStructStruct16BytesMixed3x10Type>( |
| passStructStruct16BytesMixed3x10), |
| passStructStruct16BytesMixed3x10AfterCallback), |
| AsyncCallbackTest( |
| "PassUint8Struct32BytesInlineArrayMultiDimensionalI", |
| Pointer.fromFunction< |
| PassUint8Struct32BytesInlineArrayMultiDimensionalIType>( |
| passUint8Struct32BytesInlineArrayMultiDimensionalI), |
| passUint8Struct32BytesInlineArrayMultiDimensionalIAfterCallback), |
| AsyncCallbackTest( |
| "PassUint8Struct4BytesInlineArrayMultiDimensionalIn", |
| Pointer.fromFunction< |
| PassUint8Struct4BytesInlineArrayMultiDimensionalInType>( |
| passUint8Struct4BytesInlineArrayMultiDimensionalIn), |
| passUint8Struct4BytesInlineArrayMultiDimensionalInAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct3BytesPackedIntx10", |
| Pointer.fromFunction<PassStruct3BytesPackedIntx10Type>( |
| passStruct3BytesPackedIntx10), |
| passStruct3BytesPackedIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesPackedIntx10", |
| Pointer.fromFunction<PassStruct8BytesPackedIntx10Type>( |
| passStruct8BytesPackedIntx10), |
| passStruct8BytesPackedIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct9BytesPackedMixedx10DoubleInt32x2", |
| Pointer.fromFunction<PassStruct9BytesPackedMixedx10DoubleInt32x2Type>( |
| passStruct9BytesPackedMixedx10DoubleInt32x2), |
| passStruct9BytesPackedMixedx10DoubleInt32x2AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct5BytesPackedMixed", |
| Pointer.fromFunction<PassStruct5BytesPackedMixedType>( |
| passStruct5BytesPackedMixed), |
| passStruct5BytesPackedMixedAfterCallback), |
| AsyncCallbackTest( |
| "PassStructNestedAlignmentStruct5BytesPackedMixed", |
| Pointer.fromFunction< |
| PassStructNestedAlignmentStruct5BytesPackedMixedType>( |
| passStructNestedAlignmentStruct5BytesPackedMixed), |
| passStructNestedAlignmentStruct5BytesPackedMixedAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct6BytesInlineArrayInt", |
| Pointer.fromFunction<PassStruct6BytesInlineArrayIntType>( |
| passStruct6BytesInlineArrayInt), |
| passStruct6BytesInlineArrayIntAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct15BytesInlineArrayMixed", |
| Pointer.fromFunction<PassStruct15BytesInlineArrayMixedType>( |
| passStruct15BytesInlineArrayMixed), |
| passStruct15BytesInlineArrayMixedAfterCallback), |
| AsyncCallbackTest( |
| "PassUnion4BytesMixedx10", |
| Pointer.fromFunction<PassUnion4BytesMixedx10Type>( |
| passUnion4BytesMixedx10), |
| passUnion4BytesMixedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassUnion8BytesNestedFloatx10", |
| Pointer.fromFunction<PassUnion8BytesNestedFloatx10Type>( |
| passUnion8BytesNestedFloatx10), |
| passUnion8BytesNestedFloatx10AfterCallback), |
| AsyncCallbackTest( |
| "PassUnion9BytesNestedIntx10", |
| Pointer.fromFunction<PassUnion9BytesNestedIntx10Type>( |
| passUnion9BytesNestedIntx10), |
| passUnion9BytesNestedIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassUnion16BytesNestedInlineArrayFloatx10", |
| Pointer.fromFunction<PassUnion16BytesNestedInlineArrayFloatx10Type>( |
| passUnion16BytesNestedInlineArrayFloatx10), |
| passUnion16BytesNestedInlineArrayFloatx10AfterCallback), |
| AsyncCallbackTest( |
| "PassUnion16BytesNestedFloatx10", |
| Pointer.fromFunction<PassUnion16BytesNestedFloatx10Type>( |
| passUnion16BytesNestedFloatx10), |
| passUnion16BytesNestedFloatx10AfterCallback), |
| AsyncCallbackTest( |
| "PassUint8Boolx9Struct10BytesHomogeneousBoolBool", |
| Pointer.fromFunction<PassUint8Boolx9Struct10BytesHomogeneousBoolBoolType>( |
| passUint8Boolx9Struct10BytesHomogeneousBoolBool), |
| passUint8Boolx9Struct10BytesHomogeneousBoolBoolAfterCallback), |
| AsyncCallbackTest( |
| "PassUint8Boolx9Struct10BytesInlineArrayBoolBool", |
| Pointer.fromFunction<PassUint8Boolx9Struct10BytesInlineArrayBoolBoolType>( |
| passUint8Boolx9Struct10BytesInlineArrayBoolBool), |
| passUint8Boolx9Struct10BytesInlineArrayBoolBoolAfterCallback), |
| AsyncCallbackTest( |
| "PassUint8Struct1ByteBool", |
| Pointer.fromFunction<PassUint8Struct1ByteBoolType>( |
| passUint8Struct1ByteBool), |
| passUint8Struct1ByteBoolAfterCallback), |
| AsyncCallbackTest( |
| "PassWCharStructInlineArrayIntUintPtrx2LongUnsigned", |
| Pointer.fromFunction< |
| PassWCharStructInlineArrayIntUintPtrx2LongUnsignedType>( |
| passWCharStructInlineArrayIntUintPtrx2LongUnsigned), |
| passWCharStructInlineArrayIntUintPtrx2LongUnsignedAfterCallback), |
| AsyncCallbackTest( |
| "PassInt64x7Struct12BytesHomogeneousInt32", |
| Pointer.fromFunction<PassInt64x7Struct12BytesHomogeneousInt32Type>( |
| passInt64x7Struct12BytesHomogeneousInt32), |
| passInt64x7Struct12BytesHomogeneousInt32AfterCallback), |
| AsyncCallbackTest( |
| "PassPointerStruct12BytesHomogeneousInt32", |
| Pointer.fromFunction<PassPointerStruct12BytesHomogeneousInt32Type>( |
| passPointerStruct12BytesHomogeneousInt32), |
| noChecksAsync), |
| AsyncCallbackTest( |
| "ReturnStruct1ByteInt", |
| Pointer.fromFunction<ReturnStruct1ByteIntType>(returnStruct1ByteInt), |
| returnStruct1ByteIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct3BytesHomogeneousUint8", |
| Pointer.fromFunction<ReturnStruct3BytesHomogeneousUint8Type>( |
| returnStruct3BytesHomogeneousUint8), |
| returnStruct3BytesHomogeneousUint8AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct3BytesInt2ByteAligned", |
| Pointer.fromFunction<ReturnStruct3BytesInt2ByteAlignedType>( |
| returnStruct3BytesInt2ByteAligned), |
| returnStruct3BytesInt2ByteAlignedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct4BytesHomogeneousInt16", |
| Pointer.fromFunction<ReturnStruct4BytesHomogeneousInt16Type>( |
| returnStruct4BytesHomogeneousInt16), |
| returnStruct4BytesHomogeneousInt16AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct7BytesHomogeneousUint8", |
| Pointer.fromFunction<ReturnStruct7BytesHomogeneousUint8Type>( |
| returnStruct7BytesHomogeneousUint8), |
| returnStruct7BytesHomogeneousUint8AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct7BytesInt4ByteAligned", |
| Pointer.fromFunction<ReturnStruct7BytesInt4ByteAlignedType>( |
| returnStruct7BytesInt4ByteAligned), |
| returnStruct7BytesInt4ByteAlignedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesInt", |
| Pointer.fromFunction<ReturnStruct8BytesIntType>(returnStruct8BytesInt), |
| returnStruct8BytesIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesHomogeneousFloat", |
| Pointer.fromFunction<ReturnStruct8BytesHomogeneousFloatType>( |
| returnStruct8BytesHomogeneousFloat), |
| returnStruct8BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesMixed", |
| Pointer.fromFunction<ReturnStruct8BytesMixedType>( |
| returnStruct8BytesMixed), |
| returnStruct8BytesMixedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct9BytesHomogeneousUint8", |
| Pointer.fromFunction<ReturnStruct9BytesHomogeneousUint8Type>( |
| returnStruct9BytesHomogeneousUint8), |
| returnStruct9BytesHomogeneousUint8AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct9BytesInt4Or8ByteAligned", |
| Pointer.fromFunction<ReturnStruct9BytesInt4Or8ByteAlignedType>( |
| returnStruct9BytesInt4Or8ByteAligned), |
| returnStruct9BytesInt4Or8ByteAlignedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct12BytesHomogeneousFloat", |
| Pointer.fromFunction<ReturnStruct12BytesHomogeneousFloatType>( |
| returnStruct12BytesHomogeneousFloat), |
| returnStruct12BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct16BytesHomogeneousFloat", |
| Pointer.fromFunction<ReturnStruct16BytesHomogeneousFloatType>( |
| returnStruct16BytesHomogeneousFloat), |
| returnStruct16BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct16BytesMixed", |
| Pointer.fromFunction<ReturnStruct16BytesMixedType>( |
| returnStruct16BytesMixed), |
| returnStruct16BytesMixedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct16BytesMixed2", |
| Pointer.fromFunction<ReturnStruct16BytesMixed2Type>( |
| returnStruct16BytesMixed2), |
| returnStruct16BytesMixed2AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct17BytesInt", |
| Pointer.fromFunction<ReturnStruct17BytesIntType>(returnStruct17BytesInt), |
| returnStruct17BytesIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct19BytesHomogeneousUint8", |
| Pointer.fromFunction<ReturnStruct19BytesHomogeneousUint8Type>( |
| returnStruct19BytesHomogeneousUint8), |
| returnStruct19BytesHomogeneousUint8AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct20BytesHomogeneousInt32", |
| Pointer.fromFunction<ReturnStruct20BytesHomogeneousInt32Type>( |
| returnStruct20BytesHomogeneousInt32), |
| returnStruct20BytesHomogeneousInt32AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct20BytesHomogeneousFloat", |
| Pointer.fromFunction<ReturnStruct20BytesHomogeneousFloatType>( |
| returnStruct20BytesHomogeneousFloat), |
| returnStruct20BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct32BytesHomogeneousDouble", |
| Pointer.fromFunction<ReturnStruct32BytesHomogeneousDoubleType>( |
| returnStruct32BytesHomogeneousDouble), |
| returnStruct32BytesHomogeneousDoubleAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct40BytesHomogeneousDouble", |
| Pointer.fromFunction<ReturnStruct40BytesHomogeneousDoubleType>( |
| returnStruct40BytesHomogeneousDouble), |
| returnStruct40BytesHomogeneousDoubleAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct1024BytesHomogeneousUint64", |
| Pointer.fromFunction<ReturnStruct1024BytesHomogeneousUint64Type>( |
| returnStruct1024BytesHomogeneousUint64), |
| returnStruct1024BytesHomogeneousUint64AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct3BytesPackedInt", |
| Pointer.fromFunction<ReturnStruct3BytesPackedIntType>( |
| returnStruct3BytesPackedInt), |
| returnStruct3BytesPackedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesPackedInt", |
| Pointer.fromFunction<ReturnStruct8BytesPackedIntType>( |
| returnStruct8BytesPackedInt), |
| returnStruct8BytesPackedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct9BytesPackedMixed", |
| Pointer.fromFunction<ReturnStruct9BytesPackedMixedType>( |
| returnStruct9BytesPackedMixed), |
| returnStruct9BytesPackedMixedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnUnion4BytesMixed", |
| Pointer.fromFunction<ReturnUnion4BytesMixedType>(returnUnion4BytesMixed), |
| returnUnion4BytesMixedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnUnion8BytesNestedFloat", |
| Pointer.fromFunction<ReturnUnion8BytesNestedFloatType>( |
| returnUnion8BytesNestedFloat), |
| returnUnion8BytesNestedFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnUnion9BytesNestedInt", |
| Pointer.fromFunction<ReturnUnion9BytesNestedIntType>( |
| returnUnion9BytesNestedInt), |
| returnUnion9BytesNestedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnUnion16BytesNestedFloat", |
| Pointer.fromFunction<ReturnUnion16BytesNestedFloatType>( |
| returnUnion16BytesNestedFloat), |
| returnUnion16BytesNestedFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStruct1ByteInt", |
| Pointer.fromFunction<ReturnStructArgumentStruct1ByteIntType>( |
| returnStructArgumentStruct1ByteInt), |
| returnStructArgumentStruct1ByteIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentInt32x8Struct1ByteInt", |
| Pointer.fromFunction<ReturnStructArgumentInt32x8Struct1ByteIntType>( |
| returnStructArgumentInt32x8Struct1ByteInt), |
| returnStructArgumentInt32x8Struct1ByteIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStruct8BytesHomogeneousFloat", |
| Pointer.fromFunction< |
| ReturnStructArgumentStruct8BytesHomogeneousFloatType>( |
| returnStructArgumentStruct8BytesHomogeneousFloat), |
| returnStructArgumentStruct8BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStruct20BytesHomogeneousInt32", |
| Pointer.fromFunction< |
| ReturnStructArgumentStruct20BytesHomogeneousInt32Type>( |
| returnStructArgumentStruct20BytesHomogeneousInt32), |
| returnStructArgumentStruct20BytesHomogeneousInt32AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentInt32x8Struct20BytesHomogeneou", |
| Pointer.fromFunction< |
| ReturnStructArgumentInt32x8Struct20BytesHomogeneouType>( |
| returnStructArgumentInt32x8Struct20BytesHomogeneou), |
| returnStructArgumentInt32x8Struct20BytesHomogeneouAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStruct8BytesInlineArrayInt", |
| Pointer.fromFunction<ReturnStructArgumentStruct8BytesInlineArrayIntType>( |
| returnStructArgumentStruct8BytesInlineArrayInt), |
| returnStructArgumentStruct8BytesInlineArrayIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStructStruct16BytesHomogeneous", |
| Pointer.fromFunction< |
| ReturnStructArgumentStructStruct16BytesHomogeneousType>( |
| returnStructArgumentStructStruct16BytesHomogeneous), |
| returnStructArgumentStructStruct16BytesHomogeneousAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStructStruct32BytesHomogeneous", |
| Pointer.fromFunction< |
| ReturnStructArgumentStructStruct32BytesHomogeneousType>( |
| returnStructArgumentStructStruct32BytesHomogeneous), |
| returnStructArgumentStructStruct32BytesHomogeneousAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStructStruct16BytesMixed3", |
| Pointer.fromFunction<ReturnStructArgumentStructStruct16BytesMixed3Type>( |
| returnStructArgumentStructStruct16BytesMixed3), |
| returnStructArgumentStructStruct16BytesMixed3AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructAlignmentInt16", |
| Pointer.fromFunction<ReturnStructAlignmentInt16Type>( |
| returnStructAlignmentInt16), |
| returnStructAlignmentInt16AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructAlignmentInt32", |
| Pointer.fromFunction<ReturnStructAlignmentInt32Type>( |
| returnStructAlignmentInt32), |
| returnStructAlignmentInt32AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructAlignmentInt64", |
| Pointer.fromFunction<ReturnStructAlignmentInt64Type>( |
| returnStructAlignmentInt64), |
| returnStructAlignmentInt64AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesNestedInt", |
| Pointer.fromFunction<ReturnStruct8BytesNestedIntType>( |
| returnStruct8BytesNestedInt), |
| returnStruct8BytesNestedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesNestedFloat", |
| Pointer.fromFunction<ReturnStruct8BytesNestedFloatType>( |
| returnStruct8BytesNestedFloat), |
| returnStruct8BytesNestedFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesNestedFloat2", |
| Pointer.fromFunction<ReturnStruct8BytesNestedFloat2Type>( |
| returnStruct8BytesNestedFloat2), |
| returnStruct8BytesNestedFloat2AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesNestedMixed", |
| Pointer.fromFunction<ReturnStruct8BytesNestedMixedType>( |
| returnStruct8BytesNestedMixed), |
| returnStruct8BytesNestedMixedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct16BytesNestedInt", |
| Pointer.fromFunction<ReturnStruct16BytesNestedIntType>( |
| returnStruct16BytesNestedInt), |
| returnStruct16BytesNestedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct32BytesNestedInt", |
| Pointer.fromFunction<ReturnStruct32BytesNestedIntType>( |
| returnStruct32BytesNestedInt), |
| returnStruct32BytesNestedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructNestedIntStructAlignmentInt16", |
| Pointer.fromFunction<ReturnStructNestedIntStructAlignmentInt16Type>( |
| returnStructNestedIntStructAlignmentInt16), |
| returnStructNestedIntStructAlignmentInt16AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructNestedIntStructAlignmentInt32", |
| Pointer.fromFunction<ReturnStructNestedIntStructAlignmentInt32Type>( |
| returnStructNestedIntStructAlignmentInt32), |
| returnStructNestedIntStructAlignmentInt32AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructNestedIntStructAlignmentInt64", |
| Pointer.fromFunction<ReturnStructNestedIntStructAlignmentInt64Type>( |
| returnStructNestedIntStructAlignmentInt64), |
| returnStructNestedIntStructAlignmentInt64AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructNestedIrregularEvenBigger", |
| Pointer.fromFunction<ReturnStructNestedIrregularEvenBiggerType>( |
| returnStructNestedIrregularEvenBigger), |
| returnStructNestedIrregularEvenBiggerAfterCallback), |
| ]; |
| typedef PassStruct1ByteIntx10Type = Void Function( |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt); |
| |
| // Global variable that stores the result. |
| final PassStruct1ByteIntx10Result = Completer<double>(); |
| |
| /// Smallest struct with data. |
| /// 10 struct arguments will exhaust available registers. |
| void passStruct1ByteIntx10( |
| Struct1ByteInt a0, |
| Struct1ByteInt a1, |
| Struct1ByteInt a2, |
| Struct1ByteInt a3, |
| Struct1ByteInt a4, |
| Struct1ByteInt a5, |
| Struct1ByteInt a6, |
| Struct1ByteInt a7, |
| Struct1ByteInt a8, |
| Struct1ByteInt a9) { |
| print( |
| "passStruct1ByteIntx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a1.a0; |
| result += a2.a0; |
| result += a3.a0; |
| result += a4.a0; |
| result += a5.a0; |
| result += a6.a0; |
| result += a7.a0; |
| result += a8.a0; |
| result += a9.a0; |
| |
| print("result = $result"); |
| PassStruct1ByteIntx10Result.complete(result); |
| } |
| |
| Future<void> passStruct1ByteIntx10AfterCallback() async { |
| final result = await PassStruct1ByteIntx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(5, result); |
| } |
| |
| typedef PassStruct3BytesHomogeneousUint8x10Type = Void Function( |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8); |
| |
| // Global variable that stores the result. |
| final PassStruct3BytesHomogeneousUint8x10Result = Completer<double>(); |
| |
| /// Not a multiple of word size, not a power of two. |
| /// 10 struct arguments will exhaust available registers. |
| void passStruct3BytesHomogeneousUint8x10( |
| Struct3BytesHomogeneousUint8 a0, |
| Struct3BytesHomogeneousUint8 a1, |
| Struct3BytesHomogeneousUint8 a2, |
| Struct3BytesHomogeneousUint8 a3, |
| Struct3BytesHomogeneousUint8 a4, |
| Struct3BytesHomogeneousUint8 a5, |
| Struct3BytesHomogeneousUint8 a6, |
| Struct3BytesHomogeneousUint8 a7, |
| Struct3BytesHomogeneousUint8 a8, |
| Struct3BytesHomogeneousUint8 a9) { |
| print( |
| "passStruct3BytesHomogeneousUint8x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| |
| print("result = $result"); |
| PassStruct3BytesHomogeneousUint8x10Result.complete(result); |
| } |
| |
| Future<void> passStruct3BytesHomogeneousUint8x10AfterCallback() async { |
| final result = await PassStruct3BytesHomogeneousUint8x10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(465, result); |
| } |
| |
| typedef PassStruct3BytesInt2ByteAlignedx10Type = Void Function( |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned); |
| |
| // Global variable that stores the result. |
| final PassStruct3BytesInt2ByteAlignedx10Result = Completer<double>(); |
| |
| /// Not a multiple of word size, not a power of two. |
| /// With alignment rules taken into account size is 4 bytes. |
| /// 10 struct arguments will exhaust available registers. |
| void passStruct3BytesInt2ByteAlignedx10( |
| Struct3BytesInt2ByteAligned a0, |
| Struct3BytesInt2ByteAligned a1, |
| Struct3BytesInt2ByteAligned a2, |
| Struct3BytesInt2ByteAligned a3, |
| Struct3BytesInt2ByteAligned a4, |
| Struct3BytesInt2ByteAligned a5, |
| Struct3BytesInt2ByteAligned a6, |
| Struct3BytesInt2ByteAligned a7, |
| Struct3BytesInt2ByteAligned a8, |
| Struct3BytesInt2ByteAligned a9) { |
| print( |
| "passStruct3BytesInt2ByteAlignedx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| |
| print("result = $result"); |
| PassStruct3BytesInt2ByteAlignedx10Result.complete(result); |
| } |
| |
| Future<void> passStruct3BytesInt2ByteAlignedx10AfterCallback() async { |
| final result = await PassStruct3BytesInt2ByteAlignedx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStruct4BytesHomogeneousInt16x10Type = Void Function( |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16); |
| |
| // Global variable that stores the result. |
| final PassStruct4BytesHomogeneousInt16x10Result = Completer<double>(); |
| |
| /// Exactly word size on 32-bit architectures. |
| /// 10 struct arguments will exhaust available registers. |
| void passStruct4BytesHomogeneousInt16x10( |
| Struct4BytesHomogeneousInt16 a0, |
| Struct4BytesHomogeneousInt16 a1, |
| Struct4BytesHomogeneousInt16 a2, |
| Struct4BytesHomogeneousInt16 a3, |
| Struct4BytesHomogeneousInt16 a4, |
| Struct4BytesHomogeneousInt16 a5, |
| Struct4BytesHomogeneousInt16 a6, |
| Struct4BytesHomogeneousInt16 a7, |
| Struct4BytesHomogeneousInt16 a8, |
| Struct4BytesHomogeneousInt16 a9) { |
| print( |
| "passStruct4BytesHomogeneousInt16x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| |
| print("result = $result"); |
| PassStruct4BytesHomogeneousInt16x10Result.complete(result); |
| } |
| |
| Future<void> passStruct4BytesHomogeneousInt16x10AfterCallback() async { |
| final result = await PassStruct4BytesHomogeneousInt16x10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStruct7BytesHomogeneousUint8x10Type = Void Function( |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8); |
| |
| // Global variable that stores the result. |
| final PassStruct7BytesHomogeneousUint8x10Result = Completer<double>(); |
| |
| /// Sub word size on 64 bit architectures. |
| /// 10 struct arguments will exhaust available registers. |
| void passStruct7BytesHomogeneousUint8x10( |
| Struct7BytesHomogeneousUint8 a0, |
| Struct7BytesHomogeneousUint8 a1, |
| Struct7BytesHomogeneousUint8 a2, |
| Struct7BytesHomogeneousUint8 a3, |
| Struct7BytesHomogeneousUint8 a4, |
| Struct7BytesHomogeneousUint8 a5, |
| Struct7BytesHomogeneousUint8 a6, |
| Struct7BytesHomogeneousUint8 a7, |
| Struct7BytesHomogeneousUint8 a8, |
| Struct7BytesHomogeneousUint8 a9) { |
| print( |
| "passStruct7BytesHomogeneousUint8x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a0.a5; |
| result += a0.a6; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a1.a4; |
| result += a1.a5; |
| result += a1.a6; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a2.a4; |
| result += a2.a5; |
| result += a2.a6; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a3.a4; |
| result += a3.a5; |
| result += a3.a6; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| result += a4.a4; |
| result += a4.a5; |
| result += a4.a6; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a5.a4; |
| result += a5.a5; |
| result += a5.a6; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a6.a3; |
| result += a6.a4; |
| result += a6.a5; |
| result += a6.a6; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a7.a4; |
| result += a7.a5; |
| result += a7.a6; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a8.a4; |
| result += a8.a5; |
| result += a8.a6; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| result += a9.a3; |
| result += a9.a4; |
| result += a9.a5; |
| result += a9.a6; |
| |
| print("result = $result"); |
| PassStruct7BytesHomogeneousUint8x10Result.complete(result); |
| } |
| |
| Future<void> passStruct7BytesHomogeneousUint8x10AfterCallback() async { |
| final result = await PassStruct7BytesHomogeneousUint8x10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(2485, result); |
| } |
| |
| typedef PassStruct7BytesInt4ByteAlignedx10Type = Void Function( |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned); |
| |
| // Global variable that stores the result. |
| final PassStruct7BytesInt4ByteAlignedx10Result = Completer<double>(); |
| |
| /// Sub word size on 64 bit architectures. |
| /// With alignment rules taken into account size is 8 bytes. |
| /// 10 struct arguments will exhaust available registers. |
| void passStruct7BytesInt4ByteAlignedx10( |
| Struct7BytesInt4ByteAligned a0, |
| Struct7BytesInt4ByteAligned a1, |
| Struct7BytesInt4ByteAligned a2, |
| Struct7BytesInt4ByteAligned a3, |
| Struct7BytesInt4ByteAligned a4, |
| Struct7BytesInt4ByteAligned a5, |
| Struct7BytesInt4ByteAligned a6, |
| Struct7BytesInt4ByteAligned a7, |
| Struct7BytesInt4ByteAligned a8, |
| Struct7BytesInt4ByteAligned a9) { |
| print( |
| "passStruct7BytesInt4ByteAlignedx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| |
| print("result = $result"); |
| PassStruct7BytesInt4ByteAlignedx10Result.complete(result); |
| } |
| |
| Future<void> passStruct7BytesInt4ByteAlignedx10AfterCallback() async { |
| final result = await PassStruct7BytesInt4ByteAlignedx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(15, result); |
| } |
| |
| typedef PassStruct8BytesIntx10Type = Void Function( |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt); |
| |
| // Global variable that stores the result. |
| final PassStruct8BytesIntx10Result = Completer<double>(); |
| |
| /// Exactly word size struct on 64bit architectures. |
| /// 10 struct arguments will exhaust available registers. |
| void passStruct8BytesIntx10( |
| Struct8BytesInt a0, |
| Struct8BytesInt a1, |
| Struct8BytesInt a2, |
| Struct8BytesInt a3, |
| Struct8BytesInt a4, |
| Struct8BytesInt a5, |
| Struct8BytesInt a6, |
| Struct8BytesInt a7, |
| Struct8BytesInt a8, |
| Struct8BytesInt a9) { |
| print( |
| "passStruct8BytesIntx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| |
| print("result = $result"); |
| PassStruct8BytesIntx10Result.complete(result); |
| } |
| |
| Future<void> passStruct8BytesIntx10AfterCallback() async { |
| final result = await PassStruct8BytesIntx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(15, result); |
| } |
| |
| typedef PassStruct8BytesHomogeneousFloatx10Type = Void Function( |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat); |
| |
| // Global variable that stores the result. |
| final PassStruct8BytesHomogeneousFloatx10Result = Completer<double>(); |
| |
| /// Arguments passed in FP registers as long as they fit. |
| /// 10 struct arguments will exhaust available registers. |
| void passStruct8BytesHomogeneousFloatx10( |
| Struct8BytesHomogeneousFloat a0, |
| Struct8BytesHomogeneousFloat a1, |
| Struct8BytesHomogeneousFloat a2, |
| Struct8BytesHomogeneousFloat a3, |
| Struct8BytesHomogeneousFloat a4, |
| Struct8BytesHomogeneousFloat a5, |
| Struct8BytesHomogeneousFloat a6, |
| Struct8BytesHomogeneousFloat a7, |
| Struct8BytesHomogeneousFloat a8, |
| Struct8BytesHomogeneousFloat a9) { |
| print( |
| "passStruct8BytesHomogeneousFloatx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| |
| print("result = $result"); |
| PassStruct8BytesHomogeneousFloatx10Result.complete(result); |
| } |
| |
| Future<void> passStruct8BytesHomogeneousFloatx10AfterCallback() async { |
| final result = await PassStruct8BytesHomogeneousFloatx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStruct8BytesMixedx10Type = Void Function( |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed); |
| |
| // Global variable that stores the result. |
| final PassStruct8BytesMixedx10Result = Completer<double>(); |
| |
| /// On x64, arguments go in int registers because it is not only float. |
| /// 10 struct arguments will exhaust available registers. |
| void passStruct8BytesMixedx10( |
| Struct8BytesMixed a0, |
| Struct8BytesMixed a1, |
| Struct8BytesMixed a2, |
| Struct8BytesMixed a3, |
| Struct8BytesMixed a4, |
| Struct8BytesMixed a5, |
| Struct8BytesMixed a6, |
| Struct8BytesMixed a7, |
| Struct8BytesMixed a8, |
| Struct8BytesMixed a9) { |
| print( |
| "passStruct8BytesMixedx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| |
| print("result = $result"); |
| PassStruct8BytesMixedx10Result.complete(result); |
| } |
| |
| Future<void> passStruct8BytesMixedx10AfterCallback() async { |
| final result = await PassStruct8BytesMixedx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(15, result); |
| } |
| |
| typedef PassStruct9BytesHomogeneousUint8x10Type = Void Function( |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8); |
| |
| // Global variable that stores the result. |
| final PassStruct9BytesHomogeneousUint8x10Result = Completer<double>(); |
| |
| /// Argument is a single byte over a multiple of word size. |
| /// 10 struct arguments will exhaust available registers. |
| /// Struct only has 1-byte aligned fields to test struct alignment itself. |
| /// Tests upper bytes in the integer registers that are partly filled. |
| /// Tests stack alignment of non word size stack arguments. |
| void passStruct9BytesHomogeneousUint8x10( |
| Struct9BytesHomogeneousUint8 a0, |
| Struct9BytesHomogeneousUint8 a1, |
| Struct9BytesHomogeneousUint8 a2, |
| Struct9BytesHomogeneousUint8 a3, |
| Struct9BytesHomogeneousUint8 a4, |
| Struct9BytesHomogeneousUint8 a5, |
| Struct9BytesHomogeneousUint8 a6, |
| Struct9BytesHomogeneousUint8 a7, |
| Struct9BytesHomogeneousUint8 a8, |
| Struct9BytesHomogeneousUint8 a9) { |
| print( |
| "passStruct9BytesHomogeneousUint8x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a0.a5; |
| result += a0.a6; |
| result += a0.a7; |
| result += a0.a8; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a1.a4; |
| result += a1.a5; |
| result += a1.a6; |
| result += a1.a7; |
| result += a1.a8; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a2.a4; |
| result += a2.a5; |
| result += a2.a6; |
| result += a2.a7; |
| result += a2.a8; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a3.a4; |
| result += a3.a5; |
| result += a3.a6; |
| result += a3.a7; |
| result += a3.a8; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| result += a4.a4; |
| result += a4.a5; |
| result += a4.a6; |
| result += a4.a7; |
| result += a4.a8; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a5.a4; |
| result += a5.a5; |
| result += a5.a6; |
| result += a5.a7; |
| result += a5.a8; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a6.a3; |
| result += a6.a4; |
| result += a6.a5; |
| result += a6.a6; |
| result += a6.a7; |
| result += a6.a8; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a7.a4; |
| result += a7.a5; |
| result += a7.a6; |
| result += a7.a7; |
| result += a7.a8; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a8.a4; |
| result += a8.a5; |
| result += a8.a6; |
| result += a8.a7; |
| result += a8.a8; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| result += a9.a3; |
| result += a9.a4; |
| result += a9.a5; |
| result += a9.a6; |
| result += a9.a7; |
| result += a9.a8; |
| |
| print("result = $result"); |
| PassStruct9BytesHomogeneousUint8x10Result.complete(result); |
| } |
| |
| Future<void> passStruct9BytesHomogeneousUint8x10AfterCallback() async { |
| final result = await PassStruct9BytesHomogeneousUint8x10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(4095, result); |
| } |
| |
| typedef PassStruct9BytesInt4Or8ByteAlignedx10Type = Void Function( |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned); |
| |
| // Global variable that stores the result. |
| final PassStruct9BytesInt4Or8ByteAlignedx10Result = Completer<double>(); |
| |
| /// Argument is a single byte over a multiple of word size. |
| /// With alignment rules taken into account size is 12 or 16 bytes. |
| /// 10 struct arguments will exhaust available registers. |
| /// |
| void passStruct9BytesInt4Or8ByteAlignedx10( |
| Struct9BytesInt4Or8ByteAligned a0, |
| Struct9BytesInt4Or8ByteAligned a1, |
| Struct9BytesInt4Or8ByteAligned a2, |
| Struct9BytesInt4Or8ByteAligned a3, |
| Struct9BytesInt4Or8ByteAligned a4, |
| Struct9BytesInt4Or8ByteAligned a5, |
| Struct9BytesInt4Or8ByteAligned a6, |
| Struct9BytesInt4Or8ByteAligned a7, |
| Struct9BytesInt4Or8ByteAligned a8, |
| Struct9BytesInt4Or8ByteAligned a9) { |
| print( |
| "passStruct9BytesInt4Or8ByteAlignedx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| |
| print("result = $result"); |
| PassStruct9BytesInt4Or8ByteAlignedx10Result.complete(result); |
| } |
| |
| Future<void> passStruct9BytesInt4Or8ByteAlignedx10AfterCallback() async { |
| final result = await PassStruct9BytesInt4Or8ByteAlignedx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStruct12BytesHomogeneousFloatx6Type = Void Function( |
| Struct12BytesHomogeneousFloat, |
| Struct12BytesHomogeneousFloat, |
| Struct12BytesHomogeneousFloat, |
| Struct12BytesHomogeneousFloat, |
| Struct12BytesHomogeneousFloat, |
| Struct12BytesHomogeneousFloat); |
| |
| // Global variable that stores the result. |
| final PassStruct12BytesHomogeneousFloatx6Result = Completer<double>(); |
| |
| /// Arguments in FPU registers on arm hardfp and arm64. |
| /// Struct arguments will exhaust available registers, and leave some empty. |
| /// The last argument is to test whether arguments are backfilled. |
| void passStruct12BytesHomogeneousFloatx6( |
| Struct12BytesHomogeneousFloat a0, |
| Struct12BytesHomogeneousFloat a1, |
| Struct12BytesHomogeneousFloat a2, |
| Struct12BytesHomogeneousFloat a3, |
| Struct12BytesHomogeneousFloat a4, |
| Struct12BytesHomogeneousFloat a5) { |
| print( |
| "passStruct12BytesHomogeneousFloatx6(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| |
| print("result = $result"); |
| PassStruct12BytesHomogeneousFloatx6Result.complete(result); |
| } |
| |
| Future<void> passStruct12BytesHomogeneousFloatx6AfterCallback() async { |
| final result = await PassStruct12BytesHomogeneousFloatx6Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(9, result); |
| } |
| |
| typedef PassStruct16BytesHomogeneousFloatx5Type = Void Function( |
| Struct16BytesHomogeneousFloat, |
| Struct16BytesHomogeneousFloat, |
| Struct16BytesHomogeneousFloat, |
| Struct16BytesHomogeneousFloat, |
| Struct16BytesHomogeneousFloat); |
| |
| // Global variable that stores the result. |
| final PassStruct16BytesHomogeneousFloatx5Result = Completer<double>(); |
| |
| /// On Linux x64 argument is transferred on stack because it is over 16 bytes. |
| /// Arguments in FPU registers on arm hardfp and arm64. |
| /// 5 struct arguments will exhaust available registers. |
| void passStruct16BytesHomogeneousFloatx5( |
| Struct16BytesHomogeneousFloat a0, |
| Struct16BytesHomogeneousFloat a1, |
| Struct16BytesHomogeneousFloat a2, |
| Struct16BytesHomogeneousFloat a3, |
| Struct16BytesHomogeneousFloat a4) { |
| print( |
| "passStruct16BytesHomogeneousFloatx5(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| |
| print("result = $result"); |
| PassStruct16BytesHomogeneousFloatx5Result.complete(result); |
| } |
| |
| Future<void> passStruct16BytesHomogeneousFloatx5AfterCallback() async { |
| final result = await PassStruct16BytesHomogeneousFloatx5Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStruct16BytesMixedx10Type = Void Function( |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed); |
| |
| // Global variable that stores the result. |
| final PassStruct16BytesMixedx10Result = Completer<double>(); |
| |
| /// On x64, arguments are split over FP and int registers. |
| /// On x64, it will exhaust the integer registers with the 6th argument. |
| /// The rest goes on the stack. |
| /// On arm, arguments are 8 byte aligned. |
| void passStruct16BytesMixedx10( |
| Struct16BytesMixed a0, |
| Struct16BytesMixed a1, |
| Struct16BytesMixed a2, |
| Struct16BytesMixed a3, |
| Struct16BytesMixed a4, |
| Struct16BytesMixed a5, |
| Struct16BytesMixed a6, |
| Struct16BytesMixed a7, |
| Struct16BytesMixed a8, |
| Struct16BytesMixed a9) { |
| print( |
| "passStruct16BytesMixedx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| |
| print("result = $result"); |
| PassStruct16BytesMixedx10Result.complete(result); |
| } |
| |
| Future<void> passStruct16BytesMixedx10AfterCallback() async { |
| final result = await PassStruct16BytesMixedx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStruct16BytesMixed2x10Type = Void Function( |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2); |
| |
| // Global variable that stores the result. |
| final PassStruct16BytesMixed2x10Result = Completer<double>(); |
| |
| /// On x64, arguments are split over FP and int registers. |
| /// On x64, it will exhaust the integer registers with the 6th argument. |
| /// The rest goes on the stack. |
| /// On arm, arguments are 4 byte aligned. |
| void passStruct16BytesMixed2x10( |
| Struct16BytesMixed2 a0, |
| Struct16BytesMixed2 a1, |
| Struct16BytesMixed2 a2, |
| Struct16BytesMixed2 a3, |
| Struct16BytesMixed2 a4, |
| Struct16BytesMixed2 a5, |
| Struct16BytesMixed2 a6, |
| Struct16BytesMixed2 a7, |
| Struct16BytesMixed2 a8, |
| Struct16BytesMixed2 a9) { |
| print( |
| "passStruct16BytesMixed2x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a6.a3; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| result += a9.a3; |
| |
| print("result = $result"); |
| PassStruct16BytesMixed2x10Result.complete(result); |
| } |
| |
| Future<void> passStruct16BytesMixed2x10AfterCallback() async { |
| final result = await PassStruct16BytesMixed2x10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(20, result); |
| } |
| |
| typedef PassStruct17BytesIntx10Type = Void Function( |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt); |
| |
| // Global variable that stores the result. |
| final PassStruct17BytesIntx10Result = Completer<double>(); |
| |
| /// Arguments are passed as pointer to copy on arm64. |
| /// Tests that the memory allocated for copies are rounded up to word size. |
| void passStruct17BytesIntx10( |
| Struct17BytesInt a0, |
| Struct17BytesInt a1, |
| Struct17BytesInt a2, |
| Struct17BytesInt a3, |
| Struct17BytesInt a4, |
| Struct17BytesInt a5, |
| Struct17BytesInt a6, |
| Struct17BytesInt a7, |
| Struct17BytesInt a8, |
| Struct17BytesInt a9) { |
| print( |
| "passStruct17BytesIntx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| |
| print("result = $result"); |
| PassStruct17BytesIntx10Result.complete(result); |
| } |
| |
| Future<void> passStruct17BytesIntx10AfterCallback() async { |
| final result = await PassStruct17BytesIntx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(15, result); |
| } |
| |
| typedef PassStruct19BytesHomogeneousUint8x10Type = Void Function( |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8); |
| |
| // Global variable that stores the result. |
| final PassStruct19BytesHomogeneousUint8x10Result = Completer<double>(); |
| |
| /// The minimum alignment of this struct is only 1 byte based on its fields. |
| /// Test that the memory backing these structs is extended to the right size. |
| /// |
| void passStruct19BytesHomogeneousUint8x10( |
| Struct19BytesHomogeneousUint8 a0, |
| Struct19BytesHomogeneousUint8 a1, |
| Struct19BytesHomogeneousUint8 a2, |
| Struct19BytesHomogeneousUint8 a3, |
| Struct19BytesHomogeneousUint8 a4, |
| Struct19BytesHomogeneousUint8 a5, |
| Struct19BytesHomogeneousUint8 a6, |
| Struct19BytesHomogeneousUint8 a7, |
| Struct19BytesHomogeneousUint8 a8, |
| Struct19BytesHomogeneousUint8 a9) { |
| print( |
| "passStruct19BytesHomogeneousUint8x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a0.a5; |
| result += a0.a6; |
| result += a0.a7; |
| result += a0.a8; |
| result += a0.a9; |
| result += a0.a10; |
| result += a0.a11; |
| result += a0.a12; |
| result += a0.a13; |
| result += a0.a14; |
| result += a0.a15; |
| result += a0.a16; |
| result += a0.a17; |
| result += a0.a18; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a1.a4; |
| result += a1.a5; |
| result += a1.a6; |
| result += a1.a7; |
| result += a1.a8; |
| result += a1.a9; |
| result += a1.a10; |
| result += a1.a11; |
| result += a1.a12; |
| result += a1.a13; |
| result += a1.a14; |
| result += a1.a15; |
| result += a1.a16; |
| result += a1.a17; |
| result += a1.a18; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a2.a4; |
| result += a2.a5; |
| result += a2.a6; |
| result += a2.a7; |
| result += a2.a8; |
| result += a2.a9; |
| result += a2.a10; |
| result += a2.a11; |
| result += a2.a12; |
| result += a2.a13; |
| result += a2.a14; |
| result += a2.a15; |
| result += a2.a16; |
| result += a2.a17; |
| result += a2.a18; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a3.a4; |
| result += a3.a5; |
| result += a3.a6; |
| result += a3.a7; |
| result += a3.a8; |
| result += a3.a9; |
| result += a3.a10; |
| result += a3.a11; |
| result += a3.a12; |
| result += a3.a13; |
| result += a3.a14; |
| result += a3.a15; |
| result += a3.a16; |
| result += a3.a17; |
| result += a3.a18; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| result += a4.a4; |
| result += a4.a5; |
| result += a4.a6; |
| result += a4.a7; |
| result += a4.a8; |
| result += a4.a9; |
| result += a4.a10; |
| result += a4.a11; |
| result += a4.a12; |
| result += a4.a13; |
| result += a4.a14; |
| result += a4.a15; |
| result += a4.a16; |
| result += a4.a17; |
| result += a4.a18; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a5.a4; |
| result += a5.a5; |
| result += a5.a6; |
| result += a5.a7; |
| result += a5.a8; |
| result += a5.a9; |
| result += a5.a10; |
| result += a5.a11; |
| result += a5.a12; |
| result += a5.a13; |
| result += a5.a14; |
| result += a5.a15; |
| result += a5.a16; |
| result += a5.a17; |
| result += a5.a18; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a6.a3; |
| result += a6.a4; |
| result += a6.a5; |
| result += a6.a6; |
| result += a6.a7; |
| result += a6.a8; |
| result += a6.a9; |
| result += a6.a10; |
| result += a6.a11; |
| result += a6.a12; |
| result += a6.a13; |
| result += a6.a14; |
| result += a6.a15; |
| result += a6.a16; |
| result += a6.a17; |
| result += a6.a18; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a7.a4; |
| result += a7.a5; |
| result += a7.a6; |
| result += a7.a7; |
| result += a7.a8; |
| result += a7.a9; |
| result += a7.a10; |
| result += a7.a11; |
| result += a7.a12; |
| result += a7.a13; |
| result += a7.a14; |
| result += a7.a15; |
| result += a7.a16; |
| result += a7.a17; |
| result += a7.a18; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a8.a4; |
| result += a8.a5; |
| result += a8.a6; |
| result += a8.a7; |
| result += a8.a8; |
| result += a8.a9; |
| result += a8.a10; |
| result += a8.a11; |
| result += a8.a12; |
| result += a8.a13; |
| result += a8.a14; |
| result += a8.a15; |
| result += a8.a16; |
| result += a8.a17; |
| result += a8.a18; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| result += a9.a3; |
| result += a9.a4; |
| result += a9.a5; |
| result += a9.a6; |
| result += a9.a7; |
| result += a9.a8; |
| result += a9.a9; |
| result += a9.a10; |
| result += a9.a11; |
| result += a9.a12; |
| result += a9.a13; |
| result += a9.a14; |
| result += a9.a15; |
| result += a9.a16; |
| result += a9.a17; |
| result += a9.a18; |
| |
| print("result = $result"); |
| PassStruct19BytesHomogeneousUint8x10Result.complete(result); |
| } |
| |
| Future<void> passStruct19BytesHomogeneousUint8x10AfterCallback() async { |
| final result = await PassStruct19BytesHomogeneousUint8x10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(18145, result); |
| } |
| |
| typedef PassStruct20BytesHomogeneousInt32x10Type = Void Function( |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32); |
| |
| // Global variable that stores the result. |
| final PassStruct20BytesHomogeneousInt32x10Result = Completer<double>(); |
| |
| /// Argument too big to go into integer registers on arm64. |
| /// The arguments are passed as pointers to copies. |
| /// The amount of arguments exhausts the number of integer registers, such that |
| /// pointers to copies are also passed on the stack. |
| void passStruct20BytesHomogeneousInt32x10( |
| Struct20BytesHomogeneousInt32 a0, |
| Struct20BytesHomogeneousInt32 a1, |
| Struct20BytesHomogeneousInt32 a2, |
| Struct20BytesHomogeneousInt32 a3, |
| Struct20BytesHomogeneousInt32 a4, |
| Struct20BytesHomogeneousInt32 a5, |
| Struct20BytesHomogeneousInt32 a6, |
| Struct20BytesHomogeneousInt32 a7, |
| Struct20BytesHomogeneousInt32 a8, |
| Struct20BytesHomogeneousInt32 a9) { |
| print( |
| "passStruct20BytesHomogeneousInt32x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a1.a4; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a2.a4; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a3.a4; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| result += a4.a4; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a5.a4; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a6.a3; |
| result += a6.a4; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a7.a4; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a8.a4; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| result += a9.a3; |
| result += a9.a4; |
| |
| print("result = $result"); |
| PassStruct20BytesHomogeneousInt32x10Result.complete(result); |
| } |
| |
| Future<void> passStruct20BytesHomogeneousInt32x10AfterCallback() async { |
| final result = await PassStruct20BytesHomogeneousInt32x10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(25, result); |
| } |
| |
| typedef PassStruct20BytesHomogeneousFloatType = Void Function( |
| Struct20BytesHomogeneousFloat); |
| |
| // Global variable that stores the result. |
| final PassStruct20BytesHomogeneousFloatResult = Completer<double>(); |
| |
| /// Argument too big to go into FPU registers in hardfp and arm64. |
| void passStruct20BytesHomogeneousFloat(Struct20BytesHomogeneousFloat a0) { |
| print("passStruct20BytesHomogeneousFloat(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| |
| print("result = $result"); |
| PassStruct20BytesHomogeneousFloatResult.complete(result); |
| } |
| |
| Future<void> passStruct20BytesHomogeneousFloatAfterCallback() async { |
| final result = await PassStruct20BytesHomogeneousFloatResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-3, result); |
| } |
| |
| typedef PassStruct32BytesHomogeneousDoublex5Type = Void Function( |
| Struct32BytesHomogeneousDouble, |
| Struct32BytesHomogeneousDouble, |
| Struct32BytesHomogeneousDouble, |
| Struct32BytesHomogeneousDouble, |
| Struct32BytesHomogeneousDouble); |
| |
| // Global variable that stores the result. |
| final PassStruct32BytesHomogeneousDoublex5Result = Completer<double>(); |
| |
| /// Arguments in FPU registers on arm64. |
| /// 5 struct arguments will exhaust available registers. |
| void passStruct32BytesHomogeneousDoublex5( |
| Struct32BytesHomogeneousDouble a0, |
| Struct32BytesHomogeneousDouble a1, |
| Struct32BytesHomogeneousDouble a2, |
| Struct32BytesHomogeneousDouble a3, |
| Struct32BytesHomogeneousDouble a4) { |
| print( |
| "passStruct32BytesHomogeneousDoublex5(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| |
| print("result = $result"); |
| PassStruct32BytesHomogeneousDoublex5Result.complete(result); |
| } |
| |
| Future<void> passStruct32BytesHomogeneousDoublex5AfterCallback() async { |
| final result = await PassStruct32BytesHomogeneousDoublex5Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStruct40BytesHomogeneousDoubleType = Void Function( |
| Struct40BytesHomogeneousDouble); |
| |
| // Global variable that stores the result. |
| final PassStruct40BytesHomogeneousDoubleResult = Completer<double>(); |
| |
| /// Argument too big to go into FPU registers in arm64. |
| void passStruct40BytesHomogeneousDouble(Struct40BytesHomogeneousDouble a0) { |
| print("passStruct40BytesHomogeneousDouble(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| |
| print("result = $result"); |
| PassStruct40BytesHomogeneousDoubleResult.complete(result); |
| } |
| |
| Future<void> passStruct40BytesHomogeneousDoubleAfterCallback() async { |
| final result = await PassStruct40BytesHomogeneousDoubleResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-3, result); |
| } |
| |
| typedef PassStruct1024BytesHomogeneousUint64Type = Void Function( |
| Struct1024BytesHomogeneousUint64); |
| |
| // Global variable that stores the result. |
| final PassStruct1024BytesHomogeneousUint64Result = Completer<double>(); |
| |
| /// Test 1kb struct. |
| void passStruct1024BytesHomogeneousUint64(Struct1024BytesHomogeneousUint64 a0) { |
| print("passStruct1024BytesHomogeneousUint64(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a0.a5; |
| result += a0.a6; |
| result += a0.a7; |
| result += a0.a8; |
| result += a0.a9; |
| result += a0.a10; |
| result += a0.a11; |
| result += a0.a12; |
| result += a0.a13; |
| result += a0.a14; |
| result += a0.a15; |
| result += a0.a16; |
| result += a0.a17; |
| result += a0.a18; |
| result += a0.a19; |
| result += a0.a20; |
| result += a0.a21; |
| result += a0.a22; |
| result += a0.a23; |
| result += a0.a24; |
| result += a0.a25; |
| result += a0.a26; |
| result += a0.a27; |
| result += a0.a28; |
| result += a0.a29; |
| result += a0.a30; |
| result += a0.a31; |
| result += a0.a32; |
| result += a0.a33; |
| result += a0.a34; |
| result += a0.a35; |
| result += a0.a36; |
| result += a0.a37; |
| result += a0.a38; |
| result += a0.a39; |
| result += a0.a40; |
| result += a0.a41; |
| result += a0.a42; |
| result += a0.a43; |
| result += a0.a44; |
| result += a0.a45; |
| result += a0.a46; |
| result += a0.a47; |
| result += a0.a48; |
| result += a0.a49; |
| result += a0.a50; |
| result += a0.a51; |
| result += a0.a52; |
| result += a0.a53; |
| result += a0.a54; |
| result += a0.a55; |
| result += a0.a56; |
| result += a0.a57; |
| result += a0.a58; |
| result += a0.a59; |
| result += a0.a60; |
| result += a0.a61; |
| result += a0.a62; |
| result += a0.a63; |
| result += a0.a64; |
| result += a0.a65; |
| result += a0.a66; |
| result += a0.a67; |
| result += a0.a68; |
| result += a0.a69; |
| result += a0.a70; |
| result += a0.a71; |
| result += a0.a72; |
| result += a0.a73; |
| result += a0.a74; |
| result += a0.a75; |
| result += a0.a76; |
| result += a0.a77; |
| result += a0.a78; |
| result += a0.a79; |
| result += a0.a80; |
| result += a0.a81; |
| result += a0.a82; |
| result += a0.a83; |
| result += a0.a84; |
| result += a0.a85; |
| result += a0.a86; |
| result += a0.a87; |
| result += a0.a88; |
| result += a0.a89; |
| result += a0.a90; |
| result += a0.a91; |
| result += a0.a92; |
| result += a0.a93; |
| result += a0.a94; |
| result += a0.a95; |
| result += a0.a96; |
| result += a0.a97; |
| result += a0.a98; |
| result += a0.a99; |
| result += a0.a100; |
| result += a0.a101; |
| result += a0.a102; |
| result += a0.a103; |
| result += a0.a104; |
| result += a0.a105; |
| result += a0.a106; |
| result += a0.a107; |
| result += a0.a108; |
| result += a0.a109; |
| result += a0.a110; |
| result += a0.a111; |
| result += a0.a112; |
| result += a0.a113; |
| result += a0.a114; |
| result += a0.a115; |
| result += a0.a116; |
| result += a0.a117; |
| result += a0.a118; |
| result += a0.a119; |
| result += a0.a120; |
| result += a0.a121; |
| result += a0.a122; |
| result += a0.a123; |
| result += a0.a124; |
| result += a0.a125; |
| result += a0.a126; |
| result += a0.a127; |
| |
| print("result = $result"); |
| PassStruct1024BytesHomogeneousUint64Result.complete(result); |
| } |
| |
| Future<void> passStruct1024BytesHomogeneousUint64AfterCallback() async { |
| final result = await PassStruct1024BytesHomogeneousUint64Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(8256, result); |
| } |
| |
| typedef PassFloatStruct16BytesHomogeneousFloatFloatStruct1Type = Void Function( |
| Float, |
| Struct16BytesHomogeneousFloat, |
| Float, |
| Struct16BytesHomogeneousFloat, |
| Float, |
| Struct16BytesHomogeneousFloat, |
| Float, |
| Struct16BytesHomogeneousFloat, |
| Float); |
| |
| // Global variable that stores the result. |
| final PassFloatStruct16BytesHomogeneousFloatFloatStruct1Result = |
| Completer<double>(); |
| |
| /// Tests the alignment of structs in FPU registers and backfilling. |
| void passFloatStruct16BytesHomogeneousFloatFloatStruct1( |
| double a0, |
| Struct16BytesHomogeneousFloat a1, |
| double a2, |
| Struct16BytesHomogeneousFloat a3, |
| double a4, |
| Struct16BytesHomogeneousFloat a5, |
| double a6, |
| Struct16BytesHomogeneousFloat a7, |
| double a8) { |
| print( |
| "passFloatStruct16BytesHomogeneousFloatFloatStruct1(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a4; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a6; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a8; |
| |
| print("result = $result"); |
| PassFloatStruct16BytesHomogeneousFloatFloatStruct1Result.complete(result); |
| } |
| |
| Future<void> |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1AfterCallback() async { |
| final result = |
| await PassFloatStruct16BytesHomogeneousFloatFloatStruct1Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-11, result); |
| } |
| |
| typedef PassFloatStruct32BytesHomogeneousDoubleFloatStructType = Void Function( |
| Float, |
| Struct32BytesHomogeneousDouble, |
| Float, |
| Struct32BytesHomogeneousDouble, |
| Float, |
| Struct32BytesHomogeneousDouble, |
| Float, |
| Struct32BytesHomogeneousDouble, |
| Float); |
| |
| // Global variable that stores the result. |
| final PassFloatStruct32BytesHomogeneousDoubleFloatStructResult = |
| Completer<double>(); |
| |
| /// Tests the alignment of structs in FPU registers and backfilling. |
| void passFloatStruct32BytesHomogeneousDoubleFloatStruct( |
| double a0, |
| Struct32BytesHomogeneousDouble a1, |
| double a2, |
| Struct32BytesHomogeneousDouble a3, |
| double a4, |
| Struct32BytesHomogeneousDouble a5, |
| double a6, |
| Struct32BytesHomogeneousDouble a7, |
| double a8) { |
| print( |
| "passFloatStruct32BytesHomogeneousDoubleFloatStruct(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a4; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a6; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a8; |
| |
| print("result = $result"); |
| PassFloatStruct32BytesHomogeneousDoubleFloatStructResult.complete(result); |
| } |
| |
| Future<void> |
| passFloatStruct32BytesHomogeneousDoubleFloatStructAfterCallback() async { |
| final result = |
| await PassFloatStruct32BytesHomogeneousDoubleFloatStructResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-11, result); |
| } |
| |
| typedef PassInt8Struct16BytesMixedInt8Struct16BytesMixedInType = Void Function( |
| Int8, |
| Struct16BytesMixed, |
| Int8, |
| Struct16BytesMixed, |
| Int8, |
| Struct16BytesMixed, |
| Int8, |
| Struct16BytesMixed, |
| Int8); |
| |
| // Global variable that stores the result. |
| final PassInt8Struct16BytesMixedInt8Struct16BytesMixedInResult = |
| Completer<double>(); |
| |
| /// Tests the alignment of structs in integers registers and on the stack. |
| /// Arm32 aligns this struct at 8. |
| /// Also, arm32 allocates the second struct partially in registers, partially |
| /// on stack. |
| /// Test backfilling of integer registers. |
| void passInt8Struct16BytesMixedInt8Struct16BytesMixedIn( |
| int a0, |
| Struct16BytesMixed a1, |
| int a2, |
| Struct16BytesMixed a3, |
| int a4, |
| Struct16BytesMixed a5, |
| int a6, |
| Struct16BytesMixed a7, |
| int a8) { |
| print( |
| "passInt8Struct16BytesMixedInt8Struct16BytesMixedIn(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8; |
| |
| print("result = $result"); |
| PassInt8Struct16BytesMixedInt8Struct16BytesMixedInResult.complete(result); |
| } |
| |
| Future<void> |
| passInt8Struct16BytesMixedInt8Struct16BytesMixedInAfterCallback() async { |
| final result = |
| await PassInt8Struct16BytesMixedInt8Struct16BytesMixedInResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-7, result); |
| } |
| |
| typedef PassDoublex6Struct16BytesMixedx4Int32Type = Void Function( |
| Double, |
| Double, |
| Double, |
| Double, |
| Double, |
| Double, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Int32); |
| |
| // Global variable that stores the result. |
| final PassDoublex6Struct16BytesMixedx4Int32Result = Completer<double>(); |
| |
| /// On Linux x64, it will exhaust xmm registers first, after 6 doubles and 2 |
| /// structs. The rest of the structs will go on the stack. |
| /// The int will be backfilled into the int register. |
| void passDoublex6Struct16BytesMixedx4Int32( |
| double a0, |
| double a1, |
| double a2, |
| double a3, |
| double a4, |
| double a5, |
| Struct16BytesMixed a6, |
| Struct16BytesMixed a7, |
| Struct16BytesMixed a8, |
| Struct16BytesMixed a9, |
| int a10) { |
| print( |
| "passDoublex6Struct16BytesMixedx4Int32(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9}, ${a10})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| result += a5; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| result += a10; |
| |
| print("result = $result"); |
| PassDoublex6Struct16BytesMixedx4Int32Result.complete(result); |
| } |
| |
| Future<void> passDoublex6Struct16BytesMixedx4Int32AfterCallback() async { |
| final result = await PassDoublex6Struct16BytesMixedx4Int32Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-8, result); |
| } |
| |
| typedef PassInt32x4Struct16BytesMixedx4DoubleType = Void Function( |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Double); |
| |
| // Global variable that stores the result. |
| final PassInt32x4Struct16BytesMixedx4DoubleResult = Completer<double>(); |
| |
| /// On Linux x64, it will exhaust int registers first. |
| /// The rest of the structs will go on the stack. |
| /// The double will be backfilled into the xmm register. |
| void passInt32x4Struct16BytesMixedx4Double( |
| int a0, |
| int a1, |
| int a2, |
| int a3, |
| Struct16BytesMixed a4, |
| Struct16BytesMixed a5, |
| Struct16BytesMixed a6, |
| Struct16BytesMixed a7, |
| double a8) { |
| print( |
| "passInt32x4Struct16BytesMixedx4Double(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8; |
| |
| print("result = $result"); |
| PassInt32x4Struct16BytesMixedx4DoubleResult.complete(result); |
| } |
| |
| Future<void> passInt32x4Struct16BytesMixedx4DoubleAfterCallback() async { |
| final result = await PassInt32x4Struct16BytesMixedx4DoubleResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-7, result); |
| } |
| |
| typedef PassStruct40BytesHomogeneousDoubleStruct4BytesHomoType = Void Function( |
| Struct40BytesHomogeneousDouble, |
| Struct4BytesHomogeneousInt16, |
| Struct8BytesHomogeneousFloat); |
| |
| // Global variable that stores the result. |
| final PassStruct40BytesHomogeneousDoubleStruct4BytesHomoResult = |
| Completer<double>(); |
| |
| /// On various architectures, first struct is allocated on stack. |
| /// Check that the other two arguments are allocated on registers. |
| void passStruct40BytesHomogeneousDoubleStruct4BytesHomo( |
| Struct40BytesHomogeneousDouble a0, |
| Struct4BytesHomogeneousInt16 a1, |
| Struct8BytesHomogeneousFloat a2) { |
| print( |
| "passStruct40BytesHomogeneousDoubleStruct4BytesHomo(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| |
| print("result = $result"); |
| PassStruct40BytesHomogeneousDoubleStruct4BytesHomoResult.complete(result); |
| } |
| |
| Future<void> |
| passStruct40BytesHomogeneousDoubleStruct4BytesHomoAfterCallback() async { |
| final result = |
| await PassStruct40BytesHomogeneousDoubleStruct4BytesHomoResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-5, result); |
| } |
| |
| typedef PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntType = Void Function( |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Double, |
| Double, |
| Double, |
| Double, |
| Double, |
| Double, |
| Double, |
| Double, |
| Int64, |
| Int8, |
| Struct1ByteInt, |
| Int64, |
| Int8, |
| Struct4BytesHomogeneousInt16, |
| Int64, |
| Int8, |
| Struct8BytesInt, |
| Int64, |
| Int8, |
| Struct8BytesHomogeneousFloat, |
| Int64, |
| Int8, |
| Struct8BytesMixed, |
| Int64, |
| Int8, |
| StructAlignmentInt16, |
| Int64, |
| Int8, |
| StructAlignmentInt32, |
| Int64, |
| Int8, |
| StructAlignmentInt64); |
| |
| // Global variable that stores the result. |
| final PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntResult = |
| Completer<double>(); |
| |
| /// Test alignment and padding of 16 byte int within struct. |
| void passInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int( |
| int a0, |
| int a1, |
| int a2, |
| int a3, |
| int a4, |
| int a5, |
| int a6, |
| int a7, |
| double a8, |
| double a9, |
| double a10, |
| double a11, |
| double a12, |
| double a13, |
| double a14, |
| double a15, |
| int a16, |
| int a17, |
| Struct1ByteInt a18, |
| int a19, |
| int a20, |
| Struct4BytesHomogeneousInt16 a21, |
| int a22, |
| int a23, |
| Struct8BytesInt a24, |
| int a25, |
| int a26, |
| Struct8BytesHomogeneousFloat a27, |
| int a28, |
| int a29, |
| Struct8BytesMixed a30, |
| int a31, |
| int a32, |
| StructAlignmentInt16 a33, |
| int a34, |
| int a35, |
| StructAlignmentInt32 a36, |
| int a37, |
| int a38, |
| StructAlignmentInt64 a39) { |
| print( |
| "passInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9}, ${a10}, ${a11}, ${a12}, ${a13}, ${a14}, ${a15}, ${a16}, ${a17}, ${a18}, ${a19}, ${a20}, ${a21}, ${a22}, ${a23}, ${a24}, ${a25}, ${a26}, ${a27}, ${a28}, ${a29}, ${a30}, ${a31}, ${a32}, ${a33}, ${a34}, ${a35}, ${a36}, ${a37}, ${a38}, ${a39})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| result += a5; |
| result += a6; |
| result += a7; |
| result += a8; |
| result += a9; |
| result += a10; |
| result += a11; |
| result += a12; |
| result += a13; |
| result += a14; |
| result += a15; |
| result += a16; |
| result += a17; |
| result += a18.a0; |
| result += a19; |
| result += a20; |
| result += a21.a0; |
| result += a21.a1; |
| result += a22; |
| result += a23; |
| result += a24.a0; |
| result += a24.a1; |
| result += a24.a2; |
| result += a25; |
| result += a26; |
| result += a27.a0; |
| result += a27.a1; |
| result += a28; |
| result += a29; |
| result += a30.a0; |
| result += a30.a1; |
| result += a30.a2; |
| result += a31; |
| result += a32; |
| result += a33.a0; |
| result += a33.a1; |
| result += a33.a2; |
| result += a34; |
| result += a35; |
| result += a36.a0; |
| result += a36.a1; |
| result += a36.a2; |
| result += a37; |
| result += a38; |
| result += a39.a0; |
| result += a39.a1; |
| result += a39.a2; |
| |
| print("result = $result"); |
| PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntResult.complete(result); |
| } |
| |
| Future<void> |
| passInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntAfterCallback() async { |
| final result = |
| await PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(26, result); |
| } |
| |
| typedef PassStructAlignmentInt16Type = Void Function(StructAlignmentInt16); |
| |
| // Global variable that stores the result. |
| final PassStructAlignmentInt16Result = Completer<double>(); |
| |
| /// Test alignment and padding of 16 byte int within struct. |
| void passStructAlignmentInt16(StructAlignmentInt16 a0) { |
| print("passStructAlignmentInt16(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| |
| print("result = $result"); |
| PassStructAlignmentInt16Result.complete(result); |
| } |
| |
| Future<void> passStructAlignmentInt16AfterCallback() async { |
| final result = await PassStructAlignmentInt16Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef PassStructAlignmentInt32Type = Void Function(StructAlignmentInt32); |
| |
| // Global variable that stores the result. |
| final PassStructAlignmentInt32Result = Completer<double>(); |
| |
| /// Test alignment and padding of 32 byte int within struct. |
| void passStructAlignmentInt32(StructAlignmentInt32 a0) { |
| print("passStructAlignmentInt32(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| |
| print("result = $result"); |
| PassStructAlignmentInt32Result.complete(result); |
| } |
| |
| Future<void> passStructAlignmentInt32AfterCallback() async { |
| final result = await PassStructAlignmentInt32Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef PassStructAlignmentInt64Type = Void Function(StructAlignmentInt64); |
| |
| // Global variable that stores the result. |
| final PassStructAlignmentInt64Result = Completer<double>(); |
| |
| /// Test alignment and padding of 64 byte int within struct. |
| void passStructAlignmentInt64(StructAlignmentInt64 a0) { |
| print("passStructAlignmentInt64(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| |
| print("result = $result"); |
| PassStructAlignmentInt64Result.complete(result); |
| } |
| |
| Future<void> passStructAlignmentInt64AfterCallback() async { |
| final result = await PassStructAlignmentInt64Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef PassStruct8BytesNestedIntx10Type = Void Function( |
| Struct8BytesNestedInt, |
| Struct8BytesNestedInt, |
| Struct8BytesNestedInt, |
| Struct8BytesNestedInt, |
| Struct8BytesNestedInt, |
| Struct8BytesNestedInt, |
| Struct8BytesNestedInt, |
| Struct8BytesNestedInt, |
| Struct8BytesNestedInt, |
| Struct8BytesNestedInt); |
| |
| // Global variable that stores the result. |
| final PassStruct8BytesNestedIntx10Result = Completer<double>(); |
| |
| /// Simple nested struct. No alignment gaps on any architectures. |
| /// 10 arguments exhaust registers on all platforms. |
| void passStruct8BytesNestedIntx10( |
| Struct8BytesNestedInt a0, |
| Struct8BytesNestedInt a1, |
| Struct8BytesNestedInt a2, |
| Struct8BytesNestedInt a3, |
| Struct8BytesNestedInt a4, |
| Struct8BytesNestedInt a5, |
| Struct8BytesNestedInt a6, |
| Struct8BytesNestedInt a7, |
| Struct8BytesNestedInt a8, |
| Struct8BytesNestedInt a9) { |
| print( |
| "passStruct8BytesNestedIntx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a0.a1; |
| result += a0.a1.a0; |
| result += a0.a1.a1; |
| result += a1.a0.a0; |
| result += a1.a0.a1; |
| result += a1.a1.a0; |
| result += a1.a1.a1; |
| result += a2.a0.a0; |
| result += a2.a0.a1; |
| result += a2.a1.a0; |
| result += a2.a1.a1; |
| result += a3.a0.a0; |
| result += a3.a0.a1; |
| result += a3.a1.a0; |
| result += a3.a1.a1; |
| result += a4.a0.a0; |
| result += a4.a0.a1; |
| result += a4.a1.a0; |
| result += a4.a1.a1; |
| result += a5.a0.a0; |
| result += a5.a0.a1; |
| result += a5.a1.a0; |
| result += a5.a1.a1; |
| result += a6.a0.a0; |
| result += a6.a0.a1; |
| result += a6.a1.a0; |
| result += a6.a1.a1; |
| result += a7.a0.a0; |
| result += a7.a0.a1; |
| result += a7.a1.a0; |
| result += a7.a1.a1; |
| result += a8.a0.a0; |
| result += a8.a0.a1; |
| result += a8.a1.a0; |
| result += a8.a1.a1; |
| result += a9.a0.a0; |
| result += a9.a0.a1; |
| result += a9.a1.a0; |
| result += a9.a1.a1; |
| |
| print("result = $result"); |
| PassStruct8BytesNestedIntx10Result.complete(result); |
| } |
| |
| Future<void> passStruct8BytesNestedIntx10AfterCallback() async { |
| final result = await PassStruct8BytesNestedIntx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(20, result); |
| } |
| |
| typedef PassStruct8BytesNestedFloatx10Type = Void Function( |
| Struct8BytesNestedFloat, |
| Struct8BytesNestedFloat, |
| Struct8BytesNestedFloat, |
| Struct8BytesNestedFloat, |
| Struct8BytesNestedFloat, |
| Struct8BytesNestedFloat, |
| Struct8BytesNestedFloat, |
| Struct8BytesNestedFloat, |
| Struct8BytesNestedFloat, |
| Struct8BytesNestedFloat); |
| |
| // Global variable that stores the result. |
| final PassStruct8BytesNestedFloatx10Result = Completer<double>(); |
| |
| /// Simple nested struct. No alignment gaps on any architectures. |
| /// 10 arguments exhaust fpu registers on all platforms. |
| void passStruct8BytesNestedFloatx10( |
| Struct8BytesNestedFloat a0, |
| Struct8BytesNestedFloat a1, |
| Struct8BytesNestedFloat a2, |
| Struct8BytesNestedFloat a3, |
| Struct8BytesNestedFloat a4, |
| Struct8BytesNestedFloat a5, |
| Struct8BytesNestedFloat a6, |
| Struct8BytesNestedFloat a7, |
| Struct8BytesNestedFloat a8, |
| Struct8BytesNestedFloat a9) { |
| print( |
| "passStruct8BytesNestedFloatx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a1.a0; |
| result += a1.a0.a0; |
| result += a1.a1.a0; |
| result += a2.a0.a0; |
| result += a2.a1.a0; |
| result += a3.a0.a0; |
| result += a3.a1.a0; |
| result += a4.a0.a0; |
| result += a4.a1.a0; |
| result += a5.a0.a0; |
| result += a5.a1.a0; |
| result += a6.a0.a0; |
| result += a6.a1.a0; |
| result += a7.a0.a0; |
| result += a7.a1.a0; |
| result += a8.a0.a0; |
| result += a8.a1.a0; |
| result += a9.a0.a0; |
| result += a9.a1.a0; |
| |
| print("result = $result"); |
| PassStruct8BytesNestedFloatx10Result.complete(result); |
| } |
| |
| Future<void> passStruct8BytesNestedFloatx10AfterCallback() async { |
| final result = await PassStruct8BytesNestedFloatx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStruct8BytesNestedFloat2x10Type = Void Function( |
| Struct8BytesNestedFloat2, |
| Struct8BytesNestedFloat2, |
| Struct8BytesNestedFloat2, |
| Struct8BytesNestedFloat2, |
| Struct8BytesNestedFloat2, |
| Struct8BytesNestedFloat2, |
| Struct8BytesNestedFloat2, |
| Struct8BytesNestedFloat2, |
| Struct8BytesNestedFloat2, |
| Struct8BytesNestedFloat2); |
| |
| // Global variable that stores the result. |
| final PassStruct8BytesNestedFloat2x10Result = Completer<double>(); |
| |
| /// Simple nested struct. No alignment gaps on any architectures. |
| /// 10 arguments exhaust fpu registers on all platforms. |
| /// The nesting is irregular, testing homogenous float rules on arm and arm64, |
| /// and the fpu register usage on x64. |
| void passStruct8BytesNestedFloat2x10( |
| Struct8BytesNestedFloat2 a0, |
| Struct8BytesNestedFloat2 a1, |
| Struct8BytesNestedFloat2 a2, |
| Struct8BytesNestedFloat2 a3, |
| Struct8BytesNestedFloat2 a4, |
| Struct8BytesNestedFloat2 a5, |
| Struct8BytesNestedFloat2 a6, |
| Struct8BytesNestedFloat2 a7, |
| Struct8BytesNestedFloat2 a8, |
| Struct8BytesNestedFloat2 a9) { |
| print( |
| "passStruct8BytesNestedFloat2x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a1; |
| result += a1.a0.a0; |
| result += a1.a1; |
| result += a2.a0.a0; |
| result += a2.a1; |
| result += a3.a0.a0; |
| result += a3.a1; |
| result += a4.a0.a0; |
| result += a4.a1; |
| result += a5.a0.a0; |
| result += a5.a1; |
| result += a6.a0.a0; |
| result += a6.a1; |
| result += a7.a0.a0; |
| result += a7.a1; |
| result += a8.a0.a0; |
| result += a8.a1; |
| result += a9.a0.a0; |
| result += a9.a1; |
| |
| print("result = $result"); |
| PassStruct8BytesNestedFloat2x10Result.complete(result); |
| } |
| |
| Future<void> passStruct8BytesNestedFloat2x10AfterCallback() async { |
| final result = await PassStruct8BytesNestedFloat2x10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStruct8BytesNestedMixedx10Type = Void Function( |
| Struct8BytesNestedMixed, |
| Struct8BytesNestedMixed, |
| Struct8BytesNestedMixed, |
| Struct8BytesNestedMixed, |
| Struct8BytesNestedMixed, |
| Struct8BytesNestedMixed, |
| Struct8BytesNestedMixed, |
| Struct8BytesNestedMixed, |
| Struct8BytesNestedMixed, |
| Struct8BytesNestedMixed); |
| |
| // Global variable that stores the result. |
| final PassStruct8BytesNestedMixedx10Result = Completer<double>(); |
| |
| /// Simple nested struct. No alignment gaps on any architectures. |
| /// 10 arguments exhaust all registers on all platforms. |
| void passStruct8BytesNestedMixedx10( |
| Struct8BytesNestedMixed a0, |
| Struct8BytesNestedMixed a1, |
| Struct8BytesNestedMixed a2, |
| Struct8BytesNestedMixed a3, |
| Struct8BytesNestedMixed a4, |
| Struct8BytesNestedMixed a5, |
| Struct8BytesNestedMixed a6, |
| Struct8BytesNestedMixed a7, |
| Struct8BytesNestedMixed a8, |
| Struct8BytesNestedMixed a9) { |
| print( |
| "passStruct8BytesNestedMixedx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a0.a1; |
| result += a0.a1.a0; |
| result += a1.a0.a0; |
| result += a1.a0.a1; |
| result += a1.a1.a0; |
| result += a2.a0.a0; |
| result += a2.a0.a1; |
| result += a2.a1.a0; |
| result += a3.a0.a0; |
| result += a3.a0.a1; |
| result += a3.a1.a0; |
| result += a4.a0.a0; |
| result += a4.a0.a1; |
| result += a4.a1.a0; |
| result += a5.a0.a0; |
| result += a5.a0.a1; |
| result += a5.a1.a0; |
| result += a6.a0.a0; |
| result += a6.a0.a1; |
| result += a6.a1.a0; |
| result += a7.a0.a0; |
| result += a7.a0.a1; |
| result += a7.a1.a0; |
| result += a8.a0.a0; |
| result += a8.a0.a1; |
| result += a8.a1.a0; |
| result += a9.a0.a0; |
| result += a9.a0.a1; |
| result += a9.a1.a0; |
| |
| print("result = $result"); |
| PassStruct8BytesNestedMixedx10Result.complete(result); |
| } |
| |
| Future<void> passStruct8BytesNestedMixedx10AfterCallback() async { |
| final result = await PassStruct8BytesNestedMixedx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(15, result); |
| } |
| |
| typedef PassStruct16BytesNestedIntx2Type = Void Function( |
| Struct16BytesNestedInt, Struct16BytesNestedInt); |
| |
| // Global variable that stores the result. |
| final PassStruct16BytesNestedIntx2Result = Completer<double>(); |
|