| // 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", |
| NativeCallable<PassStruct1ByteIntx10Type>.listener(passStruct1ByteIntx10), |
| passStruct1ByteIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct3BytesHomogeneousUint8x10", |
| NativeCallable<PassStruct3BytesHomogeneousUint8x10Type>.listener( |
| passStruct3BytesHomogeneousUint8x10), |
| passStruct3BytesHomogeneousUint8x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct3BytesInt2ByteAlignedx10", |
| NativeCallable<PassStruct3BytesInt2ByteAlignedx10Type>.listener( |
| passStruct3BytesInt2ByteAlignedx10), |
| passStruct3BytesInt2ByteAlignedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct4BytesHomogeneousInt16x10", |
| NativeCallable<PassStruct4BytesHomogeneousInt16x10Type>.listener( |
| passStruct4BytesHomogeneousInt16x10), |
| passStruct4BytesHomogeneousInt16x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct7BytesHomogeneousUint8x10", |
| NativeCallable<PassStruct7BytesHomogeneousUint8x10Type>.listener( |
| passStruct7BytesHomogeneousUint8x10), |
| passStruct7BytesHomogeneousUint8x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct7BytesInt4ByteAlignedx10", |
| NativeCallable<PassStruct7BytesInt4ByteAlignedx10Type>.listener( |
| passStruct7BytesInt4ByteAlignedx10), |
| passStruct7BytesInt4ByteAlignedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesIntx10", |
| NativeCallable<PassStruct8BytesIntx10Type>.listener( |
| passStruct8BytesIntx10), |
| passStruct8BytesIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesHomogeneousFloatx10", |
| NativeCallable<PassStruct8BytesHomogeneousFloatx10Type>.listener( |
| passStruct8BytesHomogeneousFloatx10), |
| passStruct8BytesHomogeneousFloatx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesMixedx10", |
| NativeCallable<PassStruct8BytesMixedx10Type>.listener( |
| passStruct8BytesMixedx10), |
| passStruct8BytesMixedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct9BytesHomogeneousUint8x10", |
| NativeCallable<PassStruct9BytesHomogeneousUint8x10Type>.listener( |
| passStruct9BytesHomogeneousUint8x10), |
| passStruct9BytesHomogeneousUint8x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct9BytesInt4Or8ByteAlignedx10", |
| NativeCallable<PassStruct9BytesInt4Or8ByteAlignedx10Type>.listener( |
| passStruct9BytesInt4Or8ByteAlignedx10), |
| passStruct9BytesInt4Or8ByteAlignedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct12BytesHomogeneousFloatx6", |
| NativeCallable<PassStruct12BytesHomogeneousFloatx6Type>.listener( |
| passStruct12BytesHomogeneousFloatx6), |
| passStruct12BytesHomogeneousFloatx6AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct16BytesHomogeneousFloatx5", |
| NativeCallable<PassStruct16BytesHomogeneousFloatx5Type>.listener( |
| passStruct16BytesHomogeneousFloatx5), |
| passStruct16BytesHomogeneousFloatx5AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct16BytesMixedx10", |
| NativeCallable<PassStruct16BytesMixedx10Type>.listener( |
| passStruct16BytesMixedx10), |
| passStruct16BytesMixedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct16BytesMixed2x10", |
| NativeCallable<PassStruct16BytesMixed2x10Type>.listener( |
| passStruct16BytesMixed2x10), |
| passStruct16BytesMixed2x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct17BytesIntx10", |
| NativeCallable<PassStruct17BytesIntx10Type>.listener( |
| passStruct17BytesIntx10), |
| passStruct17BytesIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct19BytesHomogeneousUint8x10", |
| NativeCallable<PassStruct19BytesHomogeneousUint8x10Type>.listener( |
| passStruct19BytesHomogeneousUint8x10), |
| passStruct19BytesHomogeneousUint8x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct20BytesHomogeneousInt32x10", |
| NativeCallable<PassStruct20BytesHomogeneousInt32x10Type>.listener( |
| passStruct20BytesHomogeneousInt32x10), |
| passStruct20BytesHomogeneousInt32x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct20BytesHomogeneousFloat", |
| NativeCallable<PassStruct20BytesHomogeneousFloatType>.listener( |
| passStruct20BytesHomogeneousFloat), |
| passStruct20BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct32BytesHomogeneousDoublex5", |
| NativeCallable<PassStruct32BytesHomogeneousDoublex5Type>.listener( |
| passStruct32BytesHomogeneousDoublex5), |
| passStruct32BytesHomogeneousDoublex5AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct40BytesHomogeneousDouble", |
| NativeCallable<PassStruct40BytesHomogeneousDoubleType>.listener( |
| passStruct40BytesHomogeneousDouble), |
| passStruct40BytesHomogeneousDoubleAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct1024BytesHomogeneousUint64", |
| NativeCallable<PassStruct1024BytesHomogeneousUint64Type>.listener( |
| passStruct1024BytesHomogeneousUint64), |
| passStruct1024BytesHomogeneousUint64AfterCallback), |
| AsyncCallbackTest( |
| "PassFloatStruct16BytesHomogeneousFloatFloatStruct1", |
| NativeCallable< |
| PassFloatStruct16BytesHomogeneousFloatFloatStruct1Type>.listener( |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1), |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1AfterCallback), |
| AsyncCallbackTest( |
| "PassFloatStruct32BytesHomogeneousDoubleFloatStruct", |
| NativeCallable< |
| PassFloatStruct32BytesHomogeneousDoubleFloatStructType>.listener( |
| passFloatStruct32BytesHomogeneousDoubleFloatStruct), |
| passFloatStruct32BytesHomogeneousDoubleFloatStructAfterCallback), |
| AsyncCallbackTest( |
| "PassInt8Struct16BytesMixedInt8Struct16BytesMixedIn", |
| NativeCallable< |
| PassInt8Struct16BytesMixedInt8Struct16BytesMixedInType>.listener( |
| passInt8Struct16BytesMixedInt8Struct16BytesMixedIn), |
| passInt8Struct16BytesMixedInt8Struct16BytesMixedInAfterCallback), |
| AsyncCallbackTest( |
| "PassDoublex6Struct16BytesMixedx4Int32", |
| NativeCallable<PassDoublex6Struct16BytesMixedx4Int32Type>.listener( |
| passDoublex6Struct16BytesMixedx4Int32), |
| passDoublex6Struct16BytesMixedx4Int32AfterCallback), |
| AsyncCallbackTest( |
| "PassInt32x4Struct16BytesMixedx4Double", |
| NativeCallable<PassInt32x4Struct16BytesMixedx4DoubleType>.listener( |
| passInt32x4Struct16BytesMixedx4Double), |
| passInt32x4Struct16BytesMixedx4DoubleAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct40BytesHomogeneousDoubleStruct4BytesHomo", |
| NativeCallable< |
| PassStruct40BytesHomogeneousDoubleStruct4BytesHomoType>.listener( |
| passStruct40BytesHomogeneousDoubleStruct4BytesHomo), |
| passStruct40BytesHomogeneousDoubleStruct4BytesHomoAfterCallback), |
| AsyncCallbackTest( |
| "PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int", |
| NativeCallable< |
| PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntType>.listener( |
| passInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int), |
| passInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntAfterCallback), |
| AsyncCallbackTest( |
| "PassStructAlignmentInt16", |
| NativeCallable<PassStructAlignmentInt16Type>.listener( |
| passStructAlignmentInt16), |
| passStructAlignmentInt16AfterCallback), |
| AsyncCallbackTest( |
| "PassStructAlignmentInt32", |
| NativeCallable<PassStructAlignmentInt32Type>.listener( |
| passStructAlignmentInt32), |
| passStructAlignmentInt32AfterCallback), |
| AsyncCallbackTest( |
| "PassStructAlignmentInt64", |
| NativeCallable<PassStructAlignmentInt64Type>.listener( |
| passStructAlignmentInt64), |
| passStructAlignmentInt64AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesNestedIntx10", |
| NativeCallable<PassStruct8BytesNestedIntx10Type>.listener( |
| passStruct8BytesNestedIntx10), |
| passStruct8BytesNestedIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesNestedFloatx10", |
| NativeCallable<PassStruct8BytesNestedFloatx10Type>.listener( |
| passStruct8BytesNestedFloatx10), |
| passStruct8BytesNestedFloatx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesNestedFloat2x10", |
| NativeCallable<PassStruct8BytesNestedFloat2x10Type>.listener( |
| passStruct8BytesNestedFloat2x10), |
| passStruct8BytesNestedFloat2x10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesNestedMixedx10", |
| NativeCallable<PassStruct8BytesNestedMixedx10Type>.listener( |
| passStruct8BytesNestedMixedx10), |
| passStruct8BytesNestedMixedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct16BytesNestedIntx2", |
| NativeCallable<PassStruct16BytesNestedIntx2Type>.listener( |
| passStruct16BytesNestedIntx2), |
| passStruct16BytesNestedIntx2AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct32BytesNestedIntx2", |
| NativeCallable<PassStruct32BytesNestedIntx2Type>.listener( |
| passStruct32BytesNestedIntx2), |
| passStruct32BytesNestedIntx2AfterCallback), |
| AsyncCallbackTest( |
| "PassStructNestedIntStructAlignmentInt16", |
| NativeCallable<PassStructNestedIntStructAlignmentInt16Type>.listener( |
| passStructNestedIntStructAlignmentInt16), |
| passStructNestedIntStructAlignmentInt16AfterCallback), |
| AsyncCallbackTest( |
| "PassStructNestedIntStructAlignmentInt32", |
| NativeCallable<PassStructNestedIntStructAlignmentInt32Type>.listener( |
| passStructNestedIntStructAlignmentInt32), |
| passStructNestedIntStructAlignmentInt32AfterCallback), |
| AsyncCallbackTest( |
| "PassStructNestedIntStructAlignmentInt64", |
| NativeCallable<PassStructNestedIntStructAlignmentInt64Type>.listener( |
| passStructNestedIntStructAlignmentInt64), |
| passStructNestedIntStructAlignmentInt64AfterCallback), |
| AsyncCallbackTest( |
| "PassStructNestedIrregularEvenBiggerx4", |
| NativeCallable<PassStructNestedIrregularEvenBiggerx4Type>.listener( |
| passStructNestedIrregularEvenBiggerx4), |
| passStructNestedIrregularEvenBiggerx4AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesInlineArrayIntx4", |
| NativeCallable<PassStruct8BytesInlineArrayIntx4Type>.listener( |
| passStruct8BytesInlineArrayIntx4), |
| passStruct8BytesInlineArrayIntx4AfterCallback), |
| AsyncCallbackTest( |
| "PassStructInlineArrayIrregularx4", |
| NativeCallable<PassStructInlineArrayIrregularx4Type>.listener( |
| passStructInlineArrayIrregularx4), |
| passStructInlineArrayIrregularx4AfterCallback), |
| AsyncCallbackTest( |
| "PassStructInlineArray100Bytes", |
| NativeCallable<PassStructInlineArray100BytesType>.listener( |
| passStructInlineArray100Bytes), |
| passStructInlineArray100BytesAfterCallback), |
| AsyncCallbackTest( |
| "PassStructStruct16BytesHomogeneousFloat2x5", |
| NativeCallable<PassStructStruct16BytesHomogeneousFloat2x5Type>.listener( |
| passStructStruct16BytesHomogeneousFloat2x5), |
| passStructStruct16BytesHomogeneousFloat2x5AfterCallback), |
| AsyncCallbackTest( |
| "PassStructStruct32BytesHomogeneousDouble2x5", |
| NativeCallable<PassStructStruct32BytesHomogeneousDouble2x5Type>.listener( |
| passStructStruct32BytesHomogeneousDouble2x5), |
| passStructStruct32BytesHomogeneousDouble2x5AfterCallback), |
| AsyncCallbackTest( |
| "PassStructStruct16BytesMixed3x10", |
| NativeCallable<PassStructStruct16BytesMixed3x10Type>.listener( |
| passStructStruct16BytesMixed3x10), |
| passStructStruct16BytesMixed3x10AfterCallback), |
| AsyncCallbackTest( |
| "PassUint8Struct32BytesInlineArrayMultiDimensionalI", |
| NativeCallable< |
| PassUint8Struct32BytesInlineArrayMultiDimensionalIType>.listener( |
| passUint8Struct32BytesInlineArrayMultiDimensionalI), |
| passUint8Struct32BytesInlineArrayMultiDimensionalIAfterCallback), |
| AsyncCallbackTest( |
| "PassUint8Struct4BytesInlineArrayMultiDimensionalIn", |
| NativeCallable< |
| PassUint8Struct4BytesInlineArrayMultiDimensionalInType>.listener( |
| passUint8Struct4BytesInlineArrayMultiDimensionalIn), |
| passUint8Struct4BytesInlineArrayMultiDimensionalInAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct3BytesPackedIntx10", |
| NativeCallable<PassStruct3BytesPackedIntx10Type>.listener( |
| passStruct3BytesPackedIntx10), |
| passStruct3BytesPackedIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct8BytesPackedIntx10", |
| NativeCallable<PassStruct8BytesPackedIntx10Type>.listener( |
| passStruct8BytesPackedIntx10), |
| passStruct8BytesPackedIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct9BytesPackedMixedx10DoubleInt32x2", |
| NativeCallable<PassStruct9BytesPackedMixedx10DoubleInt32x2Type>.listener( |
| passStruct9BytesPackedMixedx10DoubleInt32x2), |
| passStruct9BytesPackedMixedx10DoubleInt32x2AfterCallback), |
| AsyncCallbackTest( |
| "PassStruct5BytesPackedMixed", |
| NativeCallable<PassStruct5BytesPackedMixedType>.listener( |
| passStruct5BytesPackedMixed), |
| passStruct5BytesPackedMixedAfterCallback), |
| AsyncCallbackTest( |
| "PassStructNestedAlignmentStruct5BytesPackedMixed", |
| NativeCallable< |
| PassStructNestedAlignmentStruct5BytesPackedMixedType>.listener( |
| passStructNestedAlignmentStruct5BytesPackedMixed), |
| passStructNestedAlignmentStruct5BytesPackedMixedAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct6BytesInlineArrayInt", |
| NativeCallable<PassStruct6BytesInlineArrayIntType>.listener( |
| passStruct6BytesInlineArrayInt), |
| passStruct6BytesInlineArrayIntAfterCallback), |
| AsyncCallbackTest( |
| "PassStruct15BytesInlineArrayMixed", |
| NativeCallable<PassStruct15BytesInlineArrayMixedType>.listener( |
| passStruct15BytesInlineArrayMixed), |
| passStruct15BytesInlineArrayMixedAfterCallback), |
| AsyncCallbackTest( |
| "PassUnion4BytesMixedx10", |
| NativeCallable<PassUnion4BytesMixedx10Type>.listener( |
| passUnion4BytesMixedx10), |
| passUnion4BytesMixedx10AfterCallback), |
| AsyncCallbackTest( |
| "PassUnion8BytesNestedFloatx10", |
| NativeCallable<PassUnion8BytesNestedFloatx10Type>.listener( |
| passUnion8BytesNestedFloatx10), |
| passUnion8BytesNestedFloatx10AfterCallback), |
| AsyncCallbackTest( |
| "PassUnion9BytesNestedIntx10", |
| NativeCallable<PassUnion9BytesNestedIntx10Type>.listener( |
| passUnion9BytesNestedIntx10), |
| passUnion9BytesNestedIntx10AfterCallback), |
| AsyncCallbackTest( |
| "PassUnion16BytesNestedInlineArrayFloatx10", |
| NativeCallable<PassUnion16BytesNestedInlineArrayFloatx10Type>.listener( |
| passUnion16BytesNestedInlineArrayFloatx10), |
| passUnion16BytesNestedInlineArrayFloatx10AfterCallback), |
| AsyncCallbackTest( |
| "PassUnion16BytesNestedFloatx10", |
| NativeCallable<PassUnion16BytesNestedFloatx10Type>.listener( |
| passUnion16BytesNestedFloatx10), |
| passUnion16BytesNestedFloatx10AfterCallback), |
| AsyncCallbackTest( |
| "PassUint8Boolx9Struct10BytesHomogeneousBoolBool", |
| NativeCallable< |
| PassUint8Boolx9Struct10BytesHomogeneousBoolBoolType>.listener( |
| passUint8Boolx9Struct10BytesHomogeneousBoolBool), |
| passUint8Boolx9Struct10BytesHomogeneousBoolBoolAfterCallback), |
| AsyncCallbackTest( |
| "PassUint8Boolx9Struct10BytesInlineArrayBoolBool", |
| NativeCallable< |
| PassUint8Boolx9Struct10BytesInlineArrayBoolBoolType>.listener( |
| passUint8Boolx9Struct10BytesInlineArrayBoolBool), |
| passUint8Boolx9Struct10BytesInlineArrayBoolBoolAfterCallback), |
| AsyncCallbackTest( |
| "PassUint8Struct1ByteBool", |
| NativeCallable<PassUint8Struct1ByteBoolType>.listener( |
| passUint8Struct1ByteBool), |
| passUint8Struct1ByteBoolAfterCallback), |
| AsyncCallbackTest( |
| "PassWCharStructInlineArrayIntUintPtrx2LongUnsigned", |
| NativeCallable< |
| PassWCharStructInlineArrayIntUintPtrx2LongUnsignedType>.listener( |
| passWCharStructInlineArrayIntUintPtrx2LongUnsigned), |
| passWCharStructInlineArrayIntUintPtrx2LongUnsignedAfterCallback), |
| AsyncCallbackTest( |
| "PassInt64x7Struct12BytesHomogeneousInt32", |
| NativeCallable<PassInt64x7Struct12BytesHomogeneousInt32Type>.listener( |
| passInt64x7Struct12BytesHomogeneousInt32), |
| passInt64x7Struct12BytesHomogeneousInt32AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct1ByteInt", |
| NativeCallable<ReturnStruct1ByteIntType>.listener(returnStruct1ByteInt), |
| returnStruct1ByteIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct3BytesHomogeneousUint8", |
| NativeCallable<ReturnStruct3BytesHomogeneousUint8Type>.listener( |
| returnStruct3BytesHomogeneousUint8), |
| returnStruct3BytesHomogeneousUint8AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct3BytesInt2ByteAligned", |
| NativeCallable<ReturnStruct3BytesInt2ByteAlignedType>.listener( |
| returnStruct3BytesInt2ByteAligned), |
| returnStruct3BytesInt2ByteAlignedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct4BytesHomogeneousInt16", |
| NativeCallable<ReturnStruct4BytesHomogeneousInt16Type>.listener( |
| returnStruct4BytesHomogeneousInt16), |
| returnStruct4BytesHomogeneousInt16AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct7BytesHomogeneousUint8", |
| NativeCallable<ReturnStruct7BytesHomogeneousUint8Type>.listener( |
| returnStruct7BytesHomogeneousUint8), |
| returnStruct7BytesHomogeneousUint8AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct7BytesInt4ByteAligned", |
| NativeCallable<ReturnStruct7BytesInt4ByteAlignedType>.listener( |
| returnStruct7BytesInt4ByteAligned), |
| returnStruct7BytesInt4ByteAlignedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesInt", |
| NativeCallable<ReturnStruct8BytesIntType>.listener(returnStruct8BytesInt), |
| returnStruct8BytesIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesHomogeneousFloat", |
| NativeCallable<ReturnStruct8BytesHomogeneousFloatType>.listener( |
| returnStruct8BytesHomogeneousFloat), |
| returnStruct8BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesMixed", |
| NativeCallable<ReturnStruct8BytesMixedType>.listener( |
| returnStruct8BytesMixed), |
| returnStruct8BytesMixedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct9BytesHomogeneousUint8", |
| NativeCallable<ReturnStruct9BytesHomogeneousUint8Type>.listener( |
| returnStruct9BytesHomogeneousUint8), |
| returnStruct9BytesHomogeneousUint8AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct9BytesInt4Or8ByteAligned", |
| NativeCallable<ReturnStruct9BytesInt4Or8ByteAlignedType>.listener( |
| returnStruct9BytesInt4Or8ByteAligned), |
| returnStruct9BytesInt4Or8ByteAlignedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct12BytesHomogeneousFloat", |
| NativeCallable<ReturnStruct12BytesHomogeneousFloatType>.listener( |
| returnStruct12BytesHomogeneousFloat), |
| returnStruct12BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct16BytesHomogeneousFloat", |
| NativeCallable<ReturnStruct16BytesHomogeneousFloatType>.listener( |
| returnStruct16BytesHomogeneousFloat), |
| returnStruct16BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct16BytesMixed", |
| NativeCallable<ReturnStruct16BytesMixedType>.listener( |
| returnStruct16BytesMixed), |
| returnStruct16BytesMixedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct16BytesMixed2", |
| NativeCallable<ReturnStruct16BytesMixed2Type>.listener( |
| returnStruct16BytesMixed2), |
| returnStruct16BytesMixed2AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct17BytesInt", |
| NativeCallable<ReturnStruct17BytesIntType>.listener( |
| returnStruct17BytesInt), |
| returnStruct17BytesIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct19BytesHomogeneousUint8", |
| NativeCallable<ReturnStruct19BytesHomogeneousUint8Type>.listener( |
| returnStruct19BytesHomogeneousUint8), |
| returnStruct19BytesHomogeneousUint8AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct20BytesHomogeneousInt32", |
| NativeCallable<ReturnStruct20BytesHomogeneousInt32Type>.listener( |
| returnStruct20BytesHomogeneousInt32), |
| returnStruct20BytesHomogeneousInt32AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct20BytesHomogeneousFloat", |
| NativeCallable<ReturnStruct20BytesHomogeneousFloatType>.listener( |
| returnStruct20BytesHomogeneousFloat), |
| returnStruct20BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct32BytesHomogeneousDouble", |
| NativeCallable<ReturnStruct32BytesHomogeneousDoubleType>.listener( |
| returnStruct32BytesHomogeneousDouble), |
| returnStruct32BytesHomogeneousDoubleAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct40BytesHomogeneousDouble", |
| NativeCallable<ReturnStruct40BytesHomogeneousDoubleType>.listener( |
| returnStruct40BytesHomogeneousDouble), |
| returnStruct40BytesHomogeneousDoubleAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct1024BytesHomogeneousUint64", |
| NativeCallable<ReturnStruct1024BytesHomogeneousUint64Type>.listener( |
| returnStruct1024BytesHomogeneousUint64), |
| returnStruct1024BytesHomogeneousUint64AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct3BytesPackedInt", |
| NativeCallable<ReturnStruct3BytesPackedIntType>.listener( |
| returnStruct3BytesPackedInt), |
| returnStruct3BytesPackedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesPackedInt", |
| NativeCallable<ReturnStruct8BytesPackedIntType>.listener( |
| returnStruct8BytesPackedInt), |
| returnStruct8BytesPackedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct9BytesPackedMixed", |
| NativeCallable<ReturnStruct9BytesPackedMixedType>.listener( |
| returnStruct9BytesPackedMixed), |
| returnStruct9BytesPackedMixedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnUnion4BytesMixed", |
| NativeCallable<ReturnUnion4BytesMixedType>.listener( |
| returnUnion4BytesMixed), |
| returnUnion4BytesMixedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnUnion8BytesNestedFloat", |
| NativeCallable<ReturnUnion8BytesNestedFloatType>.listener( |
| returnUnion8BytesNestedFloat), |
| returnUnion8BytesNestedFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnUnion9BytesNestedInt", |
| NativeCallable<ReturnUnion9BytesNestedIntType>.listener( |
| returnUnion9BytesNestedInt), |
| returnUnion9BytesNestedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnUnion16BytesNestedFloat", |
| NativeCallable<ReturnUnion16BytesNestedFloatType>.listener( |
| returnUnion16BytesNestedFloat), |
| returnUnion16BytesNestedFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStruct1ByteInt", |
| NativeCallable<ReturnStructArgumentStruct1ByteIntType>.listener( |
| returnStructArgumentStruct1ByteInt), |
| returnStructArgumentStruct1ByteIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentInt32x8Struct1ByteInt", |
| NativeCallable<ReturnStructArgumentInt32x8Struct1ByteIntType>.listener( |
| returnStructArgumentInt32x8Struct1ByteInt), |
| returnStructArgumentInt32x8Struct1ByteIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStruct8BytesHomogeneousFloat", |
| NativeCallable< |
| ReturnStructArgumentStruct8BytesHomogeneousFloatType>.listener( |
| returnStructArgumentStruct8BytesHomogeneousFloat), |
| returnStructArgumentStruct8BytesHomogeneousFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStruct20BytesHomogeneousInt32", |
| NativeCallable< |
| ReturnStructArgumentStruct20BytesHomogeneousInt32Type>.listener( |
| returnStructArgumentStruct20BytesHomogeneousInt32), |
| returnStructArgumentStruct20BytesHomogeneousInt32AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentInt32x8Struct20BytesHomogeneou", |
| NativeCallable< |
| ReturnStructArgumentInt32x8Struct20BytesHomogeneouType>.listener( |
| returnStructArgumentInt32x8Struct20BytesHomogeneou), |
| returnStructArgumentInt32x8Struct20BytesHomogeneouAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStruct8BytesInlineArrayInt", |
| NativeCallable< |
| ReturnStructArgumentStruct8BytesInlineArrayIntType>.listener( |
| returnStructArgumentStruct8BytesInlineArrayInt), |
| returnStructArgumentStruct8BytesInlineArrayIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStructStruct16BytesHomogeneous", |
| NativeCallable< |
| ReturnStructArgumentStructStruct16BytesHomogeneousType>.listener( |
| returnStructArgumentStructStruct16BytesHomogeneous), |
| returnStructArgumentStructStruct16BytesHomogeneousAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStructStruct32BytesHomogeneous", |
| NativeCallable< |
| ReturnStructArgumentStructStruct32BytesHomogeneousType>.listener( |
| returnStructArgumentStructStruct32BytesHomogeneous), |
| returnStructArgumentStructStruct32BytesHomogeneousAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructArgumentStructStruct16BytesMixed3", |
| NativeCallable< |
| ReturnStructArgumentStructStruct16BytesMixed3Type>.listener( |
| returnStructArgumentStructStruct16BytesMixed3), |
| returnStructArgumentStructStruct16BytesMixed3AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructAlignmentInt16", |
| NativeCallable<ReturnStructAlignmentInt16Type>.listener( |
| returnStructAlignmentInt16), |
| returnStructAlignmentInt16AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructAlignmentInt32", |
| NativeCallable<ReturnStructAlignmentInt32Type>.listener( |
| returnStructAlignmentInt32), |
| returnStructAlignmentInt32AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructAlignmentInt64", |
| NativeCallable<ReturnStructAlignmentInt64Type>.listener( |
| returnStructAlignmentInt64), |
| returnStructAlignmentInt64AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesNestedInt", |
| NativeCallable<ReturnStruct8BytesNestedIntType>.listener( |
| returnStruct8BytesNestedInt), |
| returnStruct8BytesNestedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesNestedFloat", |
| NativeCallable<ReturnStruct8BytesNestedFloatType>.listener( |
| returnStruct8BytesNestedFloat), |
| returnStruct8BytesNestedFloatAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesNestedFloat2", |
| NativeCallable<ReturnStruct8BytesNestedFloat2Type>.listener( |
| returnStruct8BytesNestedFloat2), |
| returnStruct8BytesNestedFloat2AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct8BytesNestedMixed", |
| NativeCallable<ReturnStruct8BytesNestedMixedType>.listener( |
| returnStruct8BytesNestedMixed), |
| returnStruct8BytesNestedMixedAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct16BytesNestedInt", |
| NativeCallable<ReturnStruct16BytesNestedIntType>.listener( |
| returnStruct16BytesNestedInt), |
| returnStruct16BytesNestedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStruct32BytesNestedInt", |
| NativeCallable<ReturnStruct32BytesNestedIntType>.listener( |
| returnStruct32BytesNestedInt), |
| returnStruct32BytesNestedIntAfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructNestedIntStructAlignmentInt16", |
| NativeCallable<ReturnStructNestedIntStructAlignmentInt16Type>.listener( |
| returnStructNestedIntStructAlignmentInt16), |
| returnStructNestedIntStructAlignmentInt16AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructNestedIntStructAlignmentInt32", |
| NativeCallable<ReturnStructNestedIntStructAlignmentInt32Type>.listener( |
| returnStructNestedIntStructAlignmentInt32), |
| returnStructNestedIntStructAlignmentInt32AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructNestedIntStructAlignmentInt64", |
| NativeCallable<ReturnStructNestedIntStructAlignmentInt64Type>.listener( |
| returnStructNestedIntStructAlignmentInt64), |
| returnStructNestedIntStructAlignmentInt64AfterCallback), |
| AsyncCallbackTest( |
| "ReturnStructNestedIrregularEvenBigger", |
| NativeCallable<ReturnStructNestedIrregularEvenBiggerType>.listener( |
| 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 PassStruct16
|