| // 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"; |
| |
| 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 PassStruct16BytesNestedIntx2Result = Completer<double>(); |
| |
| /// Deeper nested struct to test recursive member access. |
| void passStruct16BytesNestedIntx2( |
| Struct16BytesNestedInt a0, Struct16BytesNestedInt a1) { |
| print("passStruct16BytesNestedIntx2(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0.a0; |
| result += a0.a0.a0.a1; |
| result += a0.a0.a1.a0; |
| result += a0.a0.a1.a1; |
| result += a0.a1.a0.a0; |
| result += a0.a1.a0.a1; |
| result += a0.a1.a1.a0; |
| result += a0.a1.a1.a1; |
| result += a1.a0.a0.a0; |
| result += a1.a0.a0.a1; |
| result += a1.a0.a1.a0; |
| result += a1.a0.a1.a1; |
| result += a1.a1.a0.a0; |
| result += a1.a1.a0.a1; |
| result += a1.a1.a1.a0; |
| result += a1.a1.a1.a1; |
| |
| print("result = $result"); |
| PassStruct16BytesNestedIntx2Result.complete(result); |
| } |
| |
| Future<void> passStruct16BytesNestedIntx2AfterCallback() async { |
| final result = await PassStruct16BytesNestedIntx2Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(8, result); |
| } |
| |
| typedef PassStruct32BytesNestedIntx2Type = Void Function( |
| Struct32BytesNestedInt, Struct32BytesNestedInt); |
| |
| // Global variable that stores the result. |
| final PassStruct32BytesNestedIntx2Result = Completer<double>(); |
| |
| /// Even deeper nested struct to test recursive member access. |
| void passStruct32BytesNestedIntx2( |
| Struct32BytesNestedInt a0, Struct32BytesNestedInt a1) { |
| print("passStruct32BytesNestedIntx2(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0.a0.a0; |
| result += a0.a0.a0.a0.a1; |
| result += a0.a0.a0.a1.a0; |
| result += a0.a0.a0.a1.a1; |
| result += a0.a0.a1.a0.a0; |
| result += a0.a0.a1.a0.a1; |
| result += a0.a0.a1.a1.a0; |
| result += a0.a0.a1.a1.a1; |
| result += a0.a1.a0.a0.a0; |
| result += a0.a1.a0.a0.a1; |
| result += a0.a1.a0.a1.a0; |
| result += a0.a1.a0.a1.a1; |
| result += a0.a1.a1.a0.a0; |
| result += a0.a1.a1.a0.a1; |
| result += a0.a1.a1.a1.a0; |
| result += a0.a1.a1.a1.a1; |
| result += a1.a0.a0.a0.a0; |
| result += a1.a0.a0.a0.a1; |
| result += a1.a0.a0.a1.a0; |
| result += a1.a0.a0.a1.a1; |
| result += a1.a0.a1.a0.a0; |
| result += a1.a0.a1.a0.a1; |
| result += a1.a0.a1.a1.a0; |
| result += a1.a0.a1.a1.a1; |
| result += a1.a1.a0.a0.a0; |
| result += a1.a1.a0.a0.a1; |
| result += a1.a1.a0.a1.a0; |
| result += a1.a1.a0.a1.a1; |
| result += a1.a1.a1.a0.a0; |
| result += a1.a1.a1.a0.a1; |
| result += a1.a1.a1.a1.a0; |
| result += a1.a1.a1.a1.a1; |
| |
| print("result = $result"); |
| PassStruct32BytesNestedIntx2Result.complete(result); |
| } |
| |
| Future<void> passStruct32BytesNestedIntx2AfterCallback() async { |
| final result = await PassStruct32BytesNestedIntx2Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(16, result); |
| } |
| |
| typedef PassStructNestedIntStructAlignmentInt16Type = Void Function( |
| StructNestedIntStructAlignmentInt16); |
| |
| // Global variable that stores the result. |
| final PassStructNestedIntStructAlignmentInt16Result = Completer<double>(); |
| |
| /// Test alignment and padding of nested struct with 16 byte int. |
| void passStructNestedIntStructAlignmentInt16( |
| StructNestedIntStructAlignmentInt16 a0) { |
| print("passStructNestedIntStructAlignmentInt16(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a0.a1; |
| result += a0.a0.a2; |
| result += a0.a1.a0; |
| result += a0.a1.a1; |
| result += a0.a1.a2; |
| |
| print("result = $result"); |
| PassStructNestedIntStructAlignmentInt16Result.complete(result); |
| } |
| |
| Future<void> passStructNestedIntStructAlignmentInt16AfterCallback() async { |
| final result = await PassStructNestedIntStructAlignmentInt16Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(3, result); |
| } |
| |
| typedef PassStructNestedIntStructAlignmentInt32Type = Void Function( |
| StructNestedIntStructAlignmentInt32); |
| |
| // Global variable that stores the result. |
| final PassStructNestedIntStructAlignmentInt32Result = Completer<double>(); |
| |
| /// Test alignment and padding of nested struct with 32 byte int. |
| void passStructNestedIntStructAlignmentInt32( |
| StructNestedIntStructAlignmentInt32 a0) { |
| print("passStructNestedIntStructAlignmentInt32(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a0.a1; |
| result += a0.a0.a2; |
| result += a0.a1.a0; |
| result += a0.a1.a1; |
| result += a0.a1.a2; |
| |
| print("result = $result"); |
| PassStructNestedIntStructAlignmentInt32Result.complete(result); |
| } |
| |
| Future<void> passStructNestedIntStructAlignmentInt32AfterCallback() async { |
| final result = await PassStructNestedIntStructAlignmentInt32Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(3, result); |
| } |
| |
| typedef PassStructNestedIntStructAlignmentInt64Type = Void Function( |
| StructNestedIntStructAlignmentInt64); |
| |
| // Global variable that stores the result. |
| final PassStructNestedIntStructAlignmentInt64Result = Completer<double>(); |
| |
| /// Test alignment and padding of nested struct with 64 byte int. |
| void passStructNestedIntStructAlignmentInt64( |
| StructNestedIntStructAlignmentInt64 a0) { |
| print("passStructNestedIntStructAlignmentInt64(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a0.a1; |
| result += a0.a0.a2; |
| result += a0.a1.a0; |
| result += a0.a1.a1; |
| result += a0.a1.a2; |
| |
| print("result = $result"); |
| PassStructNestedIntStructAlignmentInt64Result.complete(result); |
| } |
| |
| Future<void> passStructNestedIntStructAlignmentInt64AfterCallback() async { |
| final result = await PassStructNestedIntStructAlignmentInt64Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(3, result); |
| } |
| |
| typedef PassStructNestedIrregularEvenBiggerx4Type = Void Function( |
| StructNestedIrregularEvenBigger, |
| StructNestedIrregularEvenBigger, |
| StructNestedIrregularEvenBigger, |
| StructNestedIrregularEvenBigger); |
| |
| // Global variable that stores the result. |
| final PassStructNestedIrregularEvenBiggerx4Result = Completer<double>(); |
| |
| /// Return big irregular struct as smoke test. |
| void passStructNestedIrregularEvenBiggerx4( |
| StructNestedIrregularEvenBigger a0, |
| StructNestedIrregularEvenBigger a1, |
| StructNestedIrregularEvenBigger a2, |
| StructNestedIrregularEvenBigger a3) { |
| print("passStructNestedIrregularEvenBiggerx4(${a0}, ${a1}, ${a2}, ${a3})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1.a0.a0; |
| result += a0.a1.a0.a1.a0.a0; |
| result += a0.a1.a0.a1.a0.a1; |
| result += a0.a1.a0.a1.a1.a0; |
| result += a0.a1.a0.a2; |
| result += a0.a1.a0.a3.a0.a0; |
| result += a0.a1.a0.a3.a1; |
| result += a0.a1.a0.a4; |
| result += a0.a1.a0.a5.a0.a0; |
| result += a0.a1.a0.a5.a1.a0; |
| result += a0.a1.a0.a6; |
| result += a0.a1.a1.a0.a0; |
| result += a0.a1.a1.a0.a1; |
| result += a0.a1.a1.a1.a0; |
| result += a0.a1.a2; |
| result += a0.a1.a3; |
| result += a0.a2.a0.a0; |
| result += a0.a2.a0.a1.a0.a0; |
| result += a0.a2.a0.a1.a0.a1; |
| result += a0.a2.a0.a1.a1.a0; |
| result += a0.a2.a0.a2; |
| result += a0.a2.a0.a3.a0.a0; |
| result += a0.a2.a0.a3.a1; |
| result += a0.a2.a0.a4; |
| result += a0.a2.a0.a5.a0.a0; |
| result += a0.a2.a0.a5.a1.a0; |
| result += a0.a2.a0.a6; |
| result += a0.a2.a1.a0.a0; |
| result += a0.a2.a1.a0.a1; |
| result += a0.a2.a1.a1.a0; |
| result += a0.a2.a2; |
| result += a0.a2.a3; |
| result += a0.a3; |
| result += a1.a0; |
| result += a1.a1.a0.a0; |
| result += a1.a1.a0.a1.a0.a0; |
| result += a1.a1.a0.a1.a0.a1; |
| result += a1.a1.a0.a1.a1.a0; |
| result += a1.a1.a0.a2; |
| result += a1.a1.a0.a3.a0.a0; |
| result += a1.a1.a0.a3.a1; |
| result += a1.a1.a0.a4; |
| result += a1.a1.a0.a5.a0.a0; |
| result += a1.a1.a0.a5.a1.a0; |
| result += a1.a1.a0.a6; |
| result += a1.a1.a1.a0.a0; |
| result += a1.a1.a1.a0.a1; |
| result += a1.a1.a1.a1.a0; |
| result += a1.a1.a2; |
| result += a1.a1.a3; |
| result += a1.a2.a0.a0; |
| result += a1.a2.a0.a1.a0.a0; |
| result += a1.a2.a0.a1.a0.a1; |
| result += a1.a2.a0.a1.a1.a0; |
| result += a1.a2.a0.a2; |
| result += a1.a2.a0.a3.a0.a0; |
| result += a1.a2.a0.a3.a1; |
| result += a1.a2.a0.a4; |
| result += a1.a2.a0.a5.a0.a0; |
| result += a1.a2.a0.a5.a1.a0; |
| result += a1.a2.a0.a6; |
| result += a1.a2.a1.a0.a0; |
| result += a1.a2.a1.a0.a1; |
| result += a1.a2.a1.a1.a0; |
| result += a1.a2.a2; |
| result += a1.a2.a3; |
| result += a1.a3; |
| result += a2.a0; |
| result += a2.a1.a0.a0; |
| result += a2.a1.a0.a1.a0.a0; |
| result += a2.a1.a0.a1.a0.a1; |
| result += a2.a1.a0.a1.a1.a0; |
| result += a2.a1.a0.a2; |
| result += a2.a1.a0.a3.a0.a0; |
| result += a2.a1.a0.a3.a1; |
| result += a2.a1.a0.a4; |
| result += a2.a1.a0.a5.a0.a0; |
| result += a2.a1.a0.a5.a1.a0; |
| result += a2.a1.a0.a6; |
| result += a2.a1.a1.a0.a0; |
| result += a2.a1.a1.a0.a1; |
| result += a2.a1.a1.a1.a0; |
| result += a2.a1.a2; |
| result += a2.a1.a3; |
| result += a2.a2.a0.a0; |
| result += a2.a2.a0.a1.a0.a0; |
| result += a2.a2.a0.a1.a0.a1; |
| result += a2.a2.a0.a1.a1.a0; |
| result += a2.a2.a0.a2; |
| result += a2.a2.a0.a3.a0.a0; |
| result += a2.a2.a0.a3.a1; |
| result += a2.a2.a0.a4; |
| result += a2.a2.a0.a5.a0.a0; |
| result += a2.a2.a0.a5.a1.a0; |
| result += a2.a2.a0.a6; |
| result += a2.a2.a1.a0.a0; |
| result += a2.a2.a1.a0.a1; |
| result += a2.a2.a1.a1.a0; |
| result += a2.a2.a2; |
| result += a2.a2.a3; |
| result += a2.a3; |
| result += a3.a0; |
| result += a3.a1.a0.a0; |
| result += a3.a1.a0.a1.a0.a0; |
| result += a3.a1.a0.a1.a0.a1; |
| result += a3.a1.a0.a1.a1.a0; |
| result += a3.a1.a0.a2; |
| result += a3.a1.a0.a3.a0.a0; |
| result += a3.a1.a0.a3.a1; |
| result += a3.a1.a0.a4; |
| result += a3.a1.a0.a5.a0.a0; |
| result += a3.a1.a0.a5.a1.a0; |
| result += a3.a1.a0.a6; |
| result += a3.a1.a1.a0.a0; |
| result += a3.a1.a1.a0.a1; |
| result += a3.a1.a1.a1.a0; |
| result += a3.a1.a2; |
| result += a3.a1.a3; |
| result += a3.a2.a0.a0; |
| result += a3.a2.a0.a1.a0.a0; |
| result += a3.a2.a0.a1.a0.a1; |
| result += a3.a2.a0.a1.a1.a0; |
| result += a3.a2.a0.a2; |
| result += a3.a2.a0.a3.a0.a0; |
| result += a3.a2.a0.a3.a1; |
| result += a3.a2.a0.a4; |
| result += a3.a2.a0.a5.a0.a0; |
| result += a3.a2.a0.a5.a1.a0; |
| result += a3.a2.a0.a6; |
| result += a3.a2.a1.a0.a0; |
| result += a3.a2.a1.a0.a1; |
| result += a3.a2.a1.a1.a0; |
| result += a3.a2.a2; |
| result += a3.a2.a3; |
| result += a3.a3; |
| |
| print("result = $result"); |
| PassStructNestedIrregularEvenBiggerx4Result.complete(result); |
| } |
| |
| Future<void> passStructNestedIrregularEvenBiggerx4AfterCallback() async { |
| final result = await PassStructNestedIrregularEvenBiggerx4Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1572, result); |
| } |
| |
| typedef PassStruct8BytesInlineArrayIntx4Type = Void Function( |
| Struct8BytesInlineArrayInt, |
| Struct8BytesInlineArrayInt, |
| Struct8BytesInlineArrayInt, |
| Struct8BytesInlineArrayInt); |
| |
| // Global variable that stores the result. |
| final PassStruct8BytesInlineArrayIntx4Result = Completer<double>(); |
| |
| /// Simple struct with inline array. |
| void passStruct8BytesInlineArrayIntx4( |
| Struct8BytesInlineArrayInt a0, |
| Struct8BytesInlineArrayInt a1, |
| Struct8BytesInlineArrayInt a2, |
| Struct8BytesInlineArrayInt a3) { |
| print("passStruct8BytesInlineArrayIntx4(${a0}, ${a1}, ${a2}, ${a3})"); |
| |
| double result = 0; |
| |
| result += a0.a0[0]; |
| result += a0.a0[1]; |
| result += a0.a0[2]; |
| result += a0.a0[3]; |
| result += a0.a0[4]; |
| result += a0.a0[5]; |
| result += a0.a0[6]; |
| result += a0.a0[7]; |
| result += a1.a0[0]; |
| result += a1.a0[1]; |
| result += a1.a0[2]; |
| result += a1.a0[3]; |
| result += a1.a0[4]; |
| result += a1.a0[5]; |
| result += a1.a0[6]; |
| result += a1.a0[7]; |
| result += a2.a0[0]; |
| result += a2.a0[1]; |
| result += a2.a0[2]; |
| result += a2.a0[3]; |
| result += a2.a0[4]; |
| result += a2.a0[5]; |
| result += a2.a0[6]; |
| result += a2.a0[7]; |
| result += a3.a0[0]; |
| result += a3.a0[1]; |
| result += a3.a0[2]; |
| result += a3.a0[3]; |
| result += a3.a0[4]; |
| result += a3.a0[5]; |
| result += a3.a0[6]; |
| result += a3.a0[7]; |
| |
| print("result = $result"); |
| PassStruct8BytesInlineArrayIntx4Result.complete(result); |
| } |
| |
| Future<void> passStruct8BytesInlineArrayIntx4AfterCallback() async { |
| final result = await PassStruct8BytesInlineArrayIntx4Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(528, result); |
| } |
| |
| typedef PassStructInlineArrayIrregularx4Type = Void Function( |
| StructInlineArrayIrregular, |
| StructInlineArrayIrregular, |
| StructInlineArrayIrregular, |
| StructInlineArrayIrregular); |
| |
| // Global variable that stores the result. |
| final PassStructInlineArrayIrregularx4Result = Completer<double>(); |
| |
| /// Irregular struct with inline array. |
| void passStructInlineArrayIrregularx4( |
| StructInlineArrayIrregular a0, |
| StructInlineArrayIrregular a1, |
| StructInlineArrayIrregular a2, |
| StructInlineArrayIrregular a3) { |
| print("passStructInlineArrayIrregularx4(${a0}, ${a1}, ${a2}, ${a3})"); |
| |
| double result = 0; |
| |
| result += a0.a0[0].a0; |
| result += a0.a0[0].a1; |
| result += a0.a0[1].a0; |
| result += a0.a0[1].a1; |
| result += a0.a1; |
| result += a1.a0[0].a0; |
| result += a1.a0[0].a1; |
| result += a1.a0[1].a0; |
| result += a1.a0[1].a1; |
| result += a1.a1; |
| result += a2.a0[0].a0; |
| result += a2.a0[0].a1; |
| result += a2.a0[1].a0; |
| result += a2.a0[1].a1; |
| result += a2.a1; |
| result += a3.a0[0].a0; |
| result += a3.a0[0].a1; |
| result += a3.a0[1].a0; |
| result += a3.a0[1].a1; |
| result += a3.a1; |
| |
| print("result = $result"); |
| PassStructInlineArrayIrregularx4Result.complete(result); |
| } |
| |
| Future<void> passStructInlineArrayIrregularx4AfterCallback() async { |
| final result = await PassStructInlineArrayIrregularx4Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(50, result); |
| } |
| |
| typedef PassStructInlineArray100BytesType = Void Function( |
| StructInlineArray100Bytes); |
| |
| // Global variable that stores the result. |
| final PassStructInlineArray100BytesResult = Completer<double>(); |
| |
| /// Regular larger struct with inline array. |
| void passStructInlineArray100Bytes(StructInlineArray100Bytes a0) { |
| print("passStructInlineArray100Bytes(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0[0]; |
| result += a0.a0[1]; |
| result += a0.a0[2]; |
| result += a0.a0[3]; |
| result += a0.a0[4]; |
| result += a0.a0[5]; |
| result += a0.a0[6]; |
| result += a0.a0[7]; |
| result += a0.a0[8]; |
| result += a0.a0[9]; |
| result += a0.a0[10]; |
| result += a0.a0[11]; |
| result += a0.a0[12]; |
| result += a0.a0[13]; |
| result += a0.a0[14]; |
| result += a0.a0[15]; |
| result += a0.a0[16]; |
| result += a0.a0[17]; |
| result += a0.a0[18]; |
| result += a0.a0[19]; |
| result += a0.a0[20]; |
| result += a0.a0[21]; |
| result += a0.a0[22]; |
| result += a0.a0[23]; |
| result += a0.a0[24]; |
| result += a0.a0[25]; |
| result += a0.a0[26]; |
| result += a0.a0[27]; |
| result += a0.a0[28]; |
| result += a0.a0[29]; |
| result += a0.a0[30]; |
| result += a0.a0[31]; |
| result += a0.a0[32]; |
| result += a0.a0[33]; |
| result += a0.a0[34]; |
| result += a0.a0[35]; |
| result += a0.a0[36]; |
| result += a0.a0[37]; |
| result += a0.a0[38]; |
| result += a0.a0[39]; |
| result += a0.a0[40]; |
| result += a0.a0[41]; |
| result += a0.a0[42]; |
| result += a0.a0[43]; |
| result += a0.a0[44]; |
| result += a0.a0[45]; |
| result += a0.a0[46]; |
| result += a0.a0[47]; |
| result += a0.a0[48]; |
| result += a0.a0[49]; |
| result += a0.a0[50]; |
| result += a0.a0[51]; |
| result += a0.a0[52]; |
| result += a0.a0[53]; |
| result += a0.a0[54]; |
| result += a0.a0[55]; |
| result += a0.a0[56]; |
| result += a0.a0[57]; |
| result += a0.a0[58]; |
| result += a0.a0[59]; |
| result += a0.a0[60]; |
| result += a0.a0[61]; |
| result += a0.a0[62]; |
| result += a0.a0[63]; |
| result += a0.a0[64]; |
| result += a0.a0[65]; |
| result += a0.a0[66]; |
| result += a0.a0[67]; |
| result += a0.a0[68]; |
| result += a0.a0[69]; |
| result += a0.a0[70]; |
| result += a0.a0[71]; |
| result += a0.a0[72]; |
| result += a0.a0[73]; |
| result += a0.a0[74]; |
| result += a0.a0[75]; |
| result += a0.a0[76]; |
| result += a0.a0[77]; |
| result += a0.a0[78]; |
| result += a0.a0[79]; |
| result += a0.a0[80]; |
| result += a0.a0[81]; |
| result += a0.a0[82]; |
| result += a0.a0[83]; |
| result += a0.a0[84]; |
| result += a0.a0[85]; |
| result += a0.a0[86]; |
| result += a0.a0[87]; |
| result += a0.a0[88]; |
| result += a0.a0[89]; |
| result += a0.a0[90]; |
| result += a0.a0[91]; |
| result += a0.a0[92]; |
| result += a0.a0[93]; |
| result += a0.a0[94]; |
| result += a0.a0[95]; |
| result += a0.a0[96]; |
| result += a0.a0[97]; |
| result += a0.a0[98]; |
| result += a0.a0[99]; |
| |
| print("result = $result"); |
| PassStructInlineArray100BytesResult.complete(result); |
| } |
| |
| Future<void> passStructInlineArray100BytesAfterCallback() async { |
| final result = await PassStructInlineArray100BytesResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(5050, result); |
| } |
| |
| typedef PassStructStruct16BytesHomogeneousFloat2x5Type = Void Function( |
| StructStruct16BytesHomogeneousFloat2, |
| StructStruct16BytesHomogeneousFloat2, |
| StructStruct16BytesHomogeneousFloat2, |
| StructStruct16BytesHomogeneousFloat2, |
| StructStruct16BytesHomogeneousFloat2); |
| |
| // Global variable that stores the result. |
| final PassStructStruct16BytesHomogeneousFloat2x5Result = Completer<double>(); |
| |
| /// Arguments in FPU registers on arm hardfp and arm64. |
| /// 5 struct arguments will exhaust available registers. |
| void passStructStruct16BytesHomogeneousFloat2x5( |
| StructStruct16BytesHomogeneousFloat2 a0, |
| StructStruct16BytesHomogeneousFloat2 a1, |
| StructStruct16BytesHomogeneousFloat2 a2, |
| StructStruct16BytesHomogeneousFloat2 a3, |
| StructStruct16BytesHomogeneousFloat2 a4) { |
| print( |
| "passStructStruct16BytesHomogeneousFloat2x5(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a1[0].a0; |
| result += a0.a1[1].a0; |
| result += a0.a2; |
| result += a1.a0.a0; |
| result += a1.a1[0].a0; |
| result += a1.a1[1].a0; |
| result += a1.a2; |
| result += a2.a0.a0; |
| result += a2.a1[0].a0; |
| result += a2.a1[1].a0; |
| result += a2.a2; |
| result += a3.a0.a0; |
| result += a3.a1[0].a0; |
| result += a3.a1[1].a0; |
| result += a3.a2; |
| result += a4.a0.a0; |
| result += a4.a1[0].a0; |
| result += a4.a1[1].a0; |
| result += a4.a2; |
| |
| print("result = $result"); |
| PassStructStruct16BytesHomogeneousFloat2x5Result.complete(result); |
| } |
| |
| Future<void> passStructStruct16BytesHomogeneousFloat2x5AfterCallback() async { |
| final result = await PassStructStruct16BytesHomogeneousFloat2x5Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStructStruct32BytesHomogeneousDouble2x5Type = Void Function( |
| StructStruct32BytesHomogeneousDouble2, |
| StructStruct32BytesHomogeneousDouble2, |
| StructStruct32BytesHomogeneousDouble2, |
| StructStruct32BytesHomogeneousDouble2, |
| StructStruct32BytesHomogeneousDouble2); |
| |
| // Global variable that stores the result. |
| final PassStructStruct32BytesHomogeneousDouble2x5Result = Completer<double>(); |
| |
| /// Arguments in FPU registers on arm64. |
| /// 5 struct arguments will exhaust available registers. |
| void passStructStruct32BytesHomogeneousDouble2x5( |
| StructStruct32BytesHomogeneousDouble2 a0, |
| StructStruct32BytesHomogeneousDouble2 a1, |
| StructStruct32BytesHomogeneousDouble2 a2, |
| StructStruct32BytesHomogeneousDouble2 a3, |
| StructStruct32BytesHomogeneousDouble2 a4) { |
| print( |
| "passStructStruct32BytesHomogeneousDouble2x5(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a1[0].a0; |
| result += a0.a1[1].a0; |
| result += a0.a2; |
| result += a1.a0.a0; |
| result += a1.a1[0].a0; |
| result += a1.a1[1].a0; |
| result += a1.a2; |
| result += a2.a0.a0; |
| result += a2.a1[0].a0; |
| result += a2.a1[1].a0; |
| result += a2.a2; |
| result += a3.a0.a0; |
| result += a3.a1[0].a0; |
| result += a3.a1[1].a0; |
| result += a3.a2; |
| result += a4.a0.a0; |
| result += a4.a1[0].a0; |
| result += a4.a1[1].a0; |
| result += a4.a2; |
| |
| print("result = $result"); |
| PassStructStruct32BytesHomogeneousDouble2x5Result.complete(result); |
| } |
| |
| Future<void> passStructStruct32BytesHomogeneousDouble2x5AfterCallback() async { |
| final result = await PassStructStruct32BytesHomogeneousDouble2x5Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStructStruct16BytesMixed3x10Type = Void Function( |
| StructStruct16BytesMixed3, |
| StructStruct16BytesMixed3, |
| StructStruct16BytesMixed3, |
| StructStruct16BytesMixed3, |
| StructStruct16BytesMixed3, |
| StructStruct16BytesMixed3, |
| StructStruct16BytesMixed3, |
| StructStruct16BytesMixed3, |
| StructStruct16BytesMixed3, |
| StructStruct16BytesMixed3); |
| |
| // Global variable that stores the result. |
| final PassStructStruct16BytesMixed3x10Result = 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 passStructStruct16BytesMixed3x10( |
| StructStruct16BytesMixed3 a0, |
| StructStruct16BytesMixed3 a1, |
| StructStruct16BytesMixed3 a2, |
| StructStruct16BytesMixed3 a3, |
| StructStruct16BytesMixed3 a4, |
| StructStruct16BytesMixed3 a5, |
| StructStruct16BytesMixed3 a6, |
| StructStruct16BytesMixed3 a7, |
| StructStruct16BytesMixed3 a8, |
| StructStruct16BytesMixed3 a9) { |
| print( |
| "passStructStruct16BytesMixed3x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a1[0].a0; |
| result += a0.a1[0].a1; |
| result += a0.a1[0].a2; |
| result += a0.a2[0]; |
| result += a0.a2[1]; |
| result += a1.a0.a0; |
| result += a1.a1[0].a0; |
| result += a1.a1[0].a1; |
| result += a1.a1[0].a2; |
| result += a1.a2[0]; |
| result += a1.a2[1]; |
| result += a2.a0.a0; |
| result += a2.a1[0].a0; |
| result += a2.a1[0].a1; |
| result += a2.a1[0].a2; |
| result += a2.a2[0]; |
| result += a2.a2[1]; |
| result += a3.a0.a0; |
| result += a3.a1[0].a0; |
| result += a3.a1[0].a1; |
| result += a3.a1[0].a2; |
| result += a3.a2[0]; |
| result += a3.a2[1]; |
| result += a4.a0.a0; |
| result += a4.a1[0].a0; |
| result += a4.a1[0].a1; |
| result += a4.a1[0].a2; |
| result += a4.a2[0]; |
| result += a4.a2[1]; |
| result += a5.a0.a0; |
| result += a5.a1[0].a0; |
| result += a5.a1[0].a1; |
| result += a5.a1[0].a2; |
| result += a5.a2[0]; |
| result += a5.a2[1]; |
| result += a6.a0.a0; |
| result += a6.a1[0].a0; |
| result += a6.a1[0].a1; |
| result += a6.a1[0].a2; |
| result += a6.a2[0]; |
| result += a6.a2[1]; |
| result += a7.a0.a0; |
| result += a7.a1[0].a0; |
| result += a7.a1[0].a1; |
| result += a7.a1[0].a2; |
| result += a7.a2[0]; |
| result += a7.a2[1]; |
| result += a8.a0.a0; |
| result += a8.a1[0].a0; |
| result += a8.a1[0].a1; |
| result += a8.a1[0].a2; |
| result += a8.a2[0]; |
| result += a8.a2[1]; |
| result += a9.a0.a0; |
| result += a9.a1[0].a0; |
| result += a9.a1[0].a1; |
| result += a9.a1[0].a2; |
| result += a9.a2[0]; |
| result += a9.a2[1]; |
| |
| print("result = $result"); |
| PassStructStruct16BytesMixed3x10Result.complete(result); |
| } |
| |
| Future<void> passStructStruct16BytesMixed3x10AfterCallback() async { |
| final result = await PassStructStruct16BytesMixed3x10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(30, result); |
| } |
| |
| typedef PassUint8Struct32BytesInlineArrayMultiDimensionalIType = Void Function( |
| Uint8, |
| Struct32BytesInlineArrayMultiDimensionalInt, |
| Uint8, |
| Struct8BytesInlineArrayMultiDimensionalInt, |
| Uint8, |
| Struct8BytesInlineArrayMultiDimensionalInt, |
| Uint8); |
| |
| // Global variable that stores the result. |
| final PassUint8Struct32BytesInlineArrayMultiDimensionalIResult = |
| Completer<double>(); |
| |
| /// Test multi dimensional inline array struct as argument. |
| void passUint8Struct32BytesInlineArrayMultiDimensionalI( |
| int a0, |
| Struct32BytesInlineArrayMultiDimensionalInt a1, |
| int a2, |
| Struct8BytesInlineArrayMultiDimensionalInt a3, |
| int a4, |
| Struct8BytesInlineArrayMultiDimensionalInt a5, |
| int a6) { |
| print( |
| "passUint8Struct32BytesInlineArrayMultiDimensionalI(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1.a0[0][0][0][0][0]; |
| result += a1.a0[0][0][0][0][1]; |
| result += a1.a0[0][0][0][1][0]; |
| result += a1.a0[0][0][0][1][1]; |
| result += a1.a0[0][0][1][0][0]; |
| result += a1.a0[0][0][1][0][1]; |
| result += a1.a0[0][0][1][1][0]; |
| result += a1.a0[0][0][1][1][1]; |
| result += a1.a0[0][1][0][0][0]; |
| result += a1.a0[0][1][0][0][1]; |
| result += a1.a0[0][1][0][1][0]; |
| result += a1.a0[0][1][0][1][1]; |
| result += a1.a0[0][1][1][0][0]; |
| result += a1.a0[0][1][1][0][1]; |
| result += a1.a0[0][1][1][1][0]; |
| result += a1.a0[0][1][1][1][1]; |
| result += a1.a0[1][0][0][0][0]; |
| result += a1.a0[1][0][0][0][1]; |
| result += a1.a0[1][0][0][1][0]; |
| result += a1.a0[1][0][0][1][1]; |
| result += a1.a0[1][0][1][0][0]; |
| result += a1.a0[1][0][1][0][1]; |
| result += a1.a0[1][0][1][1][0]; |
| result += a1.a0[1][0][1][1][1]; |
| result += a1.a0[1][1][0][0][0]; |
| result += a1.a0[1][1][0][0][1]; |
| result += a1.a0[1][1][0][1][0]; |
| result += a1.a0[1][1][0][1][1]; |
| result += a1.a0[1][1][1][0][0]; |
| result += a1.a0[1][1][1][0][1]; |
| result += a1.a0[1][1][1][1][0]; |
| result += a1.a0[1][1][1][1][1]; |
| result += a2; |
| result += a3.a0[0][0][0]; |
| result += a3.a0[0][0][1]; |
| result += a3.a0[0][1][0]; |
| result += a3.a0[0][1][1]; |
| result += a3.a0[1][0][0]; |
| result += a3.a0[1][0][1]; |
| result += a3.a0[1][1][0]; |
| result += a3.a0[1][1][1]; |
| result += a4; |
| result += a5.a0[0][0][0]; |
| result += a5.a0[0][0][1]; |
| result += a5.a0[0][1][0]; |
| result += a5.a0[0][1][1]; |
| result += a5.a0[1][0][0]; |
| result += a5.a0[1][0][1]; |
| result += a5.a0[1][1][0]; |
| result += a5.a0[1][1][1]; |
| result += a6; |
| |
| print("result = $result"); |
| PassUint8Struct32BytesInlineArrayMultiDimensionalIResult.complete(result); |
| } |
| |
| Future<void> |
| passUint8Struct32BytesInlineArrayMultiDimensionalIAfterCallback() async { |
| final result = |
| await PassUint8Struct32BytesInlineArrayMultiDimensionalIResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1378, result); |
| } |
| |
| typedef PassUint8Struct4BytesInlineArrayMultiDimensionalInType = Void Function( |
| Uint8, Struct4BytesInlineArrayMultiDimensionalInt, Uint8); |
| |
| // Global variable that stores the result. |
| final PassUint8Struct4BytesInlineArrayMultiDimensionalInResult = |
| Completer<double>(); |
| |
| /// Test struct in multi dimensional inline array. |
| void passUint8Struct4BytesInlineArrayMultiDimensionalIn( |
| int a0, Struct4BytesInlineArrayMultiDimensionalInt a1, int a2) { |
| print( |
| "passUint8Struct4BytesInlineArrayMultiDimensionalIn(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1.a0[0][0].a0; |
| result += a1.a0[0][1].a0; |
| result += a1.a0[1][0].a0; |
| result += a1.a0[1][1].a0; |
| result += a2; |
| |
| print("result = $result"); |
| PassUint8Struct4BytesInlineArrayMultiDimensionalInResult.complete(result); |
| } |
| |
| Future<void> |
| passUint8Struct4BytesInlineArrayMultiDimensionalInAfterCallback() async { |
| final result = |
| await PassUint8Struct4BytesInlineArrayMultiDimensionalInResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(5, result); |
| } |
| |
| typedef PassStruct3BytesPackedIntx10Type = Void Function( |
| Struct3BytesPackedInt, |
| Struct3BytesPackedInt, |
| Struct3BytesPackedInt, |
| Struct3BytesPackedInt, |
| Struct3BytesPackedInt, |
| Struct3BytesPackedInt, |
| Struct3BytesPackedInt, |
| Struct3BytesPackedInt, |
| Struct3BytesPackedInt, |
| Struct3BytesPackedInt); |
| |
| // Global variable that stores the result. |
| final PassStruct3BytesPackedIntx10Result = Completer<double>(); |
| |
| /// Small struct with mis-aligned member. |
| void passStruct3BytesPackedIntx10( |
| Struct3BytesPackedInt a0, |
| Struct3BytesPackedInt a1, |
| Struct3BytesPackedInt a2, |
| Struct3BytesPackedInt a3, |
| Struct3BytesPackedInt a4, |
| Struct3BytesPackedInt a5, |
| Struct3BytesPackedInt a6, |
| Struct3BytesPackedInt a7, |
| Struct3BytesPackedInt a8, |
| Struct3BytesPackedInt a9) { |
| print( |
| "passStruct3BytesPackedIntx10(${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"); |
| PassStruct3BytesPackedIntx10Result.complete(result); |
| } |
| |
| Future<void> passStruct3BytesPackedIntx10AfterCallback() async { |
| final result = await PassStruct3BytesPackedIntx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassStruct8BytesPackedIntx10Type = Void Function( |
| Struct8BytesPackedInt, |
| Struct8BytesPackedInt, |
| Struct8BytesPackedInt, |
| Struct8BytesPackedInt, |
| Struct8BytesPackedInt, |
| Struct8BytesPackedInt, |
| Struct8BytesPackedInt, |
| Struct8BytesPackedInt, |
| Struct8BytesPackedInt, |
| Struct8BytesPackedInt); |
| |
| // Global variable that stores the result. |
| final PassStruct8BytesPackedIntx10Result = Completer<double>(); |
| |
| /// Struct with mis-aligned member. |
| void passStruct8BytesPackedIntx10( |
| Struct8BytesPackedInt a0, |
| Struct8BytesPackedInt a1, |
| Struct8BytesPackedInt a2, |
| Struct8BytesPackedInt a3, |
| Struct8BytesPackedInt a4, |
| Struct8BytesPackedInt a5, |
| Struct8BytesPackedInt a6, |
| Struct8BytesPackedInt a7, |
| Struct8BytesPackedInt a8, |
| Struct8BytesPackedInt a9) { |
| print( |
| "passStruct8BytesPackedIntx10(${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"); |
| PassStruct8BytesPackedIntx10Result.complete(result); |
| } |
| |
| Future<void> passStruct8BytesPackedIntx10AfterCallback() async { |
| final result = await PassStruct8BytesPackedIntx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1275, result); |
| } |
| |
| typedef PassStruct9BytesPackedMixedx10DoubleInt32x2Type = Void Function( |
| Struct9BytesPackedMixed, |
| Struct9BytesPackedMixed, |
| Struct9BytesPackedMixed, |
| Struct9BytesPackedMixed, |
| Struct9BytesPackedMixed, |
| Struct9BytesPackedMixed, |
| Struct9BytesPackedMixed, |
| Struct9BytesPackedMixed, |
| Struct9BytesPackedMixed, |
| Struct9BytesPackedMixed, |
| Double, |
| Int32, |
| Int32); |
| |
| // Global variable that stores the result. |
| final PassStruct9BytesPackedMixedx10DoubleInt32x2Result = Completer<double>(); |
| |
| /// Struct with mis-aligned member. |
| /// Tests backfilling of CPU and FPU registers. |
| void passStruct9BytesPackedMixedx10DoubleInt32x2( |
| Struct9BytesPackedMixed a0, |
| Struct9BytesPackedMixed a1, |
| Struct9BytesPackedMixed a2, |
| Struct9BytesPackedMixed a3, |
| Struct9BytesPackedMixed a4, |
| Struct9BytesPackedMixed a5, |
| Struct9BytesPackedMixed a6, |
| Struct9BytesPackedMixed a7, |
| Struct9BytesPackedMixed a8, |
| Struct9BytesPackedMixed a9, |
| double a10, |
| int a11, |
| int a12) { |
| print( |
| "passStruct9BytesPackedMixedx10DoubleInt32x2(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9}, ${a10}, ${a11}, ${a12})"); |
| |
| 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; |
| result += a10; |
| result += a11; |
| result += a12; |
| |
| print("result = $result"); |
| PassStruct9BytesPackedMixedx10DoubleInt32x2Result.complete(result); |
| } |
| |
| Future<void> passStruct9BytesPackedMixedx10DoubleInt32x2AfterCallback() async { |
| final result = await PassStruct9BytesPackedMixedx10DoubleInt32x2Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(188, result); |
| } |
| |
| typedef PassStruct5BytesPackedMixedType = Void Function( |
| Struct5BytesPackedMixed); |
| |
| // Global variable that stores the result. |
| final PassStruct5BytesPackedMixedResult = Completer<double>(); |
| |
| /// This packed struct happens to have only aligned members. |
| void passStruct5BytesPackedMixed(Struct5BytesPackedMixed a0) { |
| print("passStruct5BytesPackedMixed(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| |
| print("result = $result"); |
| PassStruct5BytesPackedMixedResult.complete(result); |
| } |
| |
| Future<void> passStruct5BytesPackedMixedAfterCallback() async { |
| final result = await PassStruct5BytesPackedMixedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef PassStructNestedAlignmentStruct5BytesPackedMixedType = Void Function( |
| StructNestedAlignmentStruct5BytesPackedMixed); |
| |
| // Global variable that stores the result. |
| final PassStructNestedAlignmentStruct5BytesPackedMixedResult = |
| Completer<double>(); |
| |
| /// Check alignment of packed struct in non-packed struct. |
| void passStructNestedAlignmentStruct5BytesPackedMixed( |
| StructNestedAlignmentStruct5BytesPackedMixed a0) { |
| print("passStructNestedAlignmentStruct5BytesPackedMixed(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1.a0; |
| result += a0.a1.a1; |
| |
| print("result = $result"); |
| PassStructNestedAlignmentStruct5BytesPackedMixedResult.complete(result); |
| } |
| |
| Future<void> |
| passStructNestedAlignmentStruct5BytesPackedMixedAfterCallback() async { |
| final result = |
| await PassStructNestedAlignmentStruct5BytesPackedMixedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(6, result); |
| } |
| |
| typedef PassStruct6BytesInlineArrayIntType = Void Function( |
| Struct6BytesInlineArrayInt); |
| |
| // Global variable that stores the result. |
| final PassStruct6BytesInlineArrayIntResult = Completer<double>(); |
| |
| /// Check alignment of packed struct array in non-packed struct. |
| void passStruct6BytesInlineArrayInt(Struct6BytesInlineArrayInt a0) { |
| print("passStruct6BytesInlineArrayInt(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0[0].a0; |
| result += a0.a0[0].a1; |
| result += a0.a0[1].a0; |
| result += a0.a0[1].a1; |
| |
| print("result = $result"); |
| PassStruct6BytesInlineArrayIntResult.complete(result); |
| } |
| |
| Future<void> passStruct6BytesInlineArrayIntAfterCallback() async { |
| final result = await PassStruct6BytesInlineArrayIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(2, result); |
| } |
| |
| typedef PassStruct15BytesInlineArrayMixedType = Void Function( |
| Struct15BytesInlineArrayMixed); |
| |
| // Global variable that stores the result. |
| final PassStruct15BytesInlineArrayMixedResult = Completer<double>(); |
| |
| /// Check alignment of packed struct array in non-packed struct. |
| void passStruct15BytesInlineArrayMixed(Struct15BytesInlineArrayMixed a0) { |
| print("passStruct15BytesInlineArrayMixed(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0[0].a0; |
| result += a0.a0[0].a1; |
| result += a0.a0[1].a0; |
| result += a0.a0[1].a1; |
| result += a0.a0[2].a0; |
| result += a0.a0[2].a1; |
| |
| print("result = $result"); |
| PassStruct15BytesInlineArrayMixedResult.complete(result); |
| } |
| |
| Future<void> passStruct15BytesInlineArrayMixedAfterCallback() async { |
| final result = await PassStruct15BytesInlineArrayMixedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(3, result); |
| } |
| |
| typedef PassUnion4BytesMixedx10Type = Void Function( |
| Union4BytesMixed, |
| Union4BytesMixed, |
| Union4BytesMixed, |
| Union4BytesMixed, |
| Union4BytesMixed, |
| Union4BytesMixed, |
| Union4BytesMixed, |
| Union4BytesMixed, |
| Union4BytesMixed, |
| Union4BytesMixed); |
| |
| // Global variable that stores the result. |
| final PassUnion4BytesMixedx10Result = Completer<double>(); |
| |
| /// Check placement of mixed integer/float union. |
| void passUnion4BytesMixedx10( |
| Union4BytesMixed a0, |
| Union4BytesMixed a1, |
| Union4BytesMixed a2, |
| Union4BytesMixed a3, |
| Union4BytesMixed a4, |
| Union4BytesMixed a5, |
| Union4BytesMixed a6, |
| Union4BytesMixed a7, |
| Union4BytesMixed a8, |
| Union4BytesMixed a9) { |
| print( |
| "passUnion4BytesMixedx10(${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"); |
| PassUnion4BytesMixedx10Result.complete(result); |
| } |
| |
| Future<void> passUnion4BytesMixedx10AfterCallback() async { |
| final result = await PassUnion4BytesMixedx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(55, result); |
| } |
| |
| typedef PassUnion8BytesNestedFloatx10Type = Void Function( |
| Union8BytesNestedFloat, |
| Union8BytesNestedFloat, |
| Union8BytesNestedFloat, |
| Union8BytesNestedFloat, |
| Union8BytesNestedFloat, |
| Union8BytesNestedFloat, |
| Union8BytesNestedFloat, |
| Union8BytesNestedFloat, |
| Union8BytesNestedFloat, |
| Union8BytesNestedFloat); |
| |
| // Global variable that stores the result. |
| final PassUnion8BytesNestedFloatx10Result = Completer<double>(); |
| |
| /// Check placement of mixed floats union. |
| void passUnion8BytesNestedFloatx10( |
| Union8BytesNestedFloat a0, |
| Union8BytesNestedFloat a1, |
| Union8BytesNestedFloat a2, |
| Union8BytesNestedFloat a3, |
| Union8BytesNestedFloat a4, |
| Union8BytesNestedFloat a5, |
| Union8BytesNestedFloat a6, |
| Union8BytesNestedFloat a7, |
| Union8BytesNestedFloat a8, |
| Union8BytesNestedFloat a9) { |
| print( |
| "passUnion8BytesNestedFloatx10(${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"); |
| PassUnion8BytesNestedFloatx10Result.complete(result); |
| } |
| |
| Future<void> passUnion8BytesNestedFloatx10AfterCallback() async { |
| final result = await PassUnion8BytesNestedFloatx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(5, result); |
| } |
| |
| typedef PassUnion9BytesNestedIntx10Type = Void Function( |
| Union9BytesNestedInt, |
| Union9BytesNestedInt, |
| Union9BytesNestedInt, |
| Union9BytesNestedInt, |
| Union9BytesNestedInt, |
| Union9BytesNestedInt, |
| Union9BytesNestedInt, |
| Union9BytesNestedInt, |
| Union9BytesNestedInt, |
| Union9BytesNestedInt); |
| |
| // Global variable that stores the result. |
| final PassUnion9BytesNestedIntx10Result = Completer<double>(); |
| |
| /// Mixed-size union argument. |
| void passUnion9BytesNestedIntx10( |
| Union9BytesNestedInt a0, |
| Union9BytesNestedInt a1, |
| Union9BytesNestedInt a2, |
| Union9BytesNestedInt a3, |
| Union9BytesNestedInt a4, |
| Union9BytesNestedInt a5, |
| Union9BytesNestedInt a6, |
| Union9BytesNestedInt a7, |
| Union9BytesNestedInt a8, |
| Union9BytesNestedInt a9) { |
| print( |
| "passUnion9BytesNestedIntx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a0.a1; |
| result += a0.a0.a2; |
| result += a1.a0.a0; |
| result += a1.a0.a1; |
| result += a1.a0.a2; |
| result += a2.a0.a0; |
| result += a2.a0.a1; |
| result += a2.a0.a2; |
| result += a3.a0.a0; |
| result += a3.a0.a1; |
| result += a3.a0.a2; |
| result += a4.a0.a0; |
| result += a4.a0.a1; |
| result += a4.a0.a2; |
| result += a5.a0.a0; |
| result += a5.a0.a1; |
| result += a5.a0.a2; |
| result += a6.a0.a0; |
| result += a6.a0.a1; |
| result += a6.a0.a2; |
| result += a7.a0.a0; |
| result += a7.a0.a1; |
| result += a7.a0.a2; |
| result += a8.a0.a0; |
| result += a8.a0.a1; |
| result += a8.a0.a2; |
| result += a9.a0.a0; |
| result += a9.a0.a1; |
| result += a9.a0.a2; |
| |
| print("result = $result"); |
| PassUnion9BytesNestedIntx10Result.complete(result); |
| } |
| |
| Future<void> passUnion9BytesNestedIntx10AfterCallback() async { |
| final result = await PassUnion9BytesNestedIntx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(15, result); |
| } |
| |
| typedef PassUnion16BytesNestedInlineArrayFloatx10Type = Void Function( |
| Union16BytesNestedInlineArrayFloat, |
| Union16BytesNestedInlineArrayFloat, |
| Union16BytesNestedInlineArrayFloat, |
| Union16BytesNestedInlineArrayFloat, |
| Union16BytesNestedInlineArrayFloat, |
| Union16BytesNestedInlineArrayFloat, |
| Union16BytesNestedInlineArrayFloat, |
| Union16BytesNestedInlineArrayFloat, |
| Union16BytesNestedInlineArrayFloat, |
| Union16BytesNestedInlineArrayFloat); |
| |
| // Global variable that stores the result. |
| final PassUnion16BytesNestedInlineArrayFloatx10Result = Completer<double>(); |
| |
| /// Union with homogenous floats. |
| void passUnion16BytesNestedInlineArrayFloatx10( |
| Union16BytesNestedInlineArrayFloat a0, |
| Union16BytesNestedInlineArrayFloat a1, |
| Union16BytesNestedInlineArrayFloat a2, |
| Union16BytesNestedInlineArrayFloat a3, |
| Union16BytesNestedInlineArrayFloat a4, |
| Union16BytesNestedInlineArrayFloat a5, |
| Union16BytesNestedInlineArrayFloat a6, |
| Union16BytesNestedInlineArrayFloat a7, |
| Union16BytesNestedInlineArrayFloat a8, |
| Union16BytesNestedInlineArrayFloat a9) { |
| print( |
| "passUnion16BytesNestedInlineArrayFloatx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0[0]; |
| result += a0.a0[1]; |
| result += a0.a0[2]; |
| result += a0.a0[3]; |
| result += a1.a0[0]; |
| result += a1.a0[1]; |
| result += a1.a0[2]; |
| result += a1.a0[3]; |
| result += a2.a0[0]; |
| result += a2.a0[1]; |
| result += a2.a0[2]; |
| result += a2.a0[3]; |
| result += a3.a0[0]; |
| result += a3.a0[1]; |
| result += a3.a0[2]; |
| result += a3.a0[3]; |
| result += a4.a0[0]; |
| result += a4.a0[1]; |
| result += a4.a0[2]; |
| result += a4.a0[3]; |
| result += a5.a0[0]; |
| result += a5.a0[1]; |
| result += a5.a0[2]; |
| result += a5.a0[3]; |
| result += a6.a0[0]; |
| result += a6.a0[1]; |
| result += a6.a0[2]; |
| result += a6.a0[3]; |
| result += a7.a0[0]; |
| result += a7.a0[1]; |
| result += a7.a0[2]; |
| result += a7.a0[3]; |
| result += a8.a0[0]; |
| result += a8.a0[1]; |
| result += a8.a0[2]; |
| result += a8.a0[3]; |
| result += a9.a0[0]; |
| result += a9.a0[1]; |
| result += a9.a0[2]; |
| result += a9.a0[3]; |
| |
| print("result = $result"); |
| PassUnion16BytesNestedInlineArrayFloatx10Result.complete(result); |
| } |
| |
| Future<void> passUnion16BytesNestedInlineArrayFloatx10AfterCallback() async { |
| final result = await PassUnion16BytesNestedInlineArrayFloatx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(20, result); |
| } |
| |
| typedef PassUnion16BytesNestedFloatx10Type = Void Function( |
| Union16BytesNestedFloat, |
| Union16BytesNestedFloat, |
| Union16BytesNestedFloat, |
| Union16BytesNestedFloat, |
| Union16BytesNestedFloat, |
| Union16BytesNestedFloat, |
| Union16BytesNestedFloat, |
| Union16BytesNestedFloat, |
| Union16BytesNestedFloat, |
| Union16BytesNestedFloat); |
| |
| // Global variable that stores the result. |
| final PassUnion16BytesNestedFloatx10Result = Completer<double>(); |
| |
| /// Union with homogenous floats. |
| void passUnion16BytesNestedFloatx10( |
| Union16BytesNestedFloat a0, |
| Union16BytesNestedFloat a1, |
| Union16BytesNestedFloat a2, |
| Union16BytesNestedFloat a3, |
| Union16BytesNestedFloat a4, |
| Union16BytesNestedFloat a5, |
| Union16BytesNestedFloat a6, |
| Union16BytesNestedFloat a7, |
| Union16BytesNestedFloat a8, |
| Union16BytesNestedFloat a9) { |
| print( |
| "passUnion16BytesNestedFloatx10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a0.a1; |
| result += a1.a0.a0; |
| result += a1.a0.a1; |
| result += a2.a0.a0; |
| result += a2.a0.a1; |
| result += a3.a0.a0; |
| result += a3.a0.a1; |
| result += a4.a0.a0; |
| result += a4.a0.a1; |
| result += a5.a0.a0; |
| result += a5.a0.a1; |
| result += a6.a0.a0; |
| result += a6.a0.a1; |
| result += a7.a0.a0; |
| result += a7.a0.a1; |
| result += a8.a0.a0; |
| result += a8.a0.a1; |
| result += a9.a0.a0; |
| result += a9.a0.a1; |
| |
| print("result = $result"); |
| PassUnion16BytesNestedFloatx10Result.complete(result); |
| } |
| |
| Future<void> passUnion16BytesNestedFloatx10AfterCallback() async { |
| final result = await PassUnion16BytesNestedFloatx10Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(10, result); |
| } |
| |
| typedef PassUint8Boolx9Struct10BytesHomogeneousBoolBoolType = Void Function( |
| Uint8, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Struct10BytesHomogeneousBool, |
| Bool); |
| |
| // Global variable that stores the result. |
| final PassUint8Boolx9Struct10BytesHomogeneousBoolBoolResult = |
| Completer<double>(); |
| |
| /// Passing bools and a struct with bools. |
| /// Exhausts the registers to test bools and the bool struct alignment on the |
| /// stack. |
| void passUint8Boolx9Struct10BytesHomogeneousBoolBool( |
| int a0, |
| bool a1, |
| bool a2, |
| bool a3, |
| bool a4, |
| bool a5, |
| bool a6, |
| bool a7, |
| bool a8, |
| bool a9, |
| Struct10BytesHomogeneousBool a10, |
| bool a11) { |
| print( |
| "passUint8Boolx9Struct10BytesHomogeneousBoolBool(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9}, ${a10}, ${a11})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1 ? 1 : 0; |
| result += a2 ? 1 : 0; |
| result += a3 ? 1 : 0; |
| result += a4 ? 1 : 0; |
| result += a5 ? 1 : 0; |
| result += a6 ? 1 : 0; |
| result += a7 ? 1 : 0; |
| result += a8 ? 1 : 0; |
| result += a9 ? 1 : 0; |
| result += a10.a0 ? 1 : 0; |
| result += a10.a1 ? 1 : 0; |
| result += a10.a2 ? 1 : 0; |
| result += a10.a3 ? 1 : 0; |
| result += a10.a4 ? 1 : 0; |
| result += a10.a5 ? 1 : 0; |
| result += a10.a6 ? 1 : 0; |
| result += a10.a7 ? 1 : 0; |
| result += a10.a8 ? 1 : 0; |
| result += a10.a9 ? 1 : 0; |
| result += a11 ? 1 : 0; |
| |
| print("result = $result"); |
| PassUint8Boolx9Struct10BytesHomogeneousBoolBoolResult.complete(result); |
| } |
| |
| Future<void> |
| passUint8Boolx9Struct10BytesHomogeneousBoolBoolAfterCallback() async { |
| final result = |
| await PassUint8Boolx9Struct10BytesHomogeneousBoolBoolResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(11, result); |
| } |
| |
| typedef PassUint8Boolx9Struct10BytesInlineArrayBoolBoolType = Void Function( |
| Uint8, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Bool, |
| Struct10BytesInlineArrayBool, |
| Bool); |
| |
| // Global variable that stores the result. |
| final PassUint8Boolx9Struct10BytesInlineArrayBoolBoolResult = |
| Completer<double>(); |
| |
| /// Passing bools and a struct with bools. |
| /// Exhausts the registers to test bools and the bool struct alignment on the |
| /// stack. |
| void passUint8Boolx9Struct10BytesInlineArrayBoolBool( |
| int a0, |
| bool a1, |
| bool a2, |
| bool a3, |
| bool a4, |
| bool a5, |
| bool a6, |
| bool a7, |
| bool a8, |
| bool a9, |
| Struct10BytesInlineArrayBool a10, |
| bool a11) { |
| print( |
| "passUint8Boolx9Struct10BytesInlineArrayBoolBool(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9}, ${a10}, ${a11})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1 ? 1 : 0; |
| result += a2 ? 1 : 0; |
| result += a3 ? 1 : 0; |
| result += a4 ? 1 : 0; |
| result += a5 ? 1 : 0; |
| result += a6 ? 1 : 0; |
| result += a7 ? 1 : 0; |
| result += a8 ? 1 : 0; |
| result += a9 ? 1 : 0; |
| result += a10.a0[0] ? 1 : 0; |
| result += a10.a0[1] ? 1 : 0; |
| result += a10.a0[2] ? 1 : 0; |
| result += a10.a0[3] ? 1 : 0; |
| result += a10.a0[4] ? 1 : 0; |
| result += a10.a0[5] ? 1 : 0; |
| result += a10.a0[6] ? 1 : 0; |
| result += a10.a0[7] ? 1 : 0; |
| result += a10.a0[8] ? 1 : 0; |
| result += a10.a0[9] ? 1 : 0; |
| result += a11 ? 1 : 0; |
| |
| print("result = $result"); |
| PassUint8Boolx9Struct10BytesInlineArrayBoolBoolResult.complete(result); |
| } |
| |
| Future<void> |
| passUint8Boolx9Struct10BytesInlineArrayBoolBoolAfterCallback() async { |
| final result = |
| await PassUint8Boolx9Struct10BytesInlineArrayBoolBoolResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(11, result); |
| } |
| |
| typedef PassUint8Struct1ByteBoolType = Void Function(Uint8, Struct1ByteBool); |
| |
| // Global variable that stores the result. |
| final PassUint8Struct1ByteBoolResult = Completer<double>(); |
| |
| /// Returning a bool. |
| void passUint8Struct1ByteBool(int a0, Struct1ByteBool a1) { |
| print("passUint8Struct1ByteBool(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1.a0 ? 1 : 0; |
| |
| print("result = $result"); |
| PassUint8Struct1ByteBoolResult.complete(result); |
| } |
| |
| Future<void> passUint8Struct1ByteBoolAfterCallback() async { |
| final result = await PassUint8Struct1ByteBoolResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef PassWCharStructInlineArrayIntUintPtrx2LongUnsignedType = Void Function( |
| WChar, StructInlineArrayInt, UintPtr, UintPtr, Long, UnsignedLong); |
| |
| // Global variable that stores the result. |
| final PassWCharStructInlineArrayIntUintPtrx2LongUnsignedResult = |
| Completer<double>(); |
| |
| /// Returning a wchar. |
| void passWCharStructInlineArrayIntUintPtrx2LongUnsigned( |
| int a0, StructInlineArrayInt a1, int a2, int a3, int a4, int a5) { |
| print( |
| "passWCharStructInlineArrayIntUintPtrx2LongUnsigned(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1.a0[0]; |
| result += a1.a0[1]; |
| result += a1.a0[2]; |
| result += a1.a0[3]; |
| result += a1.a0[4]; |
| result += a1.a0[5]; |
| result += a1.a0[6]; |
| result += a1.a0[7]; |
| result += a1.a0[8]; |
| result += a1.a0[9]; |
| result += a2; |
| result += a3; |
| result += a4; |
| result += a5; |
| |
| print("result = $result"); |
| PassWCharStructInlineArrayIntUintPtrx2LongUnsignedResult.complete(result); |
| } |
| |
| Future<void> |
| passWCharStructInlineArrayIntUintPtrx2LongUnsignedAfterCallback() async { |
| final result = |
| await PassWCharStructInlineArrayIntUintPtrx2LongUnsignedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(120, result); |
| } |
| |
| typedef PassInt64x7Struct12BytesHomogeneousInt32Type = Void Function(Int64, |
| Int64, Int64, Int64, Int64, Int64, Int64, Struct12BytesHomogeneousInt32); |
| |
| // Global variable that stores the result. |
| final PassInt64x7Struct12BytesHomogeneousInt32Result = Completer<double>(); |
| |
| /// Struct stradles last argument register |
| void passInt64x7Struct12BytesHomogeneousInt32(int a0, int a1, int a2, int a3, |
| int a4, int a5, int a6, Struct12BytesHomogeneousInt32 a7) { |
| print( |
| "passInt64x7Struct12BytesHomogeneousInt32(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| result += a5; |
| result += a6; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| |
| print("result = $result"); |
| PassInt64x7Struct12BytesHomogeneousInt32Result.complete(result); |
| } |
| |
| Future<void> passInt64x7Struct12BytesHomogeneousInt32AfterCallback() async { |
| final result = await PassInt64x7Struct12BytesHomogeneousInt32Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(5, result); |
| } |
| |
| typedef ReturnStruct1ByteIntType = Void Function(Int8); |
| |
| // Global variable that stores the result. |
| final ReturnStruct1ByteIntResult = Completer<double>(); |
| |
| /// Smallest struct with data. |
| void returnStruct1ByteInt(int a0) { |
| print("returnStruct1ByteInt(${a0})"); |
| |
| double result = 0; |
| |
| result += a0; |
| |
| print("result = $result"); |
| ReturnStruct1ByteIntResult.complete(result); |
| } |
| |
| Future<void> returnStruct1ByteIntAfterCallback() async { |
| final result = await ReturnStruct1ByteIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-1, result); |
| } |
| |
| typedef ReturnStruct3BytesHomogeneousUint8Type = Void Function( |
| Uint8, Uint8, Uint8); |
| |
| // Global variable that stores the result. |
| final ReturnStruct3BytesHomogeneousUint8Result = Completer<double>(); |
| |
| /// Smaller than word size return value on all architectures. |
| void returnStruct3BytesHomogeneousUint8(int a0, int a1, int a2) { |
| print("returnStruct3BytesHomogeneousUint8(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| |
| print("result = $result"); |
| ReturnStruct3BytesHomogeneousUint8Result.complete(result); |
| } |
| |
| Future<void> returnStruct3BytesHomogeneousUint8AfterCallback() async { |
| final result = await ReturnStruct3BytesHomogeneousUint8Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(6, result); |
| } |
| |
| typedef ReturnStruct3BytesInt2ByteAlignedType = Void Function(Int16, Int8); |
| |
| // Global variable that stores the result. |
| final ReturnStruct3BytesInt2ByteAlignedResult = Completer<double>(); |
| |
| /// Smaller than word size return value on all architectures. |
| /// With alignment rules taken into account size is 4 bytes. |
| void returnStruct3BytesInt2ByteAligned(int a0, int a1) { |
| print("returnStruct3BytesInt2ByteAligned(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| |
| print("result = $result"); |
| ReturnStruct3BytesInt2ByteAlignedResult.complete(result); |
| } |
| |
| Future<void> returnStruct3BytesInt2ByteAlignedAfterCallback() async { |
| final result = await ReturnStruct3BytesInt2ByteAlignedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnStruct4BytesHomogeneousInt16Type = Void Function(Int16, Int16); |
| |
| // Global variable that stores the result. |
| final ReturnStruct4BytesHomogeneousInt16Result = Completer<double>(); |
| |
| /// Word size return value on 32 bit architectures.. |
| void returnStruct4BytesHomogeneousInt16(int a0, int a1) { |
| print("returnStruct4BytesHomogeneousInt16(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| |
| print("result = $result"); |
| ReturnStruct4BytesHomogeneousInt16Result.complete(result); |
| } |
| |
| Future<void> returnStruct4BytesHomogeneousInt16AfterCallback() async { |
| final result = await ReturnStruct4BytesHomogeneousInt16Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnStruct7BytesHomogeneousUint8Type = Void Function( |
| Uint8, Uint8, Uint8, Uint8, Uint8, Uint8, Uint8); |
| |
| // Global variable that stores the result. |
| final ReturnStruct7BytesHomogeneousUint8Result = Completer<double>(); |
| |
| /// Non-wordsize return value. |
| void returnStruct7BytesHomogeneousUint8( |
| int a0, int a1, int a2, int a3, int a4, int a5, int a6) { |
| print( |
| "returnStruct7BytesHomogeneousUint8(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| result += a5; |
| result += a6; |
| |
| print("result = $result"); |
| ReturnStruct7BytesHomogeneousUint8Result.complete(result); |
| } |
| |
| Future<void> returnStruct7BytesHomogeneousUint8AfterCallback() async { |
| final result = await ReturnStruct7BytesHomogeneousUint8Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(28, result); |
| } |
| |
| typedef ReturnStruct7BytesInt4ByteAlignedType = Void Function( |
| Int32, Int16, Int8); |
| |
| // Global variable that stores the result. |
| final ReturnStruct7BytesInt4ByteAlignedResult = Completer<double>(); |
| |
| /// Non-wordsize return value. |
| /// With alignment rules taken into account size is 8 bytes. |
| void returnStruct7BytesInt4ByteAligned(int a0, int a1, int a2) { |
| print("returnStruct7BytesInt4ByteAligned(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| |
| print("result = $result"); |
| ReturnStruct7BytesInt4ByteAlignedResult.complete(result); |
| } |
| |
| Future<void> returnStruct7BytesInt4ByteAlignedAfterCallback() async { |
| final result = await ReturnStruct7BytesInt4ByteAlignedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef ReturnStruct8BytesIntType = Void Function(Int16, Int16, Int32); |
| |
| // Global variable that stores the result. |
| final ReturnStruct8BytesIntResult = Completer<double>(); |
| |
| /// Return value in integer registers on many architectures. |
| void returnStruct8BytesInt(int a0, int a1, int a2) { |
| print("returnStruct8BytesInt(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| |
| print("result = $result"); |
| ReturnStruct8BytesIntResult.complete(result); |
| } |
| |
| Future<void> returnStruct8BytesIntAfterCallback() async { |
| final result = await ReturnStruct8BytesIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef ReturnStruct8BytesHomogeneousFloatType = Void Function(Float, Float); |
| |
| // Global variable that stores the result. |
| final ReturnStruct8BytesHomogeneousFloatResult = Completer<double>(); |
| |
| /// Return value in FP registers on many architectures. |
| void returnStruct8BytesHomogeneousFloat(double a0, double a1) { |
| print("returnStruct8BytesHomogeneousFloat(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| |
| print("result = $result"); |
| ReturnStruct8BytesHomogeneousFloatResult.complete(result); |
| } |
| |
| Future<void> returnStruct8BytesHomogeneousFloatAfterCallback() async { |
| final result = await ReturnStruct8BytesHomogeneousFloatResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnStruct8BytesMixedType = Void Function(Float, Int16, Int16); |
| |
| // Global variable that stores the result. |
| final ReturnStruct8BytesMixedResult = Completer<double>(); |
| |
| /// Return value split over FP and integer register in x64. |
| void returnStruct8BytesMixed(double a0, int a1, int a2) { |
| print("returnStruct8BytesMixed(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| |
| print("result = $result"); |
| ReturnStruct8BytesMixedResult.complete(result); |
| } |
| |
| Future<void> returnStruct8BytesMixedAfterCallback() async { |
| final result = await ReturnStruct8BytesMixedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef ReturnStruct9BytesHomogeneousUint8Type = Void Function( |
| Uint8, Uint8, Uint8, Uint8, Uint8, Uint8, Uint8, Uint8, Uint8); |
| |
| // Global variable that stores the result. |
| final ReturnStruct9BytesHomogeneousUint8Result = Completer<double>(); |
| |
| /// The minimum alignment of this struct is only 1 byte based on its fields. |
| /// Test that the memory backing these structs is the right size and that |
| /// dart:ffi trampolines do not write outside this size. |
| void returnStruct9BytesHomogeneousUint8( |
| int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { |
| print( |
| "returnStruct9BytesHomogeneousUint8(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| result += a5; |
| result += a6; |
| result += a7; |
| result += a8; |
| |
| print("result = $result"); |
| ReturnStruct9BytesHomogeneousUint8Result.complete(result); |
| } |
| |
| Future<void> returnStruct9BytesHomogeneousUint8AfterCallback() async { |
| final result = await ReturnStruct9BytesHomogeneousUint8Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(45, result); |
| } |
| |
| typedef ReturnStruct9BytesInt4Or8ByteAlignedType = Void Function(Int64, Int8); |
| |
| // Global variable that stores the result. |
| final ReturnStruct9BytesInt4Or8ByteAlignedResult = Completer<double>(); |
| |
| /// Return value in two integer registers on x64. |
| /// With alignment rules taken into account size is 12 or 16 bytes. |
| void returnStruct9BytesInt4Or8ByteAligned(int a0, int a1) { |
| print("returnStruct9BytesInt4Or8ByteAligned(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| |
| print("result = $result"); |
| ReturnStruct9BytesInt4Or8ByteAlignedResult.complete(result); |
| } |
| |
| Future<void> returnStruct9BytesInt4Or8ByteAlignedAfterCallback() async { |
| final result = await ReturnStruct9BytesInt4Or8ByteAlignedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnStruct12BytesHomogeneousFloatType = Void Function( |
| Float, Float, Float); |
| |
| // Global variable that stores the result. |
| final ReturnStruct12BytesHomogeneousFloatResult = Completer<double>(); |
| |
| /// Return value in FPU registers, but does not use all registers on arm hardfp |
| /// and arm64. |
| void returnStruct12BytesHomogeneousFloat(double a0, double a1, double a2) { |
| print("returnStruct12BytesHomogeneousFloat(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| |
| print("result = $result"); |
| ReturnStruct12BytesHomogeneousFloatResult.complete(result); |
| } |
| |
| Future<void> returnStruct12BytesHomogeneousFloatAfterCallback() async { |
| final result = await ReturnStruct12BytesHomogeneousFloatResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef ReturnStruct16BytesHomogeneousFloatType = Void Function( |
| Float, Float, Float, Float); |
| |
| // Global variable that stores the result. |
| final ReturnStruct16BytesHomogeneousFloatResult = Completer<double>(); |
| |
| /// Return value in FPU registers on arm hardfp and arm64. |
| void returnStruct16BytesHomogeneousFloat( |
| double a0, double a1, double a2, double a3) { |
| print("returnStruct16BytesHomogeneousFloat(${a0}, ${a1}, ${a2}, ${a3})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| |
| print("result = $result"); |
| ReturnStruct16BytesHomogeneousFloatResult.complete(result); |
| } |
| |
| Future<void> returnStruct16BytesHomogeneousFloatAfterCallback() async { |
| final result = await ReturnStruct16BytesHomogeneousFloatResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(2, result); |
| } |
| |
| typedef ReturnStruct16BytesMixedType = Void Function(Double, Int64); |
| |
| // Global variable that stores the result. |
| final ReturnStruct16BytesMixedResult = Completer<double>(); |
| |
| /// Return value split over FP and integer register in x64. |
| void returnStruct16BytesMixed(double a0, int a1) { |
| print("returnStruct16BytesMixed(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| |
| print("result = $result"); |
| ReturnStruct16BytesMixedResult.complete(result); |
| } |
| |
| Future<void> returnStruct16BytesMixedAfterCallback() async { |
| final result = await ReturnStruct16BytesMixedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnStruct16BytesMixed2Type = Void Function( |
| Float, Float, Float, Int32); |
| |
| // Global variable that stores the result. |
| final ReturnStruct16BytesMixed2Result = Completer<double>(); |
| |
| /// Return value split over FP and integer register in x64. |
| /// The integer register contains half float half int. |
| void returnStruct16BytesMixed2(double a0, double a1, double a2, int a3) { |
| print("returnStruct16BytesMixed2(${a0}, ${a1}, ${a2}, ${a3})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| |
| print("result = $result"); |
| ReturnStruct16BytesMixed2Result.complete(result); |
| } |
| |
| Future<void> returnStruct16BytesMixed2AfterCallback() async { |
| final result = await ReturnStruct16BytesMixed2Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(2, result); |
| } |
| |
| typedef ReturnStruct17BytesIntType = Void Function(Int64, Int64, Int8); |
| |
| // Global variable that stores the result. |
| final ReturnStruct17BytesIntResult = Completer<double>(); |
| |
| /// Return value returned in preallocated space passed by pointer on most ABIs. |
| /// Is non word size on purpose, to test that structs are rounded up to word size |
| /// on all ABIs. |
| void returnStruct17BytesInt(int a0, int a1, int a2) { |
| print("returnStruct17BytesInt(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| |
| print("result = $result"); |
| ReturnStruct17BytesIntResult.complete(result); |
| } |
| |
| Future<void> returnStruct17BytesIntAfterCallback() async { |
| final result = await ReturnStruct17BytesIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef ReturnStruct19BytesHomogeneousUint8Type = Void Function( |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8, |
| Uint8); |
| |
| // Global variable that stores the result. |
| final ReturnStruct19BytesHomogeneousUint8Result = Completer<double>(); |
| |
| /// The minimum alignment of this struct is only 1 byte based on its fields. |
| /// Test that the memory backing these structs is the right size and that |
| /// dart:ffi trampolines do not write outside this size. |
| void returnStruct19BytesHomogeneousUint8( |
| int a0, |
| int a1, |
| int a2, |
| int a3, |
| int a4, |
| int a5, |
| int a6, |
| int a7, |
| int a8, |
| int a9, |
| int a10, |
| int a11, |
| int a12, |
| int a13, |
| int a14, |
| int a15, |
| int a16, |
| int a17, |
| int a18) { |
| print( |
| "returnStruct19BytesHomogeneousUint8(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9}, ${a10}, ${a11}, ${a12}, ${a13}, ${a14}, ${a15}, ${a16}, ${a17}, ${a18})"); |
| |
| 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; |
| |
| print("result = $result"); |
| ReturnStruct19BytesHomogeneousUint8Result.complete(result); |
| } |
| |
| Future<void> returnStruct19BytesHomogeneousUint8AfterCallback() async { |
| final result = await ReturnStruct19BytesHomogeneousUint8Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(190, result); |
| } |
| |
| typedef ReturnStruct20BytesHomogeneousInt32Type = Void Function( |
| Int32, Int32, Int32, Int32, Int32); |
| |
| // Global variable that stores the result. |
| final ReturnStruct20BytesHomogeneousInt32Result = Completer<double>(); |
| |
| /// Return value too big to go in cpu registers on arm64. |
| void returnStruct20BytesHomogeneousInt32( |
| int a0, int a1, int a2, int a3, int a4) { |
| print( |
| "returnStruct20BytesHomogeneousInt32(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| |
| print("result = $result"); |
| ReturnStruct20BytesHomogeneousInt32Result.complete(result); |
| } |
| |
| Future<void> returnStruct20BytesHomogeneousInt32AfterCallback() async { |
| final result = await ReturnStruct20BytesHomogeneousInt32Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-3, result); |
| } |
| |
| typedef ReturnStruct20BytesHomogeneousFloatType = Void Function( |
| Float, Float, Float, Float, Float); |
| |
| // Global variable that stores the result. |
| final ReturnStruct20BytesHomogeneousFloatResult = Completer<double>(); |
| |
| /// Return value too big to go in FPU registers on x64, arm hardfp and arm64. |
| void returnStruct20BytesHomogeneousFloat( |
| double a0, double a1, double a2, double a3, double a4) { |
| print( |
| "returnStruct20BytesHomogeneousFloat(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| |
| print("result = $result"); |
| ReturnStruct20BytesHomogeneousFloatResult.complete(result); |
| } |
| |
| Future<void> returnStruct20BytesHomogeneousFloatAfterCallback() async { |
| final result = await ReturnStruct20BytesHomogeneousFloatResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-3, result); |
| } |
| |
| typedef ReturnStruct32BytesHomogeneousDoubleType = Void Function( |
| Double, Double, Double, Double); |
| |
| // Global variable that stores the result. |
| final ReturnStruct32BytesHomogeneousDoubleResult = Completer<double>(); |
| |
| /// Return value in FPU registers on arm64. |
| void returnStruct32BytesHomogeneousDouble( |
| double a0, double a1, double a2, double a3) { |
| print("returnStruct32BytesHomogeneousDouble(${a0}, ${a1}, ${a2}, ${a3})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| |
| print("result = $result"); |
| ReturnStruct32BytesHomogeneousDoubleResult.complete(result); |
| } |
| |
| Future<void> returnStruct32BytesHomogeneousDoubleAfterCallback() async { |
| final result = await ReturnStruct32BytesHomogeneousDoubleResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(2, result); |
| } |
| |
| typedef ReturnStruct40BytesHomogeneousDoubleType = Void Function( |
| Double, Double, Double, Double, Double); |
| |
| // Global variable that stores the result. |
| final ReturnStruct40BytesHomogeneousDoubleResult = Completer<double>(); |
| |
| /// Return value too big to go in FPU registers on arm64. |
| void returnStruct40BytesHomogeneousDouble( |
| double a0, double a1, double a2, double a3, double a4) { |
| print( |
| "returnStruct40BytesHomogeneousDouble(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| |
| print("result = $result"); |
| ReturnStruct40BytesHomogeneousDoubleResult.complete(result); |
| } |
| |
| Future<void> returnStruct40BytesHomogeneousDoubleAfterCallback() async { |
| final result = await ReturnStruct40BytesHomogeneousDoubleResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-3, result); |
| } |
| |
| typedef ReturnStruct1024BytesHomogeneousUint64Type = Void Function( |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64, |
| Uint64); |
| |
| // Global variable that stores the result. |
| final ReturnStruct1024BytesHomogeneousUint64Result = Completer<double>(); |
| |
| /// Test 1kb struct. |
| void returnStruct1024BytesHomogeneousUint64( |
| int a0, |
| int a1, |
| int a2, |
| int a3, |
| int a4, |
| int a5, |
| int a6, |
| int a7, |
| int a8, |
| int a9, |
| int a10, |
| int a11, |
| int a12, |
| int a13, |
| int a14, |
| int a15, |
| int a16, |
| int a17, |
| int a18, |
| int a19, |
| int a20, |
| int a21, |
| int a22, |
| int a23, |
| int a24, |
| int a25, |
| int a26, |
| int a27, |
| int a28, |
| int a29, |
| int a30, |
| int a31, |
| int a32, |
| int a33, |
| int a34, |
| int a35, |
| int a36, |
| int a37, |
| int a38, |
| int a39, |
| int a40, |
| int a41, |
| int a42, |
| int a43, |
| int a44, |
| int a45, |
| int a46, |
| int a47, |
| int a48, |
| int a49, |
| int a50, |
| int a51, |
| int a52, |
| int a53, |
| int a54, |
| int a55, |
| int a56, |
| int a57, |
| int a58, |
| int a59, |
| int a60, |
| int a61, |
| int a62, |
| int a63, |
| int a64, |
| int a65, |
| int a66, |
| int a67, |
| int a68, |
| int a69, |
| int a70, |
| int a71, |
| int a72, |
| int a73, |
| int a74, |
| int a75, |
| int a76, |
| int a77, |
| int a78, |
| int a79, |
| int a80, |
| int a81, |
| int a82, |
| int a83, |
| int a84, |
| int a85, |
| int a86, |
| int a87, |
| int a88, |
| int a89, |
| int a90, |
| int a91, |
| int a92, |
| int a93, |
| int a94, |
| int a95, |
| int a96, |
| int a97, |
| int a98, |
| int a99, |
| int a100, |
| int a101, |
| int a102, |
| int a103, |
| int a104, |
| int a105, |
| int a106, |
| int a107, |
| int a108, |
| int a109, |
| int a110, |
| int a111, |
| int a112, |
| int a113, |
| int a114, |
| int a115, |
| int a116, |
| int a117, |
| int a118, |
| int a119, |
| int a120, |
| int a121, |
| int a122, |
| int a123, |
| int a124, |
| int a125, |
| int a126, |
| int a127) { |
| print( |
| "returnStruct1024BytesHomogeneousUint64(${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}, ${a40}, ${a41}, ${a42}, ${a43}, ${a44}, ${a45}, ${a46}, ${a47}, ${a48}, ${a49}, ${a50}, ${a51}, ${a52}, ${a53}, ${a54}, ${a55}, ${a56}, ${a57}, ${a58}, ${a59}, ${a60}, ${a61}, ${a62}, ${a63}, ${a64}, ${a65}, ${a66}, ${a67}, ${a68}, ${a69}, ${a70}, ${a71}, ${a72}, ${a73}, ${a74}, ${a75}, ${a76}, ${a77}, ${a78}, ${a79}, ${a80}, ${a81}, ${a82}, ${a83}, ${a84}, ${a85}, ${a86}, ${a87}, ${a88}, ${a89}, ${a90}, ${a91}, ${a92}, ${a93}, ${a94}, ${a95}, ${a96}, ${a97}, ${a98}, ${a99}, ${a100}, ${a101}, ${a102}, ${a103}, ${a104}, ${a105}, ${a106}, ${a107}, ${a108}, ${a109}, ${a110}, ${a111}, ${a112}, ${a113}, ${a114}, ${a115}, ${a116}, ${a117}, ${a118}, ${a119}, ${a120}, ${a121}, ${a122}, ${a123}, ${a124}, ${a125}, ${a126}, ${a127})"); |
| |
| 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; |
| result += a19; |
| result += a20; |
| result += a21; |
| result += a22; |
| result += a23; |
| result += a24; |
| result += a25; |
| result += a26; |
| result += a27; |
| result += a28; |
| result += a29; |
| result += a30; |
| result += a31; |
| result += a32; |
| result += a33; |
| result += a34; |
| result += a35; |
| result += a36; |
| result += a37; |
| result += a38; |
| result += a39; |
| result += a40; |
| result += a41; |
| result += a42; |
| result += a43; |
| result += a44; |
| result += a45; |
| result += a46; |
| result += a47; |
| result += a48; |
| result += a49; |
| result += a50; |
| result += a51; |
| result += a52; |
| result += a53; |
| result += a54; |
| result += a55; |
| result += a56; |
| result += a57; |
| result += a58; |
| result += a59; |
| result += a60; |
| result += a61; |
| result += a62; |
| result += a63; |
| result += a64; |
| result += a65; |
| result += a66; |
| result += a67; |
| result += a68; |
| result += a69; |
| result += a70; |
| result += a71; |
| result += a72; |
| result += a73; |
| result += a74; |
| result += a75; |
| result += a76; |
| result += a77; |
| result += a78; |
| result += a79; |
| result += a80; |
| result += a81; |
| result += a82; |
| result += a83; |
| result += a84; |
| result += a85; |
| result += a86; |
| result += a87; |
| result += a88; |
| result += a89; |
| result += a90; |
| result += a91; |
| result += a92; |
| result += a93; |
| result += a94; |
| result += a95; |
| result += a96; |
| result += a97; |
| result += a98; |
| result += a99; |
| result += a100; |
| result += a101; |
| result += a102; |
| result += a103; |
| result += a104; |
| result += a105; |
| result += a106; |
| result += a107; |
| result += a108; |
| result += a109; |
| result += a110; |
| result += a111; |
| result += a112; |
| result += a113; |
| result += a114; |
| result += a115; |
| result += a116; |
| result += a117; |
| result += a118; |
| result += a119; |
| result += a120; |
| result += a121; |
| result += a122; |
| result += a123; |
| result += a124; |
| result += a125; |
| result += a126; |
| result += a127; |
| |
| print("result = $result"); |
| ReturnStruct1024BytesHomogeneousUint64Result.complete(result); |
| } |
| |
| Future<void> returnStruct1024BytesHomogeneousUint64AfterCallback() async { |
| final result = await ReturnStruct1024BytesHomogeneousUint64Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(8256, result); |
| } |
| |
| typedef ReturnStruct3BytesPackedIntType = Void Function(Int8, Int16); |
| |
| // Global variable that stores the result. |
| final ReturnStruct3BytesPackedIntResult = Completer<double>(); |
| |
| /// Small struct with mis-aligned member. |
| void returnStruct3BytesPackedInt(int a0, int a1) { |
| print("returnStruct3BytesPackedInt(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| |
| print("result = $result"); |
| ReturnStruct3BytesPackedIntResult.complete(result); |
| } |
| |
| Future<void> returnStruct3BytesPackedIntAfterCallback() async { |
| final result = await ReturnStruct3BytesPackedIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnStruct8BytesPackedIntType = Void Function( |
| Uint8, Uint32, Uint8, Uint8, Uint8); |
| |
| // Global variable that stores the result. |
| final ReturnStruct8BytesPackedIntResult = Completer<double>(); |
| |
| /// Struct with mis-aligned member. |
| void returnStruct8BytesPackedInt(int a0, int a1, int a2, int a3, int a4) { |
| print("returnStruct8BytesPackedInt(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| |
| print("result = $result"); |
| ReturnStruct8BytesPackedIntResult.complete(result); |
| } |
| |
| Future<void> returnStruct8BytesPackedIntAfterCallback() async { |
| final result = await ReturnStruct8BytesPackedIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(15, result); |
| } |
| |
| typedef ReturnStruct9BytesPackedMixedType = Void Function(Uint8, Double); |
| |
| // Global variable that stores the result. |
| final ReturnStruct9BytesPackedMixedResult = Completer<double>(); |
| |
| /// Struct with mis-aligned member. |
| /// Tests backfilling of CPU and FPU registers. |
| void returnStruct9BytesPackedMixed(int a0, double a1) { |
| print("returnStruct9BytesPackedMixed(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| |
| print("result = $result"); |
| ReturnStruct9BytesPackedMixedResult.complete(result); |
| } |
| |
| Future<void> returnStruct9BytesPackedMixedAfterCallback() async { |
| final result = await ReturnStruct9BytesPackedMixedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(3, result); |
| } |
| |
| typedef ReturnUnion4BytesMixedType = Void Function(Uint32); |
| |
| // Global variable that stores the result. |
| final ReturnUnion4BytesMixedResult = Completer<double>(); |
| |
| /// Returning a mixed integer/float union. |
| void returnUnion4BytesMixed(int a0) { |
| print("returnUnion4BytesMixed(${a0})"); |
| |
| double result = 0; |
| |
| result += a0; |
| |
| print("result = $result"); |
| ReturnUnion4BytesMixedResult.complete(result); |
| } |
| |
| Future<void> returnUnion4BytesMixedAfterCallback() async { |
| final result = await ReturnUnion4BytesMixedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnUnion8BytesNestedFloatType = Void Function(Double); |
| |
| // Global variable that stores the result. |
| final ReturnUnion8BytesNestedFloatResult = Completer<double>(); |
| |
| /// Returning a floating point only union. |
| void returnUnion8BytesNestedFloat(double a0) { |
| print("returnUnion8BytesNestedFloat(${a0})"); |
| |
| double result = 0; |
| |
| result += a0; |
| |
| print("result = $result"); |
| ReturnUnion8BytesNestedFloatResult.complete(result); |
| } |
| |
| Future<void> returnUnion8BytesNestedFloatAfterCallback() async { |
| final result = await ReturnUnion8BytesNestedFloatResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-1, result); |
| } |
| |
| typedef ReturnUnion9BytesNestedIntType = Void Function(Struct8BytesInt); |
| |
| // Global variable that stores the result. |
| final ReturnUnion9BytesNestedIntResult = Completer<double>(); |
| |
| /// Returning a mixed-size union. |
| void returnUnion9BytesNestedInt(Struct8BytesInt a0) { |
| print("returnUnion9BytesNestedInt(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| |
| print("result = $result"); |
| ReturnUnion9BytesNestedIntResult.complete(result); |
| } |
| |
| Future<void> returnUnion9BytesNestedIntAfterCallback() async { |
| final result = await ReturnUnion9BytesNestedIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef ReturnUnion16BytesNestedFloatType = Void Function( |
| Struct8BytesHomogeneousFloat); |
| |
| // Global variable that stores the result. |
| final ReturnUnion16BytesNestedFloatResult = Completer<double>(); |
| |
| /// Returning union with homogenous floats. |
| void returnUnion16BytesNestedFloat(Struct8BytesHomogeneousFloat a0) { |
| print("returnUnion16BytesNestedFloat(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| |
| print("result = $result"); |
| ReturnUnion16BytesNestedFloatResult.complete(result); |
| } |
| |
| Future<void> returnUnion16BytesNestedFloatAfterCallback() async { |
| final result = await ReturnUnion16BytesNestedFloatResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnStructArgumentStruct1ByteIntType = Void Function(Struct1ByteInt); |
| |
| // Global variable that stores the result. |
| final ReturnStructArgumentStruct1ByteIntResult = Completer<double>(); |
| |
| /// Test that a struct passed in as argument can be returned. |
| /// Especially for ffi callbacks. |
| /// Struct is passed in int registers in most ABIs. |
| void returnStructArgumentStruct1ByteInt(Struct1ByteInt a0) { |
| print("returnStructArgumentStruct1ByteInt(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| |
| print("result = $result"); |
| ReturnStructArgumentStruct1ByteIntResult.complete(result); |
| } |
| |
| Future<void> returnStructArgumentStruct1ByteIntAfterCallback() async { |
| final result = await ReturnStructArgumentStruct1ByteIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-1, result); |
| } |
| |
| typedef ReturnStructArgumentInt32x8Struct1ByteIntType = Void Function( |
| Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Struct1ByteInt); |
| |
| // Global variable that stores the result. |
| final ReturnStructArgumentInt32x8Struct1ByteIntResult = Completer<double>(); |
| |
| /// Test that a struct passed in as argument can be returned. |
| /// Especially for ffi callbacks. |
| /// Struct is passed on stack on all ABIs. |
| void returnStructArgumentInt32x8Struct1ByteInt(int a0, int a1, int a2, int a3, |
| int a4, int a5, int a6, int a7, Struct1ByteInt a8) { |
| print( |
| "returnStructArgumentInt32x8Struct1ByteInt(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| result += a5; |
| result += a6; |
| result += a7; |
| result += a8.a0; |
| |
| print("result = $result"); |
| ReturnStructArgumentInt32x8Struct1ByteIntResult.complete(result); |
| } |
| |
| Future<void> returnStructArgumentInt32x8Struct1ByteIntAfterCallback() async { |
| final result = await ReturnStructArgumentInt32x8Struct1ByteIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-5, result); |
| } |
| |
| typedef ReturnStructArgumentStruct8BytesHomogeneousFloatType = Void Function( |
| Struct8BytesHomogeneousFloat); |
| |
| // Global variable that stores the result. |
| final ReturnStructArgumentStruct8BytesHomogeneousFloatResult = |
| Completer<double>(); |
| |
| /// Test that a struct passed in as argument can be returned. |
| /// Especially for ffi callbacks. |
| /// Struct is passed in float registers in most ABIs. |
| void returnStructArgumentStruct8BytesHomogeneousFloat( |
| Struct8BytesHomogeneousFloat a0) { |
| print("returnStructArgumentStruct8BytesHomogeneousFloat(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| |
| print("result = $result"); |
| ReturnStructArgumentStruct8BytesHomogeneousFloatResult.complete(result); |
| } |
| |
| Future<void> |
| returnStructArgumentStruct8BytesHomogeneousFloatAfterCallback() async { |
| final result = |
| await ReturnStructArgumentStruct8BytesHomogeneousFloatResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnStructArgumentStruct20BytesHomogeneousInt32Type = Void Function( |
| Struct20BytesHomogeneousInt32); |
| |
| // Global variable that stores the result. |
| final ReturnStructArgumentStruct20BytesHomogeneousInt32Result = |
| Completer<double>(); |
| |
| /// On arm64, both argument and return value are passed in by pointer. |
| void returnStructArgumentStruct20BytesHomogeneousInt32( |
| Struct20BytesHomogeneousInt32 a0) { |
| print("returnStructArgumentStruct20BytesHomogeneousInt32(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| |
| print("result = $result"); |
| ReturnStructArgumentStruct20BytesHomogeneousInt32Result.complete(result); |
| } |
| |
| Future<void> |
| returnStructArgumentStruct20BytesHomogeneousInt32AfterCallback() async { |
| final result = |
| await ReturnStructArgumentStruct20BytesHomogeneousInt32Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-3, result); |
| } |
| |
| typedef ReturnStructArgumentInt32x8Struct20BytesHomogeneouType = Void Function( |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Int32, |
| Struct20BytesHomogeneousInt32); |
| |
| // Global variable that stores the result. |
| final ReturnStructArgumentInt32x8Struct20BytesHomogeneouResult = |
| Completer<double>(); |
| |
| /// On arm64, both argument and return value are passed in by pointer. |
| /// Ints exhaust registers, so that pointer is passed on stack. |
| void returnStructArgumentInt32x8Struct20BytesHomogeneou(int a0, int a1, int a2, |
| int a3, int a4, int a5, int a6, int a7, Struct20BytesHomogeneousInt32 a8) { |
| print( |
| "returnStructArgumentInt32x8Struct20BytesHomogeneou(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| result += a3; |
| result += a4; |
| result += a5; |
| result += a6; |
| result += a7; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a8.a4; |
| |
| print("result = $result"); |
| ReturnStructArgumentInt32x8Struct20BytesHomogeneouResult.complete(result); |
| } |
| |
| Future<void> |
| returnStructArgumentInt32x8Struct20BytesHomogeneouAfterCallback() async { |
| final result = |
| await ReturnStructArgumentInt32x8Struct20BytesHomogeneouResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-7, result); |
| } |
| |
| typedef ReturnStructArgumentStruct8BytesInlineArrayIntType = Void Function( |
| Struct8BytesInlineArrayInt); |
| |
| // Global variable that stores the result. |
| final ReturnStructArgumentStruct8BytesInlineArrayIntResult = |
| Completer<double>(); |
| |
| /// Test returning struct with inline array. |
| void returnStructArgumentStruct8BytesInlineArrayInt( |
| Struct8BytesInlineArrayInt a0) { |
| print("returnStructArgumentStruct8BytesInlineArrayInt(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0[0]; |
| result += a0.a0[1]; |
| result += a0.a0[2]; |
| result += a0.a0[3]; |
| result += a0.a0[4]; |
| result += a0.a0[5]; |
| result += a0.a0[6]; |
| result += a0.a0[7]; |
| |
| print("result = $result"); |
| ReturnStructArgumentStruct8BytesInlineArrayIntResult.complete(result); |
| } |
| |
| Future<void> |
| returnStructArgumentStruct8BytesInlineArrayIntAfterCallback() async { |
| final result = |
| await ReturnStructArgumentStruct8BytesInlineArrayIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(36, result); |
| } |
| |
| typedef ReturnStructArgumentStructStruct16BytesHomogeneousType = Void Function( |
| StructStruct16BytesHomogeneousFloat2); |
| |
| // Global variable that stores the result. |
| final ReturnStructArgumentStructStruct16BytesHomogeneousResult = |
| Completer<double>(); |
| |
| /// Return value in FPU registers on arm hardfp and arm64. |
| void returnStructArgumentStructStruct16BytesHomogeneous( |
| StructStruct16BytesHomogeneousFloat2 a0) { |
| print("returnStructArgumentStructStruct16BytesHomogeneous(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a1[0].a0; |
| result += a0.a1[1].a0; |
| result += a0.a2; |
| |
| print("result = $result"); |
| ReturnStructArgumentStructStruct16BytesHomogeneousResult.complete(result); |
| } |
| |
| Future<void> |
| returnStructArgumentStructStruct16BytesHomogeneousAfterCallback() async { |
| final result = |
| await ReturnStructArgumentStructStruct16BytesHomogeneousResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(2, result); |
| } |
| |
| typedef ReturnStructArgumentStructStruct32BytesHomogeneousType = Void Function( |
| StructStruct32BytesHomogeneousDouble2); |
| |
| // Global variable that stores the result. |
| final ReturnStructArgumentStructStruct32BytesHomogeneousResult = |
| Completer<double>(); |
| |
| /// Return value in FPU registers on arm64. |
| void returnStructArgumentStructStruct32BytesHomogeneous( |
| StructStruct32BytesHomogeneousDouble2 a0) { |
| print("returnStructArgumentStructStruct32BytesHomogeneous(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a1[0].a0; |
| result += a0.a1[1].a0; |
| result += a0.a2; |
| |
| print("result = $result"); |
| ReturnStructArgumentStructStruct32BytesHomogeneousResult.complete(result); |
| } |
| |
| Future<void> |
| returnStructArgumentStructStruct32BytesHomogeneousAfterCallback() async { |
| final result = |
| await ReturnStructArgumentStructStruct32BytesHomogeneousResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(2, result); |
| } |
| |
| typedef ReturnStructArgumentStructStruct16BytesMixed3Type = Void Function( |
| StructStruct16BytesMixed3); |
| |
| // Global variable that stores the result. |
| final ReturnStructArgumentStructStruct16BytesMixed3Result = Completer<double>(); |
| |
| /// On x64 Linux, return value is split over FP and int registers. |
| void returnStructArgumentStructStruct16BytesMixed3( |
| StructStruct16BytesMixed3 a0) { |
| print("returnStructArgumentStructStruct16BytesMixed3(${a0})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0; |
| result += a0.a1[0].a0; |
| result += a0.a1[0].a1; |
| result += a0.a1[0].a2; |
| result += a0.a2[0]; |
| result += a0.a2[1]; |
| |
| print("result = $result"); |
| ReturnStructArgumentStructStruct16BytesMixed3Result.complete(result); |
| } |
| |
| Future<void> |
| returnStructArgumentStructStruct16BytesMixed3AfterCallback() async { |
| final result = |
| await ReturnStructArgumentStructStruct16BytesMixed3Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(3, result); |
| } |
| |
| typedef ReturnStructAlignmentInt16Type = Void Function(Int8, Int16, Int8); |
| |
| // Global variable that stores the result. |
| final ReturnStructAlignmentInt16Result = Completer<double>(); |
| |
| /// Test alignment and padding of 16 byte int within struct. |
| void returnStructAlignmentInt16(int a0, int a1, int a2) { |
| print("returnStructAlignmentInt16(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| |
| print("result = $result"); |
| ReturnStructAlignmentInt16Result.complete(result); |
| } |
| |
| Future<void> returnStructAlignmentInt16AfterCallback() async { |
| final result = await ReturnStructAlignmentInt16Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef ReturnStructAlignmentInt32Type = Void Function(Int8, Int32, Int8); |
| |
| // Global variable that stores the result. |
| final ReturnStructAlignmentInt32Result = Completer<double>(); |
| |
| /// Test alignment and padding of 32 byte int within struct. |
| void returnStructAlignmentInt32(int a0, int a1, int a2) { |
| print("returnStructAlignmentInt32(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| |
| print("result = $result"); |
| ReturnStructAlignmentInt32Result.complete(result); |
| } |
| |
| Future<void> returnStructAlignmentInt32AfterCallback() async { |
| final result = await ReturnStructAlignmentInt32Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef ReturnStructAlignmentInt64Type = Void Function(Int8, Int64, Int8); |
| |
| // Global variable that stores the result. |
| final ReturnStructAlignmentInt64Result = Completer<double>(); |
| |
| /// Test alignment and padding of 64 byte int within struct. |
| void returnStructAlignmentInt64(int a0, int a1, int a2) { |
| print("returnStructAlignmentInt64(${a0}, ${a1}, ${a2})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1; |
| result += a2; |
| |
| print("result = $result"); |
| ReturnStructAlignmentInt64Result.complete(result); |
| } |
| |
| Future<void> returnStructAlignmentInt64AfterCallback() async { |
| final result = await ReturnStructAlignmentInt64Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef ReturnStruct8BytesNestedIntType = Void Function( |
| Struct4BytesHomogeneousInt16, Struct4BytesHomogeneousInt16); |
| |
| // Global variable that stores the result. |
| final ReturnStruct8BytesNestedIntResult = Completer<double>(); |
| |
| /// Simple nested struct. |
| void returnStruct8BytesNestedInt( |
| Struct4BytesHomogeneousInt16 a0, Struct4BytesHomogeneousInt16 a1) { |
| print("returnStruct8BytesNestedInt(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| |
| print("result = $result"); |
| ReturnStruct8BytesNestedIntResult.complete(result); |
| } |
| |
| Future<void> returnStruct8BytesNestedIntAfterCallback() async { |
| final result = await ReturnStruct8BytesNestedIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(2, result); |
| } |
| |
| typedef ReturnStruct8BytesNestedFloatType = Void Function( |
| Struct4BytesFloat, Struct4BytesFloat); |
| |
| // Global variable that stores the result. |
| final ReturnStruct8BytesNestedFloatResult = Completer<double>(); |
| |
| /// Simple nested struct with floats. |
| void returnStruct8BytesNestedFloat(Struct4BytesFloat a0, Struct4BytesFloat a1) { |
| print("returnStruct8BytesNestedFloat(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a1.a0; |
| |
| print("result = $result"); |
| ReturnStruct8BytesNestedFloatResult.complete(result); |
| } |
| |
| Future<void> returnStruct8BytesNestedFloatAfterCallback() async { |
| final result = await ReturnStruct8BytesNestedFloatResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnStruct8BytesNestedFloat2Type = Void Function( |
| Struct4BytesFloat, Float); |
| |
| // Global variable that stores the result. |
| final ReturnStruct8BytesNestedFloat2Result = Completer<double>(); |
| |
| /// The nesting is irregular, testing homogenous float rules on arm and arm64, |
| /// and the fpu register usage on x64. |
| void returnStruct8BytesNestedFloat2(Struct4BytesFloat a0, double a1) { |
| print("returnStruct8BytesNestedFloat2(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a1; |
| |
| print("result = $result"); |
| ReturnStruct8BytesNestedFloat2Result.complete(result); |
| } |
| |
| Future<void> returnStruct8BytesNestedFloat2AfterCallback() async { |
| final result = await ReturnStruct8BytesNestedFloat2Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(1, result); |
| } |
| |
| typedef ReturnStruct8BytesNestedMixedType = Void Function( |
| Struct4BytesHomogeneousInt16, Struct4BytesFloat); |
| |
| // Global variable that stores the result. |
| final ReturnStruct8BytesNestedMixedResult = Completer<double>(); |
| |
| /// Simple nested struct with mixed members. |
| void returnStruct8BytesNestedMixed( |
| Struct4BytesHomogeneousInt16 a0, Struct4BytesFloat a1) { |
| print("returnStruct8BytesNestedMixed(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| |
| print("result = $result"); |
| ReturnStruct8BytesNestedMixedResult.complete(result); |
| } |
| |
| Future<void> returnStruct8BytesNestedMixedAfterCallback() async { |
| final result = await ReturnStruct8BytesNestedMixedResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(-2, result); |
| } |
| |
| typedef ReturnStruct16BytesNestedIntType = Void Function( |
| Struct8BytesNestedInt, Struct8BytesNestedInt); |
| |
| // Global variable that stores the result. |
| final ReturnStruct16BytesNestedIntResult = Completer<double>(); |
| |
| /// Deeper nested struct to test recursive member access. |
| void returnStruct16BytesNestedInt( |
| Struct8BytesNestedInt a0, Struct8BytesNestedInt a1) { |
| print("returnStruct16BytesNestedInt(${a0}, ${a1})"); |
| |
| 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; |
| |
| print("result = $result"); |
| ReturnStruct16BytesNestedIntResult.complete(result); |
| } |
| |
| Future<void> returnStruct16BytesNestedIntAfterCallback() async { |
| final result = await ReturnStruct16BytesNestedIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(4, result); |
| } |
| |
| typedef ReturnStruct32BytesNestedIntType = Void Function( |
| Struct16BytesNestedInt, Struct16BytesNestedInt); |
| |
| // Global variable that stores the result. |
| final ReturnStruct32BytesNestedIntResult = Completer<double>(); |
| |
| /// Even deeper nested struct to test recursive member access. |
| void returnStruct32BytesNestedInt( |
| Struct16BytesNestedInt a0, Struct16BytesNestedInt a1) { |
| print("returnStruct32BytesNestedInt(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0.a0.a0.a0; |
| result += a0.a0.a0.a1; |
| result += a0.a0.a1.a0; |
| result += a0.a0.a1.a1; |
| result += a0.a1.a0.a0; |
| result += a0.a1.a0.a1; |
| result += a0.a1.a1.a0; |
| result += a0.a1.a1.a1; |
| result += a1.a0.a0.a0; |
| result += a1.a0.a0.a1; |
| result += a1.a0.a1.a0; |
| result += a1.a0.a1.a1; |
| result += a1.a1.a0.a0; |
| result += a1.a1.a0.a1; |
| result += a1.a1.a1.a0; |
| result += a1.a1.a1.a1; |
| |
| print("result = $result"); |
| ReturnStruct32BytesNestedIntResult.complete(result); |
| } |
| |
| Future<void> returnStruct32BytesNestedIntAfterCallback() async { |
| final result = await ReturnStruct32BytesNestedIntResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(8, result); |
| } |
| |
| typedef ReturnStructNestedIntStructAlignmentInt16Type = Void Function( |
| StructAlignmentInt16, StructAlignmentInt16); |
| |
| // Global variable that stores the result. |
| final ReturnStructNestedIntStructAlignmentInt16Result = Completer<double>(); |
| |
| /// Test alignment and padding of nested struct with 16 byte int. |
| void returnStructNestedIntStructAlignmentInt16( |
| StructAlignmentInt16 a0, StructAlignmentInt16 a1) { |
| print("returnStructNestedIntStructAlignmentInt16(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| |
| print("result = $result"); |
| ReturnStructNestedIntStructAlignmentInt16Result.complete(result); |
| } |
| |
| Future<void> returnStructNestedIntStructAlignmentInt16AfterCallback() async { |
| final result = await ReturnStructNestedIntStructAlignmentInt16Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(3, result); |
| } |
| |
| typedef ReturnStructNestedIntStructAlignmentInt32Type = Void Function( |
| StructAlignmentInt32, StructAlignmentInt32); |
| |
| // Global variable that stores the result. |
| final ReturnStructNestedIntStructAlignmentInt32Result = Completer<double>(); |
| |
| /// Test alignment and padding of nested struct with 32 byte int. |
| void returnStructNestedIntStructAlignmentInt32( |
| StructAlignmentInt32 a0, StructAlignmentInt32 a1) { |
| print("returnStructNestedIntStructAlignmentInt32(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| |
| print("result = $result"); |
| ReturnStructNestedIntStructAlignmentInt32Result.complete(result); |
| } |
| |
| Future<void> returnStructNestedIntStructAlignmentInt32AfterCallback() async { |
| final result = await ReturnStructNestedIntStructAlignmentInt32Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(3, result); |
| } |
| |
| typedef ReturnStructNestedIntStructAlignmentInt64Type = Void Function( |
| StructAlignmentInt64, StructAlignmentInt64); |
| |
| // Global variable that stores the result. |
| final ReturnStructNestedIntStructAlignmentInt64Result = Completer<double>(); |
| |
| /// Test alignment and padding of nested struct with 64 byte int. |
| void returnStructNestedIntStructAlignmentInt64( |
| StructAlignmentInt64 a0, StructAlignmentInt64 a1) { |
| print("returnStructNestedIntStructAlignmentInt64(${a0}, ${a1})"); |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| |
| print("result = $result"); |
| ReturnStructNestedIntStructAlignmentInt64Result.complete(result); |
| } |
| |
| Future<void> returnStructNestedIntStructAlignmentInt64AfterCallback() async { |
| final result = await ReturnStructNestedIntStructAlignmentInt64Result.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(3, result); |
| } |
| |
| typedef ReturnStructNestedIrregularEvenBiggerType = Void Function( |
| Uint64, StructNestedIrregularBigger, StructNestedIrregularBigger, Double); |
| |
| // Global variable that stores the result. |
| final ReturnStructNestedIrregularEvenBiggerResult = Completer<double>(); |
| |
| /// Return big irregular struct as smoke test. |
| void returnStructNestedIrregularEvenBigger(int a0, |
| StructNestedIrregularBigger a1, StructNestedIrregularBigger a2, double a3) { |
| print("returnStructNestedIrregularEvenBigger(${a0}, ${a1}, ${a2}, ${a3})"); |
| |
| double result = 0; |
| |
| result += a0; |
| result += a1.a0.a0; |
| result += a1.a0.a1.a0.a0; |
| result += a1.a0.a1.a0.a1; |
| result += a1.a0.a1.a1.a0; |
| result += a1.a0.a2; |
| result += a1.a0.a3.a0.a0; |
| result += a1.a0.a3.a1; |
| result += a1.a0.a4; |
| result += a1.a0.a5.a0.a0; |
| result += a1.a0.a5.a1.a0; |
| result += a1.a0.a6; |
| result += a1.a1.a0.a0; |
| result += a1.a1.a0.a1; |
| result += a1.a1.a1.a0; |
| result += a1.a2; |
| result += a1.a3; |
| result += a2.a0.a0; |
| result += a2.a0.a1.a0.a0; |
| result += a2.a0.a1.a0.a1; |
| result += a2.a0.a1.a1.a0; |
| result += a2.a0.a2; |
| result += a2.a0.a3.a0.a0; |
| result += a2.a0.a3.a1; |
| result += a2.a0.a4; |
| result += a2.a0.a5.a0.a0; |
| result += a2.a0.a5.a1.a0; |
| result += a2.a0.a6; |
| result += a2.a1.a0.a0; |
| result += a2.a1.a0.a1; |
| result += a2.a1.a1.a0; |
| result += a2.a2; |
| result += a2.a3; |
| result += a3; |
| |
| print("result = $result"); |
| ReturnStructNestedIrregularEvenBiggerResult.complete(result); |
| } |
| |
| Future<void> returnStructNestedIrregularEvenBiggerAfterCallback() async { |
| final result = await ReturnStructNestedIrregularEvenBiggerResult.future; |
| print("after callback result = $result"); |
| Expect.approxEquals(87, result); |
| } |