| // Copyright (c) 2020, 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. |
| // |
| // SharedObjects=ffi_test_functions |
| // VMOptions= |
| // VMOptions=--deterministic --optimization-counter-threshold=10 |
| // VMOptions=--use-slow-path |
| // VMOptions=--use-slow-path --stacktrace-every=100 |
| |
| import 'dart:ffi'; |
| |
| import "package:expect/expect.dart"; |
| import "package:ffi/ffi.dart"; |
| |
| import 'callback_tests_utils.dart'; |
| |
| // Reuse the struct classes. |
| import 'function_structs_by_value_generated_test.dart'; |
| |
| void main() { |
| testCases.forEach((t) { |
| print("==== Running " + t.name); |
| t.run(); |
| }); |
| } |
| |
| final testCases = [ |
| CallbackTest.withCheck( |
| "PassStruct1ByteIntx10", |
| Pointer.fromFunction<PassStruct1ByteIntx10Type>(passStruct1ByteIntx10, 0), |
| passStruct1ByteIntx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct3BytesHomogeneousUint8x10", |
| Pointer.fromFunction<PassStruct3BytesHomogeneousUint8x10Type>( |
| passStruct3BytesHomogeneousUint8x10, 0), |
| passStruct3BytesHomogeneousUint8x10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct3BytesInt2ByteAlignedx10", |
| Pointer.fromFunction<PassStruct3BytesInt2ByteAlignedx10Type>( |
| passStruct3BytesInt2ByteAlignedx10, 0), |
| passStruct3BytesInt2ByteAlignedx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct4BytesHomogeneousInt16x10", |
| Pointer.fromFunction<PassStruct4BytesHomogeneousInt16x10Type>( |
| passStruct4BytesHomogeneousInt16x10, 0), |
| passStruct4BytesHomogeneousInt16x10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct7BytesHomogeneousUint8x10", |
| Pointer.fromFunction<PassStruct7BytesHomogeneousUint8x10Type>( |
| passStruct7BytesHomogeneousUint8x10, 0), |
| passStruct7BytesHomogeneousUint8x10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct7BytesInt4ByteAlignedx10", |
| Pointer.fromFunction<PassStruct7BytesInt4ByteAlignedx10Type>( |
| passStruct7BytesInt4ByteAlignedx10, 0), |
| passStruct7BytesInt4ByteAlignedx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct8BytesIntx10", |
| Pointer.fromFunction<PassStruct8BytesIntx10Type>( |
| passStruct8BytesIntx10, 0), |
| passStruct8BytesIntx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct8BytesHomogeneousFloatx10", |
| Pointer.fromFunction<PassStruct8BytesHomogeneousFloatx10Type>( |
| passStruct8BytesHomogeneousFloatx10, 0.0), |
| passStruct8BytesHomogeneousFloatx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct8BytesMixedx10", |
| Pointer.fromFunction<PassStruct8BytesMixedx10Type>( |
| passStruct8BytesMixedx10, 0.0), |
| passStruct8BytesMixedx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct9BytesHomogeneousUint8x10", |
| Pointer.fromFunction<PassStruct9BytesHomogeneousUint8x10Type>( |
| passStruct9BytesHomogeneousUint8x10, 0), |
| passStruct9BytesHomogeneousUint8x10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct9BytesInt4Or8ByteAlignedx10", |
| Pointer.fromFunction<PassStruct9BytesInt4Or8ByteAlignedx10Type>( |
| passStruct9BytesInt4Or8ByteAlignedx10, 0), |
| passStruct9BytesInt4Or8ByteAlignedx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct12BytesHomogeneousFloatx6", |
| Pointer.fromFunction<PassStruct12BytesHomogeneousFloatx6Type>( |
| passStruct12BytesHomogeneousFloatx6, 0.0), |
| passStruct12BytesHomogeneousFloatx6AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct16BytesHomogeneousFloatx5", |
| Pointer.fromFunction<PassStruct16BytesHomogeneousFloatx5Type>( |
| passStruct16BytesHomogeneousFloatx5, 0.0), |
| passStruct16BytesHomogeneousFloatx5AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct16BytesMixedx10", |
| Pointer.fromFunction<PassStruct16BytesMixedx10Type>( |
| passStruct16BytesMixedx10, 0.0), |
| passStruct16BytesMixedx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct16BytesMixed2x10", |
| Pointer.fromFunction<PassStruct16BytesMixed2x10Type>( |
| passStruct16BytesMixed2x10, 0.0), |
| passStruct16BytesMixed2x10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct17BytesIntx10", |
| Pointer.fromFunction<PassStruct17BytesIntx10Type>( |
| passStruct17BytesIntx10, 0), |
| passStruct17BytesIntx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct19BytesHomogeneousUint8x10", |
| Pointer.fromFunction<PassStruct19BytesHomogeneousUint8x10Type>( |
| passStruct19BytesHomogeneousUint8x10, 0), |
| passStruct19BytesHomogeneousUint8x10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct20BytesHomogeneousInt32x10", |
| Pointer.fromFunction<PassStruct20BytesHomogeneousInt32x10Type>( |
| passStruct20BytesHomogeneousInt32x10, 0), |
| passStruct20BytesHomogeneousInt32x10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct20BytesHomogeneousFloat", |
| Pointer.fromFunction<PassStruct20BytesHomogeneousFloatType>( |
| passStruct20BytesHomogeneousFloat, 0.0), |
| passStruct20BytesHomogeneousFloatAfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct32BytesHomogeneousDoublex5", |
| Pointer.fromFunction<PassStruct32BytesHomogeneousDoublex5Type>( |
| passStruct32BytesHomogeneousDoublex5, 0.0), |
| passStruct32BytesHomogeneousDoublex5AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct40BytesHomogeneousDouble", |
| Pointer.fromFunction<PassStruct40BytesHomogeneousDoubleType>( |
| passStruct40BytesHomogeneousDouble, 0.0), |
| passStruct40BytesHomogeneousDoubleAfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct1024BytesHomogeneousUint64", |
| Pointer.fromFunction<PassStruct1024BytesHomogeneousUint64Type>( |
| passStruct1024BytesHomogeneousUint64, 0), |
| passStruct1024BytesHomogeneousUint64AfterCallback), |
| CallbackTest.withCheck( |
| "PassFloatStruct16BytesHomogeneousFloatFloatStruct1", |
| Pointer.fromFunction< |
| PassFloatStruct16BytesHomogeneousFloatFloatStruct1Type>( |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1, 0.0), |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1AfterCallback), |
| CallbackTest.withCheck( |
| "PassFloatStruct32BytesHomogeneousDoubleFloatStruct", |
| Pointer.fromFunction< |
| PassFloatStruct32BytesHomogeneousDoubleFloatStructType>( |
| passFloatStruct32BytesHomogeneousDoubleFloatStruct, 0.0), |
| passFloatStruct32BytesHomogeneousDoubleFloatStructAfterCallback), |
| CallbackTest.withCheck( |
| "PassInt8Struct16BytesMixedInt8Struct16BytesMixedIn", |
| Pointer.fromFunction< |
| PassInt8Struct16BytesMixedInt8Struct16BytesMixedInType>( |
| passInt8Struct16BytesMixedInt8Struct16BytesMixedIn, 0.0), |
| passInt8Struct16BytesMixedInt8Struct16BytesMixedInAfterCallback), |
| CallbackTest.withCheck( |
| "PassDoublex6Struct16BytesMixedx4Int32", |
| Pointer.fromFunction<PassDoublex6Struct16BytesMixedx4Int32Type>( |
| passDoublex6Struct16BytesMixedx4Int32, 0.0), |
| passDoublex6Struct16BytesMixedx4Int32AfterCallback), |
| CallbackTest.withCheck( |
| "PassInt32x4Struct16BytesMixedx4Double", |
| Pointer.fromFunction<PassInt32x4Struct16BytesMixedx4DoubleType>( |
| passInt32x4Struct16BytesMixedx4Double, 0.0), |
| passInt32x4Struct16BytesMixedx4DoubleAfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct40BytesHomogeneousDoubleStruct4BytesHomo", |
| Pointer.fromFunction< |
| PassStruct40BytesHomogeneousDoubleStruct4BytesHomoType>( |
| passStruct40BytesHomogeneousDoubleStruct4BytesHomo, 0.0), |
| passStruct40BytesHomogeneousDoubleStruct4BytesHomoAfterCallback), |
| CallbackTest.withCheck( |
| "PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int", |
| Pointer.fromFunction< |
| PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntType>( |
| passInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int, 0.0), |
| passInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntAfterCallback), |
| CallbackTest.withCheck( |
| "PassStructAlignmentInt16", |
| Pointer.fromFunction<PassStructAlignmentInt16Type>( |
| passStructAlignmentInt16, 0), |
| passStructAlignmentInt16AfterCallback), |
| CallbackTest.withCheck( |
| "PassStructAlignmentInt32", |
| Pointer.fromFunction<PassStructAlignmentInt32Type>( |
| passStructAlignmentInt32, 0), |
| passStructAlignmentInt32AfterCallback), |
| CallbackTest.withCheck( |
| "PassStructAlignmentInt64", |
| Pointer.fromFunction<PassStructAlignmentInt64Type>( |
| passStructAlignmentInt64, 0), |
| passStructAlignmentInt64AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct8BytesNestedIntx10", |
| Pointer.fromFunction<PassStruct8BytesNestedIntx10Type>( |
| passStruct8BytesNestedIntx10, 0), |
| passStruct8BytesNestedIntx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct8BytesNestedFloatx10", |
| Pointer.fromFunction<PassStruct8BytesNestedFloatx10Type>( |
| passStruct8BytesNestedFloatx10, 0.0), |
| passStruct8BytesNestedFloatx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct8BytesNestedFloat2x10", |
| Pointer.fromFunction<PassStruct8BytesNestedFloat2x10Type>( |
| passStruct8BytesNestedFloat2x10, 0.0), |
| passStruct8BytesNestedFloat2x10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct8BytesNestedMixedx10", |
| Pointer.fromFunction<PassStruct8BytesNestedMixedx10Type>( |
| passStruct8BytesNestedMixedx10, 0.0), |
| passStruct8BytesNestedMixedx10AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct16BytesNestedIntx2", |
| Pointer.fromFunction<PassStruct16BytesNestedIntx2Type>( |
| passStruct16BytesNestedIntx2, 0), |
| passStruct16BytesNestedIntx2AfterCallback), |
| CallbackTest.withCheck( |
| "PassStruct32BytesNestedIntx2", |
| Pointer.fromFunction<PassStruct32BytesNestedIntx2Type>( |
| passStruct32BytesNestedIntx2, 0), |
| passStruct32BytesNestedIntx2AfterCallback), |
| CallbackTest.withCheck( |
| "PassStructNestedIntStructAlignmentInt16", |
| Pointer.fromFunction<PassStructNestedIntStructAlignmentInt16Type>( |
| passStructNestedIntStructAlignmentInt16, 0), |
| passStructNestedIntStructAlignmentInt16AfterCallback), |
| CallbackTest.withCheck( |
| "PassStructNestedIntStructAlignmentInt32", |
| Pointer.fromFunction<PassStructNestedIntStructAlignmentInt32Type>( |
| passStructNestedIntStructAlignmentInt32, 0), |
| passStructNestedIntStructAlignmentInt32AfterCallback), |
| CallbackTest.withCheck( |
| "PassStructNestedIntStructAlignmentInt64", |
| Pointer.fromFunction<PassStructNestedIntStructAlignmentInt64Type>( |
| passStructNestedIntStructAlignmentInt64, 0), |
| passStructNestedIntStructAlignmentInt64AfterCallback), |
| CallbackTest.withCheck( |
| "PassStructNestedIrregularEvenBiggerx4", |
| Pointer.fromFunction<PassStructNestedIrregularEvenBiggerx4Type>( |
| passStructNestedIrregularEvenBiggerx4, 0.0), |
| passStructNestedIrregularEvenBiggerx4AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct1ByteInt", |
| Pointer.fromFunction<ReturnStruct1ByteIntType>(returnStruct1ByteInt), |
| returnStruct1ByteIntAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct3BytesHomogeneousUint8", |
| Pointer.fromFunction<ReturnStruct3BytesHomogeneousUint8Type>( |
| returnStruct3BytesHomogeneousUint8), |
| returnStruct3BytesHomogeneousUint8AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct3BytesInt2ByteAligned", |
| Pointer.fromFunction<ReturnStruct3BytesInt2ByteAlignedType>( |
| returnStruct3BytesInt2ByteAligned), |
| returnStruct3BytesInt2ByteAlignedAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct4BytesHomogeneousInt16", |
| Pointer.fromFunction<ReturnStruct4BytesHomogeneousInt16Type>( |
| returnStruct4BytesHomogeneousInt16), |
| returnStruct4BytesHomogeneousInt16AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct7BytesHomogeneousUint8", |
| Pointer.fromFunction<ReturnStruct7BytesHomogeneousUint8Type>( |
| returnStruct7BytesHomogeneousUint8), |
| returnStruct7BytesHomogeneousUint8AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct7BytesInt4ByteAligned", |
| Pointer.fromFunction<ReturnStruct7BytesInt4ByteAlignedType>( |
| returnStruct7BytesInt4ByteAligned), |
| returnStruct7BytesInt4ByteAlignedAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesInt", |
| Pointer.fromFunction<ReturnStruct8BytesIntType>(returnStruct8BytesInt), |
| returnStruct8BytesIntAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesHomogeneousFloat", |
| Pointer.fromFunction<ReturnStruct8BytesHomogeneousFloatType>( |
| returnStruct8BytesHomogeneousFloat), |
| returnStruct8BytesHomogeneousFloatAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesMixed", |
| Pointer.fromFunction<ReturnStruct8BytesMixedType>( |
| returnStruct8BytesMixed), |
| returnStruct8BytesMixedAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct9BytesHomogeneousUint8", |
| Pointer.fromFunction<ReturnStruct9BytesHomogeneousUint8Type>( |
| returnStruct9BytesHomogeneousUint8), |
| returnStruct9BytesHomogeneousUint8AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct9BytesInt4Or8ByteAligned", |
| Pointer.fromFunction<ReturnStruct9BytesInt4Or8ByteAlignedType>( |
| returnStruct9BytesInt4Or8ByteAligned), |
| returnStruct9BytesInt4Or8ByteAlignedAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct12BytesHomogeneousFloat", |
| Pointer.fromFunction<ReturnStruct12BytesHomogeneousFloatType>( |
| returnStruct12BytesHomogeneousFloat), |
| returnStruct12BytesHomogeneousFloatAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct16BytesHomogeneousFloat", |
| Pointer.fromFunction<ReturnStruct16BytesHomogeneousFloatType>( |
| returnStruct16BytesHomogeneousFloat), |
| returnStruct16BytesHomogeneousFloatAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct16BytesMixed", |
| Pointer.fromFunction<ReturnStruct16BytesMixedType>( |
| returnStruct16BytesMixed), |
| returnStruct16BytesMixedAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct16BytesMixed2", |
| Pointer.fromFunction<ReturnStruct16BytesMixed2Type>( |
| returnStruct16BytesMixed2), |
| returnStruct16BytesMixed2AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct17BytesInt", |
| Pointer.fromFunction<ReturnStruct17BytesIntType>(returnStruct17BytesInt), |
| returnStruct17BytesIntAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct19BytesHomogeneousUint8", |
| Pointer.fromFunction<ReturnStruct19BytesHomogeneousUint8Type>( |
| returnStruct19BytesHomogeneousUint8), |
| returnStruct19BytesHomogeneousUint8AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct20BytesHomogeneousInt32", |
| Pointer.fromFunction<ReturnStruct20BytesHomogeneousInt32Type>( |
| returnStruct20BytesHomogeneousInt32), |
| returnStruct20BytesHomogeneousInt32AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct20BytesHomogeneousFloat", |
| Pointer.fromFunction<ReturnStruct20BytesHomogeneousFloatType>( |
| returnStruct20BytesHomogeneousFloat), |
| returnStruct20BytesHomogeneousFloatAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct32BytesHomogeneousDouble", |
| Pointer.fromFunction<ReturnStruct32BytesHomogeneousDoubleType>( |
| returnStruct32BytesHomogeneousDouble), |
| returnStruct32BytesHomogeneousDoubleAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct40BytesHomogeneousDouble", |
| Pointer.fromFunction<ReturnStruct40BytesHomogeneousDoubleType>( |
| returnStruct40BytesHomogeneousDouble), |
| returnStruct40BytesHomogeneousDoubleAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct1024BytesHomogeneousUint64", |
| Pointer.fromFunction<ReturnStruct1024BytesHomogeneousUint64Type>( |
| returnStruct1024BytesHomogeneousUint64), |
| returnStruct1024BytesHomogeneousUint64AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentStruct1ByteInt", |
| Pointer.fromFunction<ReturnStructArgumentStruct1ByteIntType>( |
| returnStructArgumentStruct1ByteInt), |
| returnStructArgumentStruct1ByteIntAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentInt32x8Struct1ByteInt", |
| Pointer.fromFunction<ReturnStructArgumentInt32x8Struct1ByteIntType>( |
| returnStructArgumentInt32x8Struct1ByteInt), |
| returnStructArgumentInt32x8Struct1ByteIntAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentStruct8BytesHomogeneousFloat", |
| Pointer.fromFunction< |
| ReturnStructArgumentStruct8BytesHomogeneousFloatType>( |
| returnStructArgumentStruct8BytesHomogeneousFloat), |
| returnStructArgumentStruct8BytesHomogeneousFloatAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentStruct20BytesHomogeneousInt32", |
| Pointer.fromFunction< |
| ReturnStructArgumentStruct20BytesHomogeneousInt32Type>( |
| returnStructArgumentStruct20BytesHomogeneousInt32), |
| returnStructArgumentStruct20BytesHomogeneousInt32AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentInt32x8Struct20BytesHomogeneou", |
| Pointer.fromFunction< |
| ReturnStructArgumentInt32x8Struct20BytesHomogeneouType>( |
| returnStructArgumentInt32x8Struct20BytesHomogeneou), |
| returnStructArgumentInt32x8Struct20BytesHomogeneouAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructAlignmentInt16", |
| Pointer.fromFunction<ReturnStructAlignmentInt16Type>( |
| returnStructAlignmentInt16), |
| returnStructAlignmentInt16AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructAlignmentInt32", |
| Pointer.fromFunction<ReturnStructAlignmentInt32Type>( |
| returnStructAlignmentInt32), |
| returnStructAlignmentInt32AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructAlignmentInt64", |
| Pointer.fromFunction<ReturnStructAlignmentInt64Type>( |
| returnStructAlignmentInt64), |
| returnStructAlignmentInt64AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesNestedInt", |
| Pointer.fromFunction<ReturnStruct8BytesNestedIntType>( |
| returnStruct8BytesNestedInt), |
| returnStruct8BytesNestedIntAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesNestedFloat", |
| Pointer.fromFunction<ReturnStruct8BytesNestedFloatType>( |
| returnStruct8BytesNestedFloat), |
| returnStruct8BytesNestedFloatAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesNestedFloat2", |
| Pointer.fromFunction<ReturnStruct8BytesNestedFloat2Type>( |
| returnStruct8BytesNestedFloat2), |
| returnStruct8BytesNestedFloat2AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesNestedMixed", |
| Pointer.fromFunction<ReturnStruct8BytesNestedMixedType>( |
| returnStruct8BytesNestedMixed), |
| returnStruct8BytesNestedMixedAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct16BytesNestedInt", |
| Pointer.fromFunction<ReturnStruct16BytesNestedIntType>( |
| returnStruct16BytesNestedInt), |
| returnStruct16BytesNestedIntAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStruct32BytesNestedInt", |
| Pointer.fromFunction<ReturnStruct32BytesNestedIntType>( |
| returnStruct32BytesNestedInt), |
| returnStruct32BytesNestedIntAfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructNestedIntStructAlignmentInt16", |
| Pointer.fromFunction<ReturnStructNestedIntStructAlignmentInt16Type>( |
| returnStructNestedIntStructAlignmentInt16), |
| returnStructNestedIntStructAlignmentInt16AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructNestedIntStructAlignmentInt32", |
| Pointer.fromFunction<ReturnStructNestedIntStructAlignmentInt32Type>( |
| returnStructNestedIntStructAlignmentInt32), |
| returnStructNestedIntStructAlignmentInt32AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructNestedIntStructAlignmentInt64", |
| Pointer.fromFunction<ReturnStructNestedIntStructAlignmentInt64Type>( |
| returnStructNestedIntStructAlignmentInt64), |
| returnStructNestedIntStructAlignmentInt64AfterCallback), |
| CallbackTest.withCheck( |
| "ReturnStructNestedIrregularEvenBigger", |
| Pointer.fromFunction<ReturnStructNestedIrregularEvenBiggerType>( |
| returnStructNestedIrregularEvenBigger), |
| returnStructNestedIrregularEvenBiggerAfterCallback), |
| ]; |
| typedef PassStruct1ByteIntx10Type = Int64 Function( |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt, |
| Struct1ByteInt); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct1ByteInt passStruct1ByteIntx10_a0 = Struct1ByteInt(); |
| Struct1ByteInt passStruct1ByteIntx10_a1 = Struct1ByteInt(); |
| Struct1ByteInt passStruct1ByteIntx10_a2 = Struct1ByteInt(); |
| Struct1ByteInt passStruct1ByteIntx10_a3 = Struct1ByteInt(); |
| Struct1ByteInt passStruct1ByteIntx10_a4 = Struct1ByteInt(); |
| Struct1ByteInt passStruct1ByteIntx10_a5 = Struct1ByteInt(); |
| Struct1ByteInt passStruct1ByteIntx10_a6 = Struct1ByteInt(); |
| Struct1ByteInt passStruct1ByteIntx10_a7 = Struct1ByteInt(); |
| Struct1ByteInt passStruct1ByteIntx10_a8 = Struct1ByteInt(); |
| Struct1ByteInt passStruct1ByteIntx10_a9 = Struct1ByteInt(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct1ByteIntx10Result = 0; |
| |
| int passStruct1ByteIntx10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct1ByteIntx10_a0.a0; |
| result += passStruct1ByteIntx10_a1.a0; |
| result += passStruct1ByteIntx10_a2.a0; |
| result += passStruct1ByteIntx10_a3.a0; |
| result += passStruct1ByteIntx10_a4.a0; |
| result += passStruct1ByteIntx10_a5.a0; |
| result += passStruct1ByteIntx10_a6.a0; |
| result += passStruct1ByteIntx10_a7.a0; |
| result += passStruct1ByteIntx10_a8.a0; |
| result += passStruct1ByteIntx10_a9.a0; |
| |
| passStruct1ByteIntx10Result = result; |
| |
| return result; |
| } |
| |
| /// Smallest struct with data. |
| /// 10 struct arguments will exhaust available registers. |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct1ByteIntx10 throwing on purpuse!"); |
| } |
| |
| passStruct1ByteIntx10_a0 = a0; |
| passStruct1ByteIntx10_a1 = a1; |
| passStruct1ByteIntx10_a2 = a2; |
| passStruct1ByteIntx10_a3 = a3; |
| passStruct1ByteIntx10_a4 = a4; |
| passStruct1ByteIntx10_a5 = a5; |
| passStruct1ByteIntx10_a6 = a6; |
| passStruct1ByteIntx10_a7 = a7; |
| passStruct1ByteIntx10_a8 = a8; |
| passStruct1ByteIntx10_a9 = a9; |
| |
| final result = passStruct1ByteIntx10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct1ByteIntx10AfterCallback() { |
| final result = passStruct1ByteIntx10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(5, result); |
| } |
| |
| typedef PassStruct3BytesHomogeneousUint8x10Type = Int64 Function( |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8, |
| Struct3BytesHomogeneousUint8); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a0 = |
| Struct3BytesHomogeneousUint8(); |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a1 = |
| Struct3BytesHomogeneousUint8(); |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a2 = |
| Struct3BytesHomogeneousUint8(); |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a3 = |
| Struct3BytesHomogeneousUint8(); |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a4 = |
| Struct3BytesHomogeneousUint8(); |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a5 = |
| Struct3BytesHomogeneousUint8(); |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a6 = |
| Struct3BytesHomogeneousUint8(); |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a7 = |
| Struct3BytesHomogeneousUint8(); |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a8 = |
| Struct3BytesHomogeneousUint8(); |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a9 = |
| Struct3BytesHomogeneousUint8(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct3BytesHomogeneousUint8x10Result = 0; |
| |
| int passStruct3BytesHomogeneousUint8x10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct3BytesHomogeneousUint8x10_a0.a0; |
| result += passStruct3BytesHomogeneousUint8x10_a0.a1; |
| result += passStruct3BytesHomogeneousUint8x10_a0.a2; |
| result += passStruct3BytesHomogeneousUint8x10_a1.a0; |
| result += passStruct3BytesHomogeneousUint8x10_a1.a1; |
| result += passStruct3BytesHomogeneousUint8x10_a1.a2; |
| result += passStruct3BytesHomogeneousUint8x10_a2.a0; |
| result += passStruct3BytesHomogeneousUint8x10_a2.a1; |
| result += passStruct3BytesHomogeneousUint8x10_a2.a2; |
| result += passStruct3BytesHomogeneousUint8x10_a3.a0; |
| result += passStruct3BytesHomogeneousUint8x10_a3.a1; |
| result += passStruct3BytesHomogeneousUint8x10_a3.a2; |
| result += passStruct3BytesHomogeneousUint8x10_a4.a0; |
| result += passStruct3BytesHomogeneousUint8x10_a4.a1; |
| result += passStruct3BytesHomogeneousUint8x10_a4.a2; |
| result += passStruct3BytesHomogeneousUint8x10_a5.a0; |
| result += passStruct3BytesHomogeneousUint8x10_a5.a1; |
| result += passStruct3BytesHomogeneousUint8x10_a5.a2; |
| result += passStruct3BytesHomogeneousUint8x10_a6.a0; |
| result += passStruct3BytesHomogeneousUint8x10_a6.a1; |
| result += passStruct3BytesHomogeneousUint8x10_a6.a2; |
| result += passStruct3BytesHomogeneousUint8x10_a7.a0; |
| result += passStruct3BytesHomogeneousUint8x10_a7.a1; |
| result += passStruct3BytesHomogeneousUint8x10_a7.a2; |
| result += passStruct3BytesHomogeneousUint8x10_a8.a0; |
| result += passStruct3BytesHomogeneousUint8x10_a8.a1; |
| result += passStruct3BytesHomogeneousUint8x10_a8.a2; |
| result += passStruct3BytesHomogeneousUint8x10_a9.a0; |
| result += passStruct3BytesHomogeneousUint8x10_a9.a1; |
| result += passStruct3BytesHomogeneousUint8x10_a9.a2; |
| |
| passStruct3BytesHomogeneousUint8x10Result = result; |
| |
| return result; |
| } |
| |
| /// Not a multiple of word size, not a power of two. |
| /// 10 struct arguments will exhaust available registers. |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct3BytesHomogeneousUint8x10 throwing on purpuse!"); |
| } |
| |
| passStruct3BytesHomogeneousUint8x10_a0 = a0; |
| passStruct3BytesHomogeneousUint8x10_a1 = a1; |
| passStruct3BytesHomogeneousUint8x10_a2 = a2; |
| passStruct3BytesHomogeneousUint8x10_a3 = a3; |
| passStruct3BytesHomogeneousUint8x10_a4 = a4; |
| passStruct3BytesHomogeneousUint8x10_a5 = a5; |
| passStruct3BytesHomogeneousUint8x10_a6 = a6; |
| passStruct3BytesHomogeneousUint8x10_a7 = a7; |
| passStruct3BytesHomogeneousUint8x10_a8 = a8; |
| passStruct3BytesHomogeneousUint8x10_a9 = a9; |
| |
| final result = passStruct3BytesHomogeneousUint8x10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct3BytesHomogeneousUint8x10AfterCallback() { |
| final result = passStruct3BytesHomogeneousUint8x10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(465, result); |
| } |
| |
| typedef PassStruct3BytesInt2ByteAlignedx10Type = Int64 Function( |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned, |
| Struct3BytesInt2ByteAligned); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a0 = |
| Struct3BytesInt2ByteAligned(); |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a1 = |
| Struct3BytesInt2ByteAligned(); |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a2 = |
| Struct3BytesInt2ByteAligned(); |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a3 = |
| Struct3BytesInt2ByteAligned(); |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a4 = |
| Struct3BytesInt2ByteAligned(); |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a5 = |
| Struct3BytesInt2ByteAligned(); |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a6 = |
| Struct3BytesInt2ByteAligned(); |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a7 = |
| Struct3BytesInt2ByteAligned(); |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a8 = |
| Struct3BytesInt2ByteAligned(); |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a9 = |
| Struct3BytesInt2ByteAligned(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct3BytesInt2ByteAlignedx10Result = 0; |
| |
| int passStruct3BytesInt2ByteAlignedx10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct3BytesInt2ByteAlignedx10_a0.a0; |
| result += passStruct3BytesInt2ByteAlignedx10_a0.a1; |
| result += passStruct3BytesInt2ByteAlignedx10_a1.a0; |
| result += passStruct3BytesInt2ByteAlignedx10_a1.a1; |
| result += passStruct3BytesInt2ByteAlignedx10_a2.a0; |
| result += passStruct3BytesInt2ByteAlignedx10_a2.a1; |
| result += passStruct3BytesInt2ByteAlignedx10_a3.a0; |
| result += passStruct3BytesInt2ByteAlignedx10_a3.a1; |
| result += passStruct3BytesInt2ByteAlignedx10_a4.a0; |
| result += passStruct3BytesInt2ByteAlignedx10_a4.a1; |
| result += passStruct3BytesInt2ByteAlignedx10_a5.a0; |
| result += passStruct3BytesInt2ByteAlignedx10_a5.a1; |
| result += passStruct3BytesInt2ByteAlignedx10_a6.a0; |
| result += passStruct3BytesInt2ByteAlignedx10_a6.a1; |
| result += passStruct3BytesInt2ByteAlignedx10_a7.a0; |
| result += passStruct3BytesInt2ByteAlignedx10_a7.a1; |
| result += passStruct3BytesInt2ByteAlignedx10_a8.a0; |
| result += passStruct3BytesInt2ByteAlignedx10_a8.a1; |
| result += passStruct3BytesInt2ByteAlignedx10_a9.a0; |
| result += passStruct3BytesInt2ByteAlignedx10_a9.a1; |
| |
| passStruct3BytesInt2ByteAlignedx10Result = result; |
| |
| return result; |
| } |
| |
| /// 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. |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct3BytesInt2ByteAlignedx10 throwing on purpuse!"); |
| } |
| |
| passStruct3BytesInt2ByteAlignedx10_a0 = a0; |
| passStruct3BytesInt2ByteAlignedx10_a1 = a1; |
| passStruct3BytesInt2ByteAlignedx10_a2 = a2; |
| passStruct3BytesInt2ByteAlignedx10_a3 = a3; |
| passStruct3BytesInt2ByteAlignedx10_a4 = a4; |
| passStruct3BytesInt2ByteAlignedx10_a5 = a5; |
| passStruct3BytesInt2ByteAlignedx10_a6 = a6; |
| passStruct3BytesInt2ByteAlignedx10_a7 = a7; |
| passStruct3BytesInt2ByteAlignedx10_a8 = a8; |
| passStruct3BytesInt2ByteAlignedx10_a9 = a9; |
| |
| final result = passStruct3BytesInt2ByteAlignedx10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct3BytesInt2ByteAlignedx10AfterCallback() { |
| final result = passStruct3BytesInt2ByteAlignedx10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(10, result); |
| } |
| |
| typedef PassStruct4BytesHomogeneousInt16x10Type = Int64 Function( |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16, |
| Struct4BytesHomogeneousInt16); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a0 = |
| Struct4BytesHomogeneousInt16(); |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a1 = |
| Struct4BytesHomogeneousInt16(); |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a2 = |
| Struct4BytesHomogeneousInt16(); |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a3 = |
| Struct4BytesHomogeneousInt16(); |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a4 = |
| Struct4BytesHomogeneousInt16(); |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a5 = |
| Struct4BytesHomogeneousInt16(); |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a6 = |
| Struct4BytesHomogeneousInt16(); |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a7 = |
| Struct4BytesHomogeneousInt16(); |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a8 = |
| Struct4BytesHomogeneousInt16(); |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a9 = |
| Struct4BytesHomogeneousInt16(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct4BytesHomogeneousInt16x10Result = 0; |
| |
| int passStruct4BytesHomogeneousInt16x10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct4BytesHomogeneousInt16x10_a0.a0; |
| result += passStruct4BytesHomogeneousInt16x10_a0.a1; |
| result += passStruct4BytesHomogeneousInt16x10_a1.a0; |
| result += passStruct4BytesHomogeneousInt16x10_a1.a1; |
| result += passStruct4BytesHomogeneousInt16x10_a2.a0; |
| result += passStruct4BytesHomogeneousInt16x10_a2.a1; |
| result += passStruct4BytesHomogeneousInt16x10_a3.a0; |
| result += passStruct4BytesHomogeneousInt16x10_a3.a1; |
| result += passStruct4BytesHomogeneousInt16x10_a4.a0; |
| result += passStruct4BytesHomogeneousInt16x10_a4.a1; |
| result += passStruct4BytesHomogeneousInt16x10_a5.a0; |
| result += passStruct4BytesHomogeneousInt16x10_a5.a1; |
| result += passStruct4BytesHomogeneousInt16x10_a6.a0; |
| result += passStruct4BytesHomogeneousInt16x10_a6.a1; |
| result += passStruct4BytesHomogeneousInt16x10_a7.a0; |
| result += passStruct4BytesHomogeneousInt16x10_a7.a1; |
| result += passStruct4BytesHomogeneousInt16x10_a8.a0; |
| result += passStruct4BytesHomogeneousInt16x10_a8.a1; |
| result += passStruct4BytesHomogeneousInt16x10_a9.a0; |
| result += passStruct4BytesHomogeneousInt16x10_a9.a1; |
| |
| passStruct4BytesHomogeneousInt16x10Result = result; |
| |
| return result; |
| } |
| |
| /// Exactly word size on 32-bit architectures. |
| /// 10 struct arguments will exhaust available registers. |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct4BytesHomogeneousInt16x10 throwing on purpuse!"); |
| } |
| |
| passStruct4BytesHomogeneousInt16x10_a0 = a0; |
| passStruct4BytesHomogeneousInt16x10_a1 = a1; |
| passStruct4BytesHomogeneousInt16x10_a2 = a2; |
| passStruct4BytesHomogeneousInt16x10_a3 = a3; |
| passStruct4BytesHomogeneousInt16x10_a4 = a4; |
| passStruct4BytesHomogeneousInt16x10_a5 = a5; |
| passStruct4BytesHomogeneousInt16x10_a6 = a6; |
| passStruct4BytesHomogeneousInt16x10_a7 = a7; |
| passStruct4BytesHomogeneousInt16x10_a8 = a8; |
| passStruct4BytesHomogeneousInt16x10_a9 = a9; |
| |
| final result = passStruct4BytesHomogeneousInt16x10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct4BytesHomogeneousInt16x10AfterCallback() { |
| final result = passStruct4BytesHomogeneousInt16x10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(10, result); |
| } |
| |
| typedef PassStruct7BytesHomogeneousUint8x10Type = Int64 Function( |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8, |
| Struct7BytesHomogeneousUint8); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a0 = |
| Struct7BytesHomogeneousUint8(); |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a1 = |
| Struct7BytesHomogeneousUint8(); |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a2 = |
| Struct7BytesHomogeneousUint8(); |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a3 = |
| Struct7BytesHomogeneousUint8(); |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a4 = |
| Struct7BytesHomogeneousUint8(); |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a5 = |
| Struct7BytesHomogeneousUint8(); |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a6 = |
| Struct7BytesHomogeneousUint8(); |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a7 = |
| Struct7BytesHomogeneousUint8(); |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a8 = |
| Struct7BytesHomogeneousUint8(); |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a9 = |
| Struct7BytesHomogeneousUint8(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct7BytesHomogeneousUint8x10Result = 0; |
| |
| int passStruct7BytesHomogeneousUint8x10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct7BytesHomogeneousUint8x10_a0.a0; |
| result += passStruct7BytesHomogeneousUint8x10_a0.a1; |
| result += passStruct7BytesHomogeneousUint8x10_a0.a2; |
| result += passStruct7BytesHomogeneousUint8x10_a0.a3; |
| result += passStruct7BytesHomogeneousUint8x10_a0.a4; |
| result += passStruct7BytesHomogeneousUint8x10_a0.a5; |
| result += passStruct7BytesHomogeneousUint8x10_a0.a6; |
| result += passStruct7BytesHomogeneousUint8x10_a1.a0; |
| result += passStruct7BytesHomogeneousUint8x10_a1.a1; |
| result += passStruct7BytesHomogeneousUint8x10_a1.a2; |
| result += passStruct7BytesHomogeneousUint8x10_a1.a3; |
| result += passStruct7BytesHomogeneousUint8x10_a1.a4; |
| result += passStruct7BytesHomogeneousUint8x10_a1.a5; |
| result += passStruct7BytesHomogeneousUint8x10_a1.a6; |
| result += passStruct7BytesHomogeneousUint8x10_a2.a0; |
| result += passStruct7BytesHomogeneousUint8x10_a2.a1; |
| result += passStruct7BytesHomogeneousUint8x10_a2.a2; |
| result += passStruct7BytesHomogeneousUint8x10_a2.a3; |
| result += passStruct7BytesHomogeneousUint8x10_a2.a4; |
| result += passStruct7BytesHomogeneousUint8x10_a2.a5; |
| result += passStruct7BytesHomogeneousUint8x10_a2.a6; |
| result += passStruct7BytesHomogeneousUint8x10_a3.a0; |
| result += passStruct7BytesHomogeneousUint8x10_a3.a1; |
| result += passStruct7BytesHomogeneousUint8x10_a3.a2; |
| result += passStruct7BytesHomogeneousUint8x10_a3.a3; |
| result += passStruct7BytesHomogeneousUint8x10_a3.a4; |
| result += passStruct7BytesHomogeneousUint8x10_a3.a5; |
| result += passStruct7BytesHomogeneousUint8x10_a3.a6; |
| result += passStruct7BytesHomogeneousUint8x10_a4.a0; |
| result += passStruct7BytesHomogeneousUint8x10_a4.a1; |
| result += passStruct7BytesHomogeneousUint8x10_a4.a2; |
| result += passStruct7BytesHomogeneousUint8x10_a4.a3; |
| result += passStruct7BytesHomogeneousUint8x10_a4.a4; |
| result += passStruct7BytesHomogeneousUint8x10_a4.a5; |
| result += passStruct7BytesHomogeneousUint8x10_a4.a6; |
| result += passStruct7BytesHomogeneousUint8x10_a5.a0; |
| result += passStruct7BytesHomogeneousUint8x10_a5.a1; |
| result += passStruct7BytesHomogeneousUint8x10_a5.a2; |
| result += passStruct7BytesHomogeneousUint8x10_a5.a3; |
| result += passStruct7BytesHomogeneousUint8x10_a5.a4; |
| result += passStruct7BytesHomogeneousUint8x10_a5.a5; |
| result += passStruct7BytesHomogeneousUint8x10_a5.a6; |
| result += passStruct7BytesHomogeneousUint8x10_a6.a0; |
| result += passStruct7BytesHomogeneousUint8x10_a6.a1; |
| result += passStruct7BytesHomogeneousUint8x10_a6.a2; |
| result += passStruct7BytesHomogeneousUint8x10_a6.a3; |
| result += passStruct7BytesHomogeneousUint8x10_a6.a4; |
| result += passStruct7BytesHomogeneousUint8x10_a6.a5; |
| result += passStruct7BytesHomogeneousUint8x10_a6.a6; |
| result += passStruct7BytesHomogeneousUint8x10_a7.a0; |
| result += passStruct7BytesHomogeneousUint8x10_a7.a1; |
| result += passStruct7BytesHomogeneousUint8x10_a7.a2; |
| result += passStruct7BytesHomogeneousUint8x10_a7.a3; |
| result += passStruct7BytesHomogeneousUint8x10_a7.a4; |
| result += passStruct7BytesHomogeneousUint8x10_a7.a5; |
| result += passStruct7BytesHomogeneousUint8x10_a7.a6; |
| result += passStruct7BytesHomogeneousUint8x10_a8.a0; |
| result += passStruct7BytesHomogeneousUint8x10_a8.a1; |
| result += passStruct7BytesHomogeneousUint8x10_a8.a2; |
| result += passStruct7BytesHomogeneousUint8x10_a8.a3; |
| result += passStruct7BytesHomogeneousUint8x10_a8.a4; |
| result += passStruct7BytesHomogeneousUint8x10_a8.a5; |
| result += passStruct7BytesHomogeneousUint8x10_a8.a6; |
| result += passStruct7BytesHomogeneousUint8x10_a9.a0; |
| result += passStruct7BytesHomogeneousUint8x10_a9.a1; |
| result += passStruct7BytesHomogeneousUint8x10_a9.a2; |
| result += passStruct7BytesHomogeneousUint8x10_a9.a3; |
| result += passStruct7BytesHomogeneousUint8x10_a9.a4; |
| result += passStruct7BytesHomogeneousUint8x10_a9.a5; |
| result += passStruct7BytesHomogeneousUint8x10_a9.a6; |
| |
| passStruct7BytesHomogeneousUint8x10Result = result; |
| |
| return result; |
| } |
| |
| /// Sub word size on 64 bit architectures. |
| /// 10 struct arguments will exhaust available registers. |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct7BytesHomogeneousUint8x10 throwing on purpuse!"); |
| } |
| |
| passStruct7BytesHomogeneousUint8x10_a0 = a0; |
| passStruct7BytesHomogeneousUint8x10_a1 = a1; |
| passStruct7BytesHomogeneousUint8x10_a2 = a2; |
| passStruct7BytesHomogeneousUint8x10_a3 = a3; |
| passStruct7BytesHomogeneousUint8x10_a4 = a4; |
| passStruct7BytesHomogeneousUint8x10_a5 = a5; |
| passStruct7BytesHomogeneousUint8x10_a6 = a6; |
| passStruct7BytesHomogeneousUint8x10_a7 = a7; |
| passStruct7BytesHomogeneousUint8x10_a8 = a8; |
| passStruct7BytesHomogeneousUint8x10_a9 = a9; |
| |
| final result = passStruct7BytesHomogeneousUint8x10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct7BytesHomogeneousUint8x10AfterCallback() { |
| final result = passStruct7BytesHomogeneousUint8x10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(2485, result); |
| } |
| |
| typedef PassStruct7BytesInt4ByteAlignedx10Type = Int64 Function( |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned, |
| Struct7BytesInt4ByteAligned); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a0 = |
| Struct7BytesInt4ByteAligned(); |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a1 = |
| Struct7BytesInt4ByteAligned(); |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a2 = |
| Struct7BytesInt4ByteAligned(); |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a3 = |
| Struct7BytesInt4ByteAligned(); |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a4 = |
| Struct7BytesInt4ByteAligned(); |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a5 = |
| Struct7BytesInt4ByteAligned(); |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a6 = |
| Struct7BytesInt4ByteAligned(); |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a7 = |
| Struct7BytesInt4ByteAligned(); |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a8 = |
| Struct7BytesInt4ByteAligned(); |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a9 = |
| Struct7BytesInt4ByteAligned(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct7BytesInt4ByteAlignedx10Result = 0; |
| |
| int passStruct7BytesInt4ByteAlignedx10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct7BytesInt4ByteAlignedx10_a0.a0; |
| result += passStruct7BytesInt4ByteAlignedx10_a0.a1; |
| result += passStruct7BytesInt4ByteAlignedx10_a0.a2; |
| result += passStruct7BytesInt4ByteAlignedx10_a1.a0; |
| result += passStruct7BytesInt4ByteAlignedx10_a1.a1; |
| result += passStruct7BytesInt4ByteAlignedx10_a1.a2; |
| result += passStruct7BytesInt4ByteAlignedx10_a2.a0; |
| result += passStruct7BytesInt4ByteAlignedx10_a2.a1; |
| result += passStruct7BytesInt4ByteAlignedx10_a2.a2; |
| result += passStruct7BytesInt4ByteAlignedx10_a3.a0; |
| result += passStruct7BytesInt4ByteAlignedx10_a3.a1; |
| result += passStruct7BytesInt4ByteAlignedx10_a3.a2; |
| result += passStruct7BytesInt4ByteAlignedx10_a4.a0; |
| result += passStruct7BytesInt4ByteAlignedx10_a4.a1; |
| result += passStruct7BytesInt4ByteAlignedx10_a4.a2; |
| result += passStruct7BytesInt4ByteAlignedx10_a5.a0; |
| result += passStruct7BytesInt4ByteAlignedx10_a5.a1; |
| result += passStruct7BytesInt4ByteAlignedx10_a5.a2; |
| result += passStruct7BytesInt4ByteAlignedx10_a6.a0; |
| result += passStruct7BytesInt4ByteAlignedx10_a6.a1; |
| result += passStruct7BytesInt4ByteAlignedx10_a6.a2; |
| result += passStruct7BytesInt4ByteAlignedx10_a7.a0; |
| result += passStruct7BytesInt4ByteAlignedx10_a7.a1; |
| result += passStruct7BytesInt4ByteAlignedx10_a7.a2; |
| result += passStruct7BytesInt4ByteAlignedx10_a8.a0; |
| result += passStruct7BytesInt4ByteAlignedx10_a8.a1; |
| result += passStruct7BytesInt4ByteAlignedx10_a8.a2; |
| result += passStruct7BytesInt4ByteAlignedx10_a9.a0; |
| result += passStruct7BytesInt4ByteAlignedx10_a9.a1; |
| result += passStruct7BytesInt4ByteAlignedx10_a9.a2; |
| |
| passStruct7BytesInt4ByteAlignedx10Result = result; |
| |
| return result; |
| } |
| |
| /// Sub word size on 64 bit architectures. |
| /// With alignment rules taken into account size is 8 bytes. |
| /// 10 struct arguments will exhaust available registers. |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct7BytesInt4ByteAlignedx10 throwing on purpuse!"); |
| } |
| |
| passStruct7BytesInt4ByteAlignedx10_a0 = a0; |
| passStruct7BytesInt4ByteAlignedx10_a1 = a1; |
| passStruct7BytesInt4ByteAlignedx10_a2 = a2; |
| passStruct7BytesInt4ByteAlignedx10_a3 = a3; |
| passStruct7BytesInt4ByteAlignedx10_a4 = a4; |
| passStruct7BytesInt4ByteAlignedx10_a5 = a5; |
| passStruct7BytesInt4ByteAlignedx10_a6 = a6; |
| passStruct7BytesInt4ByteAlignedx10_a7 = a7; |
| passStruct7BytesInt4ByteAlignedx10_a8 = a8; |
| passStruct7BytesInt4ByteAlignedx10_a9 = a9; |
| |
| final result = passStruct7BytesInt4ByteAlignedx10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct7BytesInt4ByteAlignedx10AfterCallback() { |
| final result = passStruct7BytesInt4ByteAlignedx10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(15, result); |
| } |
| |
| typedef PassStruct8BytesIntx10Type = Int64 Function( |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt, |
| Struct8BytesInt); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct8BytesInt passStruct8BytesIntx10_a0 = Struct8BytesInt(); |
| Struct8BytesInt passStruct8BytesIntx10_a1 = Struct8BytesInt(); |
| Struct8BytesInt passStruct8BytesIntx10_a2 = Struct8BytesInt(); |
| Struct8BytesInt passStruct8BytesIntx10_a3 = Struct8BytesInt(); |
| Struct8BytesInt passStruct8BytesIntx10_a4 = Struct8BytesInt(); |
| Struct8BytesInt passStruct8BytesIntx10_a5 = Struct8BytesInt(); |
| Struct8BytesInt passStruct8BytesIntx10_a6 = Struct8BytesInt(); |
| Struct8BytesInt passStruct8BytesIntx10_a7 = Struct8BytesInt(); |
| Struct8BytesInt passStruct8BytesIntx10_a8 = Struct8BytesInt(); |
| Struct8BytesInt passStruct8BytesIntx10_a9 = Struct8BytesInt(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct8BytesIntx10Result = 0; |
| |
| int passStruct8BytesIntx10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct8BytesIntx10_a0.a0; |
| result += passStruct8BytesIntx10_a0.a1; |
| result += passStruct8BytesIntx10_a0.a2; |
| result += passStruct8BytesIntx10_a1.a0; |
| result += passStruct8BytesIntx10_a1.a1; |
| result += passStruct8BytesIntx10_a1.a2; |
| result += passStruct8BytesIntx10_a2.a0; |
| result += passStruct8BytesIntx10_a2.a1; |
| result += passStruct8BytesIntx10_a2.a2; |
| result += passStruct8BytesIntx10_a3.a0; |
| result += passStruct8BytesIntx10_a3.a1; |
| result += passStruct8BytesIntx10_a3.a2; |
| result += passStruct8BytesIntx10_a4.a0; |
| result += passStruct8BytesIntx10_a4.a1; |
| result += passStruct8BytesIntx10_a4.a2; |
| result += passStruct8BytesIntx10_a5.a0; |
| result += passStruct8BytesIntx10_a5.a1; |
| result += passStruct8BytesIntx10_a5.a2; |
| result += passStruct8BytesIntx10_a6.a0; |
| result += passStruct8BytesIntx10_a6.a1; |
| result += passStruct8BytesIntx10_a6.a2; |
| result += passStruct8BytesIntx10_a7.a0; |
| result += passStruct8BytesIntx10_a7.a1; |
| result += passStruct8BytesIntx10_a7.a2; |
| result += passStruct8BytesIntx10_a8.a0; |
| result += passStruct8BytesIntx10_a8.a1; |
| result += passStruct8BytesIntx10_a8.a2; |
| result += passStruct8BytesIntx10_a9.a0; |
| result += passStruct8BytesIntx10_a9.a1; |
| result += passStruct8BytesIntx10_a9.a2; |
| |
| passStruct8BytesIntx10Result = result; |
| |
| return result; |
| } |
| |
| /// Exactly word size struct on 64bit architectures. |
| /// 10 struct arguments will exhaust available registers. |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct8BytesIntx10 throwing on purpuse!"); |
| } |
| |
| passStruct8BytesIntx10_a0 = a0; |
| passStruct8BytesIntx10_a1 = a1; |
| passStruct8BytesIntx10_a2 = a2; |
| passStruct8BytesIntx10_a3 = a3; |
| passStruct8BytesIntx10_a4 = a4; |
| passStruct8BytesIntx10_a5 = a5; |
| passStruct8BytesIntx10_a6 = a6; |
| passStruct8BytesIntx10_a7 = a7; |
| passStruct8BytesIntx10_a8 = a8; |
| passStruct8BytesIntx10_a9 = a9; |
| |
| final result = passStruct8BytesIntx10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct8BytesIntx10AfterCallback() { |
| final result = passStruct8BytesIntx10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(15, result); |
| } |
| |
| typedef PassStruct8BytesHomogeneousFloatx10Type = Float Function( |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat, |
| Struct8BytesHomogeneousFloat); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a0 = |
| Struct8BytesHomogeneousFloat(); |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a1 = |
| Struct8BytesHomogeneousFloat(); |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a2 = |
| Struct8BytesHomogeneousFloat(); |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a3 = |
| Struct8BytesHomogeneousFloat(); |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a4 = |
| Struct8BytesHomogeneousFloat(); |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a5 = |
| Struct8BytesHomogeneousFloat(); |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a6 = |
| Struct8BytesHomogeneousFloat(); |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a7 = |
| Struct8BytesHomogeneousFloat(); |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a8 = |
| Struct8BytesHomogeneousFloat(); |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a9 = |
| Struct8BytesHomogeneousFloat(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| double passStruct8BytesHomogeneousFloatx10Result = 0.0; |
| |
| double passStruct8BytesHomogeneousFloatx10CalculateResult() { |
| double result = 0; |
| |
| result += passStruct8BytesHomogeneousFloatx10_a0.a0; |
| result += passStruct8BytesHomogeneousFloatx10_a0.a1; |
| result += passStruct8BytesHomogeneousFloatx10_a1.a0; |
| result += passStruct8BytesHomogeneousFloatx10_a1.a1; |
| result += passStruct8BytesHomogeneousFloatx10_a2.a0; |
| result += passStruct8BytesHomogeneousFloatx10_a2.a1; |
| result += passStruct8BytesHomogeneousFloatx10_a3.a0; |
| result += passStruct8BytesHomogeneousFloatx10_a3.a1; |
| result += passStruct8BytesHomogeneousFloatx10_a4.a0; |
| result += passStruct8BytesHomogeneousFloatx10_a4.a1; |
| result += passStruct8BytesHomogeneousFloatx10_a5.a0; |
| result += passStruct8BytesHomogeneousFloatx10_a5.a1; |
| result += passStruct8BytesHomogeneousFloatx10_a6.a0; |
| result += passStruct8BytesHomogeneousFloatx10_a6.a1; |
| result += passStruct8BytesHomogeneousFloatx10_a7.a0; |
| result += passStruct8BytesHomogeneousFloatx10_a7.a1; |
| result += passStruct8BytesHomogeneousFloatx10_a8.a0; |
| result += passStruct8BytesHomogeneousFloatx10_a8.a1; |
| result += passStruct8BytesHomogeneousFloatx10_a9.a0; |
| result += passStruct8BytesHomogeneousFloatx10_a9.a1; |
| |
| passStruct8BytesHomogeneousFloatx10Result = result; |
| |
| return result; |
| } |
| |
| /// Arguments passed in FP registers as long as they fit. |
| /// 10 struct arguments will exhaust available registers. |
| double 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct8BytesHomogeneousFloatx10 throwing on purpuse!"); |
| } |
| |
| passStruct8BytesHomogeneousFloatx10_a0 = a0; |
| passStruct8BytesHomogeneousFloatx10_a1 = a1; |
| passStruct8BytesHomogeneousFloatx10_a2 = a2; |
| passStruct8BytesHomogeneousFloatx10_a3 = a3; |
| passStruct8BytesHomogeneousFloatx10_a4 = a4; |
| passStruct8BytesHomogeneousFloatx10_a5 = a5; |
| passStruct8BytesHomogeneousFloatx10_a6 = a6; |
| passStruct8BytesHomogeneousFloatx10_a7 = a7; |
| passStruct8BytesHomogeneousFloatx10_a8 = a8; |
| passStruct8BytesHomogeneousFloatx10_a9 = a9; |
| |
| final result = passStruct8BytesHomogeneousFloatx10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct8BytesHomogeneousFloatx10AfterCallback() { |
| final result = passStruct8BytesHomogeneousFloatx10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.approxEquals(10.0, result); |
| } |
| |
| typedef PassStruct8BytesMixedx10Type = Float Function( |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed, |
| Struct8BytesMixed); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct8BytesMixed passStruct8BytesMixedx10_a0 = Struct8BytesMixed(); |
| Struct8BytesMixed passStruct8BytesMixedx10_a1 = Struct8BytesMixed(); |
| Struct8BytesMixed passStruct8BytesMixedx10_a2 = Struct8BytesMixed(); |
| Struct8BytesMixed passStruct8BytesMixedx10_a3 = Struct8BytesMixed(); |
| Struct8BytesMixed passStruct8BytesMixedx10_a4 = Struct8BytesMixed(); |
| Struct8BytesMixed passStruct8BytesMixedx10_a5 = Struct8BytesMixed(); |
| Struct8BytesMixed passStruct8BytesMixedx10_a6 = Struct8BytesMixed(); |
| Struct8BytesMixed passStruct8BytesMixedx10_a7 = Struct8BytesMixed(); |
| Struct8BytesMixed passStruct8BytesMixedx10_a8 = Struct8BytesMixed(); |
| Struct8BytesMixed passStruct8BytesMixedx10_a9 = Struct8BytesMixed(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| double passStruct8BytesMixedx10Result = 0.0; |
| |
| double passStruct8BytesMixedx10CalculateResult() { |
| double result = 0; |
| |
| result += passStruct8BytesMixedx10_a0.a0; |
| result += passStruct8BytesMixedx10_a0.a1; |
| result += passStruct8BytesMixedx10_a0.a2; |
| result += passStruct8BytesMixedx10_a1.a0; |
| result += passStruct8BytesMixedx10_a1.a1; |
| result += passStruct8BytesMixedx10_a1.a2; |
| result += passStruct8BytesMixedx10_a2.a0; |
| result += passStruct8BytesMixedx10_a2.a1; |
| result += passStruct8BytesMixedx10_a2.a2; |
| result += passStruct8BytesMixedx10_a3.a0; |
| result += passStruct8BytesMixedx10_a3.a1; |
| result += passStruct8BytesMixedx10_a3.a2; |
| result += passStruct8BytesMixedx10_a4.a0; |
| result += passStruct8BytesMixedx10_a4.a1; |
| result += passStruct8BytesMixedx10_a4.a2; |
| result += passStruct8BytesMixedx10_a5.a0; |
| result += passStruct8BytesMixedx10_a5.a1; |
| result += passStruct8BytesMixedx10_a5.a2; |
| result += passStruct8BytesMixedx10_a6.a0; |
| result += passStruct8BytesMixedx10_a6.a1; |
| result += passStruct8BytesMixedx10_a6.a2; |
| result += passStruct8BytesMixedx10_a7.a0; |
| result += passStruct8BytesMixedx10_a7.a1; |
| result += passStruct8BytesMixedx10_a7.a2; |
| result += passStruct8BytesMixedx10_a8.a0; |
| result += passStruct8BytesMixedx10_a8.a1; |
| result += passStruct8BytesMixedx10_a8.a2; |
| result += passStruct8BytesMixedx10_a9.a0; |
| result += passStruct8BytesMixedx10_a9.a1; |
| result += passStruct8BytesMixedx10_a9.a2; |
| |
| passStruct8BytesMixedx10Result = result; |
| |
| return result; |
| } |
| |
| /// On x64, arguments go in int registers because it is not only float. |
| /// 10 struct arguments will exhaust available registers. |
| double 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct8BytesMixedx10 throwing on purpuse!"); |
| } |
| |
| passStruct8BytesMixedx10_a0 = a0; |
| passStruct8BytesMixedx10_a1 = a1; |
| passStruct8BytesMixedx10_a2 = a2; |
| passStruct8BytesMixedx10_a3 = a3; |
| passStruct8BytesMixedx10_a4 = a4; |
| passStruct8BytesMixedx10_a5 = a5; |
| passStruct8BytesMixedx10_a6 = a6; |
| passStruct8BytesMixedx10_a7 = a7; |
| passStruct8BytesMixedx10_a8 = a8; |
| passStruct8BytesMixedx10_a9 = a9; |
| |
| final result = passStruct8BytesMixedx10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct8BytesMixedx10AfterCallback() { |
| final result = passStruct8BytesMixedx10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.approxEquals(15.0, result); |
| } |
| |
| typedef PassStruct9BytesHomogeneousUint8x10Type = Int64 Function( |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8, |
| Struct9BytesHomogeneousUint8); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a0 = |
| Struct9BytesHomogeneousUint8(); |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a1 = |
| Struct9BytesHomogeneousUint8(); |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a2 = |
| Struct9BytesHomogeneousUint8(); |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a3 = |
| Struct9BytesHomogeneousUint8(); |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a4 = |
| Struct9BytesHomogeneousUint8(); |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a5 = |
| Struct9BytesHomogeneousUint8(); |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a6 = |
| Struct9BytesHomogeneousUint8(); |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a7 = |
| Struct9BytesHomogeneousUint8(); |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a8 = |
| Struct9BytesHomogeneousUint8(); |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a9 = |
| Struct9BytesHomogeneousUint8(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct9BytesHomogeneousUint8x10Result = 0; |
| |
| int passStruct9BytesHomogeneousUint8x10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct9BytesHomogeneousUint8x10_a0.a0; |
| result += passStruct9BytesHomogeneousUint8x10_a0.a1; |
| result += passStruct9BytesHomogeneousUint8x10_a0.a2; |
| result += passStruct9BytesHomogeneousUint8x10_a0.a3; |
| result += passStruct9BytesHomogeneousUint8x10_a0.a4; |
| result += passStruct9BytesHomogeneousUint8x10_a0.a5; |
| result += passStruct9BytesHomogeneousUint8x10_a0.a6; |
| result += passStruct9BytesHomogeneousUint8x10_a0.a7; |
| result += passStruct9BytesHomogeneousUint8x10_a0.a8; |
| result += passStruct9BytesHomogeneousUint8x10_a1.a0; |
| result += passStruct9BytesHomogeneousUint8x10_a1.a1; |
| result += passStruct9BytesHomogeneousUint8x10_a1.a2; |
| result += passStruct9BytesHomogeneousUint8x10_a1.a3; |
| result += passStruct9BytesHomogeneousUint8x10_a1.a4; |
| result += passStruct9BytesHomogeneousUint8x10_a1.a5; |
| result += passStruct9BytesHomogeneousUint8x10_a1.a6; |
| result += passStruct9BytesHomogeneousUint8x10_a1.a7; |
| result += passStruct9BytesHomogeneousUint8x10_a1.a8; |
| result += passStruct9BytesHomogeneousUint8x10_a2.a0; |
| result += passStruct9BytesHomogeneousUint8x10_a2.a1; |
| result += passStruct9BytesHomogeneousUint8x10_a2.a2; |
| result += passStruct9BytesHomogeneousUint8x10_a2.a3; |
| result += passStruct9BytesHomogeneousUint8x10_a2.a4; |
| result += passStruct9BytesHomogeneousUint8x10_a2.a5; |
| result += passStruct9BytesHomogeneousUint8x10_a2.a6; |
| result += passStruct9BytesHomogeneousUint8x10_a2.a7; |
| result += passStruct9BytesHomogeneousUint8x10_a2.a8; |
| result += passStruct9BytesHomogeneousUint8x10_a3.a0; |
| result += passStruct9BytesHomogeneousUint8x10_a3.a1; |
| result += passStruct9BytesHomogeneousUint8x10_a3.a2; |
| result += passStruct9BytesHomogeneousUint8x10_a3.a3; |
| result += passStruct9BytesHomogeneousUint8x10_a3.a4; |
| result += passStruct9BytesHomogeneousUint8x10_a3.a5; |
| result += passStruct9BytesHomogeneousUint8x10_a3.a6; |
| result += passStruct9BytesHomogeneousUint8x10_a3.a7; |
| result += passStruct9BytesHomogeneousUint8x10_a3.a8; |
| result += passStruct9BytesHomogeneousUint8x10_a4.a0; |
| result += passStruct9BytesHomogeneousUint8x10_a4.a1; |
| result += passStruct9BytesHomogeneousUint8x10_a4.a2; |
| result += passStruct9BytesHomogeneousUint8x10_a4.a3; |
| result += passStruct9BytesHomogeneousUint8x10_a4.a4; |
| result += passStruct9BytesHomogeneousUint8x10_a4.a5; |
| result += passStruct9BytesHomogeneousUint8x10_a4.a6; |
| result += passStruct9BytesHomogeneousUint8x10_a4.a7; |
| result += passStruct9BytesHomogeneousUint8x10_a4.a8; |
| result += passStruct9BytesHomogeneousUint8x10_a5.a0; |
| result += passStruct9BytesHomogeneousUint8x10_a5.a1; |
| result += passStruct9BytesHomogeneousUint8x10_a5.a2; |
| result += passStruct9BytesHomogeneousUint8x10_a5.a3; |
| result += passStruct9BytesHomogeneousUint8x10_a5.a4; |
| result += passStruct9BytesHomogeneousUint8x10_a5.a5; |
| result += passStruct9BytesHomogeneousUint8x10_a5.a6; |
| result += passStruct9BytesHomogeneousUint8x10_a5.a7; |
| result += passStruct9BytesHomogeneousUint8x10_a5.a8; |
| result += passStruct9BytesHomogeneousUint8x10_a6.a0; |
| result += passStruct9BytesHomogeneousUint8x10_a6.a1; |
| result += passStruct9BytesHomogeneousUint8x10_a6.a2; |
| result += passStruct9BytesHomogeneousUint8x10_a6.a3; |
| result += passStruct9BytesHomogeneousUint8x10_a6.a4; |
| result += passStruct9BytesHomogeneousUint8x10_a6.a5; |
| result += passStruct9BytesHomogeneousUint8x10_a6.a6; |
| result += passStruct9BytesHomogeneousUint8x10_a6.a7; |
| result += passStruct9BytesHomogeneousUint8x10_a6.a8; |
| result += passStruct9BytesHomogeneousUint8x10_a7.a0; |
| result += passStruct9BytesHomogeneousUint8x10_a7.a1; |
| result += passStruct9BytesHomogeneousUint8x10_a7.a2; |
| result += passStruct9BytesHomogeneousUint8x10_a7.a3; |
| result += passStruct9BytesHomogeneousUint8x10_a7.a4; |
| result += passStruct9BytesHomogeneousUint8x10_a7.a5; |
| result += passStruct9BytesHomogeneousUint8x10_a7.a6; |
| result += passStruct9BytesHomogeneousUint8x10_a7.a7; |
| result += passStruct9BytesHomogeneousUint8x10_a7.a8; |
| result += passStruct9BytesHomogeneousUint8x10_a8.a0; |
| result += passStruct9BytesHomogeneousUint8x10_a8.a1; |
| result += passStruct9BytesHomogeneousUint8x10_a8.a2; |
| result += passStruct9BytesHomogeneousUint8x10_a8.a3; |
| result += passStruct9BytesHomogeneousUint8x10_a8.a4; |
| result += passStruct9BytesHomogeneousUint8x10_a8.a5; |
| result += passStruct9BytesHomogeneousUint8x10_a8.a6; |
| result += passStruct9BytesHomogeneousUint8x10_a8.a7; |
| result += passStruct9BytesHomogeneousUint8x10_a8.a8; |
| result += passStruct9BytesHomogeneousUint8x10_a9.a0; |
| result += passStruct9BytesHomogeneousUint8x10_a9.a1; |
| result += passStruct9BytesHomogeneousUint8x10_a9.a2; |
| result += passStruct9BytesHomogeneousUint8x10_a9.a3; |
| result += passStruct9BytesHomogeneousUint8x10_a9.a4; |
| result += passStruct9BytesHomogeneousUint8x10_a9.a5; |
| result += passStruct9BytesHomogeneousUint8x10_a9.a6; |
| result += passStruct9BytesHomogeneousUint8x10_a9.a7; |
| result += passStruct9BytesHomogeneousUint8x10_a9.a8; |
| |
| passStruct9BytesHomogeneousUint8x10Result = result; |
| |
| return result; |
| } |
| |
| /// 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. |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct9BytesHomogeneousUint8x10 throwing on purpuse!"); |
| } |
| |
| passStruct9BytesHomogeneousUint8x10_a0 = a0; |
| passStruct9BytesHomogeneousUint8x10_a1 = a1; |
| passStruct9BytesHomogeneousUint8x10_a2 = a2; |
| passStruct9BytesHomogeneousUint8x10_a3 = a3; |
| passStruct9BytesHomogeneousUint8x10_a4 = a4; |
| passStruct9BytesHomogeneousUint8x10_a5 = a5; |
| passStruct9BytesHomogeneousUint8x10_a6 = a6; |
| passStruct9BytesHomogeneousUint8x10_a7 = a7; |
| passStruct9BytesHomogeneousUint8x10_a8 = a8; |
| passStruct9BytesHomogeneousUint8x10_a9 = a9; |
| |
| final result = passStruct9BytesHomogeneousUint8x10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct9BytesHomogeneousUint8x10AfterCallback() { |
| final result = passStruct9BytesHomogeneousUint8x10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(4095, result); |
| } |
| |
| typedef PassStruct9BytesInt4Or8ByteAlignedx10Type = Int64 Function( |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned, |
| Struct9BytesInt4Or8ByteAligned); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a0 = |
| Struct9BytesInt4Or8ByteAligned(); |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a1 = |
| Struct9BytesInt4Or8ByteAligned(); |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a2 = |
| Struct9BytesInt4Or8ByteAligned(); |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a3 = |
| Struct9BytesInt4Or8ByteAligned(); |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a4 = |
| Struct9BytesInt4Or8ByteAligned(); |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a5 = |
| Struct9BytesInt4Or8ByteAligned(); |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a6 = |
| Struct9BytesInt4Or8ByteAligned(); |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a7 = |
| Struct9BytesInt4Or8ByteAligned(); |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a8 = |
| Struct9BytesInt4Or8ByteAligned(); |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a9 = |
| Struct9BytesInt4Or8ByteAligned(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct9BytesInt4Or8ByteAlignedx10Result = 0; |
| |
| int passStruct9BytesInt4Or8ByteAlignedx10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a0.a0; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a0.a1; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a1.a0; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a1.a1; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a2.a0; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a2.a1; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a3.a0; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a3.a1; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a4.a0; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a4.a1; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a5.a0; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a5.a1; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a6.a0; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a6.a1; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a7.a0; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a7.a1; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a8.a0; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a8.a1; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a9.a0; |
| result += passStruct9BytesInt4Or8ByteAlignedx10_a9.a1; |
| |
| passStruct9BytesInt4Or8ByteAlignedx10Result = result; |
| |
| return result; |
| } |
| |
| /// 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. |
| /// |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception( |
| "PassStruct9BytesInt4Or8ByteAlignedx10 throwing on purpuse!"); |
| } |
| |
| passStruct9BytesInt4Or8ByteAlignedx10_a0 = a0; |
| passStruct9BytesInt4Or8ByteAlignedx10_a1 = a1; |
| passStruct9BytesInt4Or8ByteAlignedx10_a2 = a2; |
| passStruct9BytesInt4Or8ByteAlignedx10_a3 = a3; |
| passStruct9BytesInt4Or8ByteAlignedx10_a4 = a4; |
| passStruct9BytesInt4Or8ByteAlignedx10_a5 = a5; |
| passStruct9BytesInt4Or8ByteAlignedx10_a6 = a6; |
| passStruct9BytesInt4Or8ByteAlignedx10_a7 = a7; |
| passStruct9BytesInt4Or8ByteAlignedx10_a8 = a8; |
| passStruct9BytesInt4Or8ByteAlignedx10_a9 = a9; |
| |
| final result = passStruct9BytesInt4Or8ByteAlignedx10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct9BytesInt4Or8ByteAlignedx10AfterCallback() { |
| final result = passStruct9BytesInt4Or8ByteAlignedx10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(10, result); |
| } |
| |
| typedef PassStruct12BytesHomogeneousFloatx6Type = Float Function( |
| Struct12BytesHomogeneousFloat, |
| Struct12BytesHomogeneousFloat, |
| Struct12BytesHomogeneousFloat, |
| Struct12BytesHomogeneousFloat, |
| Struct12BytesHomogeneousFloat, |
| Struct12BytesHomogeneousFloat); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a0 = |
| Struct12BytesHomogeneousFloat(); |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a1 = |
| Struct12BytesHomogeneousFloat(); |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a2 = |
| Struct12BytesHomogeneousFloat(); |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a3 = |
| Struct12BytesHomogeneousFloat(); |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a4 = |
| Struct12BytesHomogeneousFloat(); |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a5 = |
| Struct12BytesHomogeneousFloat(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| double passStruct12BytesHomogeneousFloatx6Result = 0.0; |
| |
| double passStruct12BytesHomogeneousFloatx6CalculateResult() { |
| double result = 0; |
| |
| result += passStruct12BytesHomogeneousFloatx6_a0.a0; |
| result += passStruct12BytesHomogeneousFloatx6_a0.a1; |
| result += passStruct12BytesHomogeneousFloatx6_a0.a2; |
| result += passStruct12BytesHomogeneousFloatx6_a1.a0; |
| result += passStruct12BytesHomogeneousFloatx6_a1.a1; |
| result += passStruct12BytesHomogeneousFloatx6_a1.a2; |
| result += passStruct12BytesHomogeneousFloatx6_a2.a0; |
| result += passStruct12BytesHomogeneousFloatx6_a2.a1; |
| result += passStruct12BytesHomogeneousFloatx6_a2.a2; |
| result += passStruct12BytesHomogeneousFloatx6_a3.a0; |
| result += passStruct12BytesHomogeneousFloatx6_a3.a1; |
| result += passStruct12BytesHomogeneousFloatx6_a3.a2; |
| result += passStruct12BytesHomogeneousFloatx6_a4.a0; |
| result += passStruct12BytesHomogeneousFloatx6_a4.a1; |
| result += passStruct12BytesHomogeneousFloatx6_a4.a2; |
| result += passStruct12BytesHomogeneousFloatx6_a5.a0; |
| result += passStruct12BytesHomogeneousFloatx6_a5.a1; |
| result += passStruct12BytesHomogeneousFloatx6_a5.a2; |
| |
| passStruct12BytesHomogeneousFloatx6Result = result; |
| |
| return result; |
| } |
| |
| /// 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. |
| double passStruct12BytesHomogeneousFloatx6( |
| Struct12BytesHomogeneousFloat a0, |
| Struct12BytesHomogeneousFloat a1, |
| Struct12BytesHomogeneousFloat a2, |
| Struct12BytesHomogeneousFloat a3, |
| Struct12BytesHomogeneousFloat a4, |
| Struct12BytesHomogeneousFloat a5) { |
| print( |
| "passStruct12BytesHomogeneousFloatx6(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct12BytesHomogeneousFloatx6 throwing on purpuse!"); |
| } |
| |
| passStruct12BytesHomogeneousFloatx6_a0 = a0; |
| passStruct12BytesHomogeneousFloatx6_a1 = a1; |
| passStruct12BytesHomogeneousFloatx6_a2 = a2; |
| passStruct12BytesHomogeneousFloatx6_a3 = a3; |
| passStruct12BytesHomogeneousFloatx6_a4 = a4; |
| passStruct12BytesHomogeneousFloatx6_a5 = a5; |
| |
| final result = passStruct12BytesHomogeneousFloatx6CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct12BytesHomogeneousFloatx6AfterCallback() { |
| final result = passStruct12BytesHomogeneousFloatx6CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.approxEquals(9.0, result); |
| } |
| |
| typedef PassStruct16BytesHomogeneousFloatx5Type = Float Function( |
| Struct16BytesHomogeneousFloat, |
| Struct16BytesHomogeneousFloat, |
| Struct16BytesHomogeneousFloat, |
| Struct16BytesHomogeneousFloat, |
| Struct16BytesHomogeneousFloat); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct16BytesHomogeneousFloat passStruct16BytesHomogeneousFloatx5_a0 = |
| Struct16BytesHomogeneousFloat(); |
| Struct16BytesHomogeneousFloat passStruct16BytesHomogeneousFloatx5_a1 = |
| Struct16BytesHomogeneousFloat(); |
| Struct16BytesHomogeneousFloat passStruct16BytesHomogeneousFloatx5_a2 = |
| Struct16BytesHomogeneousFloat(); |
| Struct16BytesHomogeneousFloat passStruct16BytesHomogeneousFloatx5_a3 = |
| Struct16BytesHomogeneousFloat(); |
| Struct16BytesHomogeneousFloat passStruct16BytesHomogeneousFloatx5_a4 = |
| Struct16BytesHomogeneousFloat(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| double passStruct16BytesHomogeneousFloatx5Result = 0.0; |
| |
| double passStruct16BytesHomogeneousFloatx5CalculateResult() { |
| double result = 0; |
| |
| result += passStruct16BytesHomogeneousFloatx5_a0.a0; |
| result += passStruct16BytesHomogeneousFloatx5_a0.a1; |
| result += passStruct16BytesHomogeneousFloatx5_a0.a2; |
| result += passStruct16BytesHomogeneousFloatx5_a0.a3; |
| result += passStruct16BytesHomogeneousFloatx5_a1.a0; |
| result += passStruct16BytesHomogeneousFloatx5_a1.a1; |
| result += passStruct16BytesHomogeneousFloatx5_a1.a2; |
| result += passStruct16BytesHomogeneousFloatx5_a1.a3; |
| result += passStruct16BytesHomogeneousFloatx5_a2.a0; |
| result += passStruct16BytesHomogeneousFloatx5_a2.a1; |
| result += passStruct16BytesHomogeneousFloatx5_a2.a2; |
| result += passStruct16BytesHomogeneousFloatx5_a2.a3; |
| result += passStruct16BytesHomogeneousFloatx5_a3.a0; |
| result += passStruct16BytesHomogeneousFloatx5_a3.a1; |
| result += passStruct16BytesHomogeneousFloatx5_a3.a2; |
| result += passStruct16BytesHomogeneousFloatx5_a3.a3; |
| result += passStruct16BytesHomogeneousFloatx5_a4.a0; |
| result += passStruct16BytesHomogeneousFloatx5_a4.a1; |
| result += passStruct16BytesHomogeneousFloatx5_a4.a2; |
| result += passStruct16BytesHomogeneousFloatx5_a4.a3; |
| |
| passStruct16BytesHomogeneousFloatx5Result = result; |
| |
| return result; |
| } |
| |
| /// 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. |
| double passStruct16BytesHomogeneousFloatx5( |
| Struct16BytesHomogeneousFloat a0, |
| Struct16BytesHomogeneousFloat a1, |
| Struct16BytesHomogeneousFloat a2, |
| Struct16BytesHomogeneousFloat a3, |
| Struct16BytesHomogeneousFloat a4) { |
| print( |
| "passStruct16BytesHomogeneousFloatx5(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct16BytesHomogeneousFloatx5 throwing on purpuse!"); |
| } |
| |
| passStruct16BytesHomogeneousFloatx5_a0 = a0; |
| passStruct16BytesHomogeneousFloatx5_a1 = a1; |
| passStruct16BytesHomogeneousFloatx5_a2 = a2; |
| passStruct16BytesHomogeneousFloatx5_a3 = a3; |
| passStruct16BytesHomogeneousFloatx5_a4 = a4; |
| |
| final result = passStruct16BytesHomogeneousFloatx5CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct16BytesHomogeneousFloatx5AfterCallback() { |
| final result = passStruct16BytesHomogeneousFloatx5CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.approxEquals(10.0, result); |
| } |
| |
| typedef PassStruct16BytesMixedx10Type = Double Function( |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed, |
| Struct16BytesMixed); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct16BytesMixed passStruct16BytesMixedx10_a0 = Struct16BytesMixed(); |
| Struct16BytesMixed passStruct16BytesMixedx10_a1 = Struct16BytesMixed(); |
| Struct16BytesMixed passStruct16BytesMixedx10_a2 = Struct16BytesMixed(); |
| Struct16BytesMixed passStruct16BytesMixedx10_a3 = Struct16BytesMixed(); |
| Struct16BytesMixed passStruct16BytesMixedx10_a4 = Struct16BytesMixed(); |
| Struct16BytesMixed passStruct16BytesMixedx10_a5 = Struct16BytesMixed(); |
| Struct16BytesMixed passStruct16BytesMixedx10_a6 = Struct16BytesMixed(); |
| Struct16BytesMixed passStruct16BytesMixedx10_a7 = Struct16BytesMixed(); |
| Struct16BytesMixed passStruct16BytesMixedx10_a8 = Struct16BytesMixed(); |
| Struct16BytesMixed passStruct16BytesMixedx10_a9 = Struct16BytesMixed(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| double passStruct16BytesMixedx10Result = 0.0; |
| |
| double passStruct16BytesMixedx10CalculateResult() { |
| double result = 0; |
| |
| result += passStruct16BytesMixedx10_a0.a0; |
| result += passStruct16BytesMixedx10_a0.a1; |
| result += passStruct16BytesMixedx10_a1.a0; |
| result += passStruct16BytesMixedx10_a1.a1; |
| result += passStruct16BytesMixedx10_a2.a0; |
| result += passStruct16BytesMixedx10_a2.a1; |
| result += passStruct16BytesMixedx10_a3.a0; |
| result += passStruct16BytesMixedx10_a3.a1; |
| result += passStruct16BytesMixedx10_a4.a0; |
| result += passStruct16BytesMixedx10_a4.a1; |
| result += passStruct16BytesMixedx10_a5.a0; |
| result += passStruct16BytesMixedx10_a5.a1; |
| result += passStruct16BytesMixedx10_a6.a0; |
| result += passStruct16BytesMixedx10_a6.a1; |
| result += passStruct16BytesMixedx10_a7.a0; |
| result += passStruct16BytesMixedx10_a7.a1; |
| result += passStruct16BytesMixedx10_a8.a0; |
| result += passStruct16BytesMixedx10_a8.a1; |
| result += passStruct16BytesMixedx10_a9.a0; |
| result += passStruct16BytesMixedx10_a9.a1; |
| |
| passStruct16BytesMixedx10Result = result; |
| |
| return result; |
| } |
| |
| /// 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. |
| double 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct16BytesMixedx10 throwing on purpuse!"); |
| } |
| |
| passStruct16BytesMixedx10_a0 = a0; |
| passStruct16BytesMixedx10_a1 = a1; |
| passStruct16BytesMixedx10_a2 = a2; |
| passStruct16BytesMixedx10_a3 = a3; |
| passStruct16BytesMixedx10_a4 = a4; |
| passStruct16BytesMixedx10_a5 = a5; |
| passStruct16BytesMixedx10_a6 = a6; |
| passStruct16BytesMixedx10_a7 = a7; |
| passStruct16BytesMixedx10_a8 = a8; |
| passStruct16BytesMixedx10_a9 = a9; |
| |
| final result = passStruct16BytesMixedx10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct16BytesMixedx10AfterCallback() { |
| final result = passStruct16BytesMixedx10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.approxEquals(10.0, result); |
| } |
| |
| typedef PassStruct16BytesMixed2x10Type = Float Function( |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2, |
| Struct16BytesMixed2); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a0 = Struct16BytesMixed2(); |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a1 = Struct16BytesMixed2(); |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a2 = Struct16BytesMixed2(); |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a3 = Struct16BytesMixed2(); |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a4 = Struct16BytesMixed2(); |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a5 = Struct16BytesMixed2(); |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a6 = Struct16BytesMixed2(); |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a7 = Struct16BytesMixed2(); |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a8 = Struct16BytesMixed2(); |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a9 = Struct16BytesMixed2(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| double passStruct16BytesMixed2x10Result = 0.0; |
| |
| double passStruct16BytesMixed2x10CalculateResult() { |
| double result = 0; |
| |
| result += passStruct16BytesMixed2x10_a0.a0; |
| result += passStruct16BytesMixed2x10_a0.a1; |
| result += passStruct16BytesMixed2x10_a0.a2; |
| result += passStruct16BytesMixed2x10_a0.a3; |
| result += passStruct16BytesMixed2x10_a1.a0; |
| result += passStruct16BytesMixed2x10_a1.a1; |
| result += passStruct16BytesMixed2x10_a1.a2; |
| result += passStruct16BytesMixed2x10_a1.a3; |
| result += passStruct16BytesMixed2x10_a2.a0; |
| result += passStruct16BytesMixed2x10_a2.a1; |
| result += passStruct16BytesMixed2x10_a2.a2; |
| result += passStruct16BytesMixed2x10_a2.a3; |
| result += passStruct16BytesMixed2x10_a3.a0; |
| result += passStruct16BytesMixed2x10_a3.a1; |
| result += passStruct16BytesMixed2x10_a3.a2; |
| result += passStruct16BytesMixed2x10_a3.a3; |
| result += passStruct16BytesMixed2x10_a4.a0; |
| result += passStruct16BytesMixed2x10_a4.a1; |
| result += passStruct16BytesMixed2x10_a4.a2; |
| result += passStruct16BytesMixed2x10_a4.a3; |
| result += passStruct16BytesMixed2x10_a5.a0; |
| result += passStruct16BytesMixed2x10_a5.a1; |
| result += passStruct16BytesMixed2x10_a5.a2; |
| result += passStruct16BytesMixed2x10_a5.a3; |
| result += passStruct16BytesMixed2x10_a6.a0; |
| result += passStruct16BytesMixed2x10_a6.a1; |
| result += passStruct16BytesMixed2x10_a6.a2; |
| result += passStruct16BytesMixed2x10_a6.a3; |
| result += passStruct16BytesMixed2x10_a7.a0; |
| result += passStruct16BytesMixed2x10_a7.a1; |
| result += passStruct16BytesMixed2x10_a7.a2; |
| result += passStruct16BytesMixed2x10_a7.a3; |
| result += passStruct16BytesMixed2x10_a8.a0; |
| result += passStruct16BytesMixed2x10_a8.a1; |
| result += passStruct16BytesMixed2x10_a8.a2; |
| result += passStruct16BytesMixed2x10_a8.a3; |
| result += passStruct16BytesMixed2x10_a9.a0; |
| result += passStruct16BytesMixed2x10_a9.a1; |
| result += passStruct16BytesMixed2x10_a9.a2; |
| result += passStruct16BytesMixed2x10_a9.a3; |
| |
| passStruct16BytesMixed2x10Result = result; |
| |
| return result; |
| } |
| |
| /// 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. |
| double 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct16BytesMixed2x10 throwing on purpuse!"); |
| } |
| |
| passStruct16BytesMixed2x10_a0 = a0; |
| passStruct16BytesMixed2x10_a1 = a1; |
| passStruct16BytesMixed2x10_a2 = a2; |
| passStruct16BytesMixed2x10_a3 = a3; |
| passStruct16BytesMixed2x10_a4 = a4; |
| passStruct16BytesMixed2x10_a5 = a5; |
| passStruct16BytesMixed2x10_a6 = a6; |
| passStruct16BytesMixed2x10_a7 = a7; |
| passStruct16BytesMixed2x10_a8 = a8; |
| passStruct16BytesMixed2x10_a9 = a9; |
| |
| final result = passStruct16BytesMixed2x10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct16BytesMixed2x10AfterCallback() { |
| final result = passStruct16BytesMixed2x10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.approxEquals(20.0, result); |
| } |
| |
| typedef PassStruct17BytesIntx10Type = Int64 Function( |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt, |
| Struct17BytesInt); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct17BytesInt passStruct17BytesIntx10_a0 = Struct17BytesInt(); |
| Struct17BytesInt passStruct17BytesIntx10_a1 = Struct17BytesInt(); |
| Struct17BytesInt passStruct17BytesIntx10_a2 = Struct17BytesInt(); |
| Struct17BytesInt passStruct17BytesIntx10_a3 = Struct17BytesInt(); |
| Struct17BytesInt passStruct17BytesIntx10_a4 = Struct17BytesInt(); |
| Struct17BytesInt passStruct17BytesIntx10_a5 = Struct17BytesInt(); |
| Struct17BytesInt passStruct17BytesIntx10_a6 = Struct17BytesInt(); |
| Struct17BytesInt passStruct17BytesIntx10_a7 = Struct17BytesInt(); |
| Struct17BytesInt passStruct17BytesIntx10_a8 = Struct17BytesInt(); |
| Struct17BytesInt passStruct17BytesIntx10_a9 = Struct17BytesInt(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct17BytesIntx10Result = 0; |
| |
| int passStruct17BytesIntx10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct17BytesIntx10_a0.a0; |
| result += passStruct17BytesIntx10_a0.a1; |
| result += passStruct17BytesIntx10_a0.a2; |
| result += passStruct17BytesIntx10_a1.a0; |
| result += passStruct17BytesIntx10_a1.a1; |
| result += passStruct17BytesIntx10_a1.a2; |
| result += passStruct17BytesIntx10_a2.a0; |
| result += passStruct17BytesIntx10_a2.a1; |
| result += passStruct17BytesIntx10_a2.a2; |
| result += passStruct17BytesIntx10_a3.a0; |
| result += passStruct17BytesIntx10_a3.a1; |
| result += passStruct17BytesIntx10_a3.a2; |
| result += passStruct17BytesIntx10_a4.a0; |
| result += passStruct17BytesIntx10_a4.a1; |
| result += passStruct17BytesIntx10_a4.a2; |
| result += passStruct17BytesIntx10_a5.a0; |
| result += passStruct17BytesIntx10_a5.a1; |
| result += passStruct17BytesIntx10_a5.a2; |
| result += passStruct17BytesIntx10_a6.a0; |
| result += passStruct17BytesIntx10_a6.a1; |
| result += passStruct17BytesIntx10_a6.a2; |
| result += passStruct17BytesIntx10_a7.a0; |
| result += passStruct17BytesIntx10_a7.a1; |
| result += passStruct17BytesIntx10_a7.a2; |
| result += passStruct17BytesIntx10_a8.a0; |
| result += passStruct17BytesIntx10_a8.a1; |
| result += passStruct17BytesIntx10_a8.a2; |
| result += passStruct17BytesIntx10_a9.a0; |
| result += passStruct17BytesIntx10_a9.a1; |
| result += passStruct17BytesIntx10_a9.a2; |
| |
| passStruct17BytesIntx10Result = result; |
| |
| return result; |
| } |
| |
| /// Arguments are passed as pointer to copy on arm64. |
| /// Tests that the memory allocated for copies are rounded up to word size. |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct17BytesIntx10 throwing on purpuse!"); |
| } |
| |
| passStruct17BytesIntx10_a0 = a0; |
| passStruct17BytesIntx10_a1 = a1; |
| passStruct17BytesIntx10_a2 = a2; |
| passStruct17BytesIntx10_a3 = a3; |
| passStruct17BytesIntx10_a4 = a4; |
| passStruct17BytesIntx10_a5 = a5; |
| passStruct17BytesIntx10_a6 = a6; |
| passStruct17BytesIntx10_a7 = a7; |
| passStruct17BytesIntx10_a8 = a8; |
| passStruct17BytesIntx10_a9 = a9; |
| |
| final result = passStruct17BytesIntx10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct17BytesIntx10AfterCallback() { |
| final result = passStruct17BytesIntx10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(15, result); |
| } |
| |
| typedef PassStruct19BytesHomogeneousUint8x10Type = Int64 Function( |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8, |
| Struct19BytesHomogeneousUint8); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a0 = |
| Struct19BytesHomogeneousUint8(); |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a1 = |
| Struct19BytesHomogeneousUint8(); |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a2 = |
| Struct19BytesHomogeneousUint8(); |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a3 = |
| Struct19BytesHomogeneousUint8(); |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a4 = |
| Struct19BytesHomogeneousUint8(); |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a5 = |
| Struct19BytesHomogeneousUint8(); |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a6 = |
| Struct19BytesHomogeneousUint8(); |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a7 = |
| Struct19BytesHomogeneousUint8(); |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a8 = |
| Struct19BytesHomogeneousUint8(); |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a9 = |
| Struct19BytesHomogeneousUint8(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct19BytesHomogeneousUint8x10Result = 0; |
| |
| int passStruct19BytesHomogeneousUint8x10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct19BytesHomogeneousUint8x10_a0.a0; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a1; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a2; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a3; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a4; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a5; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a6; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a7; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a8; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a9; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a10; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a11; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a12; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a13; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a14; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a15; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a16; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a17; |
| result += passStruct19BytesHomogeneousUint8x10_a0.a18; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a0; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a1; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a2; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a3; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a4; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a5; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a6; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a7; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a8; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a9; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a10; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a11; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a12; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a13; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a14; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a15; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a16; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a17; |
| result += passStruct19BytesHomogeneousUint8x10_a1.a18; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a0; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a1; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a2; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a3; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a4; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a5; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a6; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a7; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a8; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a9; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a10; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a11; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a12; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a13; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a14; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a15; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a16; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a17; |
| result += passStruct19BytesHomogeneousUint8x10_a2.a18; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a0; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a1; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a2; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a3; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a4; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a5; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a6; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a7; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a8; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a9; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a10; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a11; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a12; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a13; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a14; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a15; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a16; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a17; |
| result += passStruct19BytesHomogeneousUint8x10_a3.a18; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a0; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a1; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a2; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a3; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a4; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a5; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a6; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a7; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a8; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a9; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a10; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a11; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a12; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a13; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a14; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a15; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a16; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a17; |
| result += passStruct19BytesHomogeneousUint8x10_a4.a18; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a0; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a1; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a2; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a3; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a4; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a5; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a6; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a7; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a8; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a9; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a10; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a11; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a12; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a13; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a14; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a15; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a16; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a17; |
| result += passStruct19BytesHomogeneousUint8x10_a5.a18; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a0; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a1; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a2; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a3; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a4; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a5; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a6; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a7; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a8; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a9; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a10; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a11; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a12; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a13; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a14; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a15; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a16; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a17; |
| result += passStruct19BytesHomogeneousUint8x10_a6.a18; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a0; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a1; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a2; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a3; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a4; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a5; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a6; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a7; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a8; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a9; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a10; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a11; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a12; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a13; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a14; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a15; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a16; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a17; |
| result += passStruct19BytesHomogeneousUint8x10_a7.a18; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a0; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a1; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a2; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a3; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a4; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a5; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a6; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a7; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a8; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a9; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a10; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a11; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a12; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a13; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a14; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a15; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a16; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a17; |
| result += passStruct19BytesHomogeneousUint8x10_a8.a18; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a0; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a1; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a2; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a3; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a4; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a5; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a6; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a7; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a8; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a9; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a10; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a11; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a12; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a13; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a14; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a15; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a16; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a17; |
| result += passStruct19BytesHomogeneousUint8x10_a9.a18; |
| |
| passStruct19BytesHomogeneousUint8x10Result = result; |
| |
| return result; |
| } |
| |
| /// 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. |
| /// |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception( |
| "PassStruct19BytesHomogeneousUint8x10 throwing on purpuse!"); |
| } |
| |
| passStruct19BytesHomogeneousUint8x10_a0 = a0; |
| passStruct19BytesHomogeneousUint8x10_a1 = a1; |
| passStruct19BytesHomogeneousUint8x10_a2 = a2; |
| passStruct19BytesHomogeneousUint8x10_a3 = a3; |
| passStruct19BytesHomogeneousUint8x10_a4 = a4; |
| passStruct19BytesHomogeneousUint8x10_a5 = a5; |
| passStruct19BytesHomogeneousUint8x10_a6 = a6; |
| passStruct19BytesHomogeneousUint8x10_a7 = a7; |
| passStruct19BytesHomogeneousUint8x10_a8 = a8; |
| passStruct19BytesHomogeneousUint8x10_a9 = a9; |
| |
| final result = passStruct19BytesHomogeneousUint8x10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct19BytesHomogeneousUint8x10AfterCallback() { |
| final result = passStruct19BytesHomogeneousUint8x10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(18145, result); |
| } |
| |
| typedef PassStruct20BytesHomogeneousInt32x10Type = Int32 Function( |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32, |
| Struct20BytesHomogeneousInt32); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a0 = |
| Struct20BytesHomogeneousInt32(); |
| Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a1 = |
| Struct20BytesHomogeneousInt32(); |
| Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a2 = |
| Struct20BytesHomogeneousInt32(); |
| Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a3 = |
| Struct20BytesHomogeneousInt32(); |
| Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a4 = |
| Struct20BytesHomogeneousInt32(); |
| Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a5 = |
| Struct20BytesHomogeneousInt32(); |
| Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a6 = |
| Struct20BytesHomogeneousInt32(); |
| Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a7 = |
| Struct20BytesHomogeneousInt32(); |
| Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a8 = |
| Struct20BytesHomogeneousInt32(); |
| Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a9 = |
| Struct20BytesHomogeneousInt32(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct20BytesHomogeneousInt32x10Result = 0; |
| |
| int passStruct20BytesHomogeneousInt32x10CalculateResult() { |
| int result = 0; |
| |
| result += passStruct20BytesHomogeneousInt32x10_a0.a0; |
| result += passStruct20BytesHomogeneousInt32x10_a0.a1; |
| result += passStruct20BytesHomogeneousInt32x10_a0.a2; |
| result += passStruct20BytesHomogeneousInt32x10_a0.a3; |
| result += passStruct20BytesHomogeneousInt32x10_a0.a4; |
| result += passStruct20BytesHomogeneousInt32x10_a1.a0; |
| result += passStruct20BytesHomogeneousInt32x10_a1.a1; |
| result += passStruct20BytesHomogeneousInt32x10_a1.a2; |
| result += passStruct20BytesHomogeneousInt32x10_a1.a3; |
| result += passStruct20BytesHomogeneousInt32x10_a1.a4; |
| result += passStruct20BytesHomogeneousInt32x10_a2.a0; |
| result += passStruct20BytesHomogeneousInt32x10_a2.a1; |
| result += passStruct20BytesHomogeneousInt32x10_a2.a2; |
| result += passStruct20BytesHomogeneousInt32x10_a2.a3; |
| result += passStruct20BytesHomogeneousInt32x10_a2.a4; |
| result += passStruct20BytesHomogeneousInt32x10_a3.a0; |
| result += passStruct20BytesHomogeneousInt32x10_a3.a1; |
| result += passStruct20BytesHomogeneousInt32x10_a3.a2; |
| result += passStruct20BytesHomogeneousInt32x10_a3.a3; |
| result += passStruct20BytesHomogeneousInt32x10_a3.a4; |
| result += passStruct20BytesHomogeneousInt32x10_a4.a0; |
| result += passStruct20BytesHomogeneousInt32x10_a4.a1; |
| result += passStruct20BytesHomogeneousInt32x10_a4.a2; |
| result += passStruct20BytesHomogeneousInt32x10_a4.a3; |
| result += passStruct20BytesHomogeneousInt32x10_a4.a4; |
| result += passStruct20BytesHomogeneousInt32x10_a5.a0; |
| result += passStruct20BytesHomogeneousInt32x10_a5.a1; |
| result += passStruct20BytesHomogeneousInt32x10_a5.a2; |
| result += passStruct20BytesHomogeneousInt32x10_a5.a3; |
| result += passStruct20BytesHomogeneousInt32x10_a5.a4; |
| result += passStruct20BytesHomogeneousInt32x10_a6.a0; |
| result += passStruct20BytesHomogeneousInt32x10_a6.a1; |
| result += passStruct20BytesHomogeneousInt32x10_a6.a2; |
| result += passStruct20BytesHomogeneousInt32x10_a6.a3; |
| result += passStruct20BytesHomogeneousInt32x10_a6.a4; |
| result += passStruct20BytesHomogeneousInt32x10_a7.a0; |
| result += passStruct20BytesHomogeneousInt32x10_a7.a1; |
| result += passStruct20BytesHomogeneousInt32x10_a7.a2; |
| result += passStruct20BytesHomogeneousInt32x10_a7.a3; |
| result += passStruct20BytesHomogeneousInt32x10_a7.a4; |
| result += passStruct20BytesHomogeneousInt32x10_a8.a0; |
| result += passStruct20BytesHomogeneousInt32x10_a8.a1; |
| result += passStruct20BytesHomogeneousInt32x10_a8.a2; |
| result += passStruct20BytesHomogeneousInt32x10_a8.a3; |
| result += passStruct20BytesHomogeneousInt32x10_a8.a4; |
| result += passStruct20BytesHomogeneousInt32x10_a9.a0; |
| result += passStruct20BytesHomogeneousInt32x10_a9.a1; |
| result += passStruct20BytesHomogeneousInt32x10_a9.a2; |
| result += passStruct20BytesHomogeneousInt32x10_a9.a3; |
| result += passStruct20BytesHomogeneousInt32x10_a9.a4; |
| |
| passStruct20BytesHomogeneousInt32x10Result = result; |
| |
| return result; |
| } |
| |
| /// 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. |
| int 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})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception( |
| "PassStruct20BytesHomogeneousInt32x10 throwing on purpuse!"); |
| } |
| |
| passStruct20BytesHomogeneousInt32x10_a0 = a0; |
| passStruct20BytesHomogeneousInt32x10_a1 = a1; |
| passStruct20BytesHomogeneousInt32x10_a2 = a2; |
| passStruct20BytesHomogeneousInt32x10_a3 = a3; |
| passStruct20BytesHomogeneousInt32x10_a4 = a4; |
| passStruct20BytesHomogeneousInt32x10_a5 = a5; |
| passStruct20BytesHomogeneousInt32x10_a6 = a6; |
| passStruct20BytesHomogeneousInt32x10_a7 = a7; |
| passStruct20BytesHomogeneousInt32x10_a8 = a8; |
| passStruct20BytesHomogeneousInt32x10_a9 = a9; |
| |
| final result = passStruct20BytesHomogeneousInt32x10CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct20BytesHomogeneousInt32x10AfterCallback() { |
| final result = passStruct20BytesHomogeneousInt32x10CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(25, result); |
| } |
| |
| typedef PassStruct20BytesHomogeneousFloatType = Float Function( |
| Struct20BytesHomogeneousFloat); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct20BytesHomogeneousFloat passStruct20BytesHomogeneousFloat_a0 = |
| Struct20BytesHomogeneousFloat(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| double passStruct20BytesHomogeneousFloatResult = 0.0; |
| |
| double passStruct20BytesHomogeneousFloatCalculateResult() { |
| double result = 0; |
| |
| result += passStruct20BytesHomogeneousFloat_a0.a0; |
| result += passStruct20BytesHomogeneousFloat_a0.a1; |
| result += passStruct20BytesHomogeneousFloat_a0.a2; |
| result += passStruct20BytesHomogeneousFloat_a0.a3; |
| result += passStruct20BytesHomogeneousFloat_a0.a4; |
| |
| passStruct20BytesHomogeneousFloatResult = result; |
| |
| return result; |
| } |
| |
| /// Argument too big to go into FPU registers in hardfp and arm64. |
| double passStruct20BytesHomogeneousFloat(Struct20BytesHomogeneousFloat a0) { |
| print("passStruct20BytesHomogeneousFloat(${a0})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct20BytesHomogeneousFloat throwing on purpuse!"); |
| } |
| |
| passStruct20BytesHomogeneousFloat_a0 = a0; |
| |
| final result = passStruct20BytesHomogeneousFloatCalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct20BytesHomogeneousFloatAfterCallback() { |
| final result = passStruct20BytesHomogeneousFloatCalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.approxEquals(-3.0, result); |
| } |
| |
| typedef PassStruct32BytesHomogeneousDoublex5Type = Double Function( |
| Struct32BytesHomogeneousDouble, |
| Struct32BytesHomogeneousDouble, |
| Struct32BytesHomogeneousDouble, |
| Struct32BytesHomogeneousDouble, |
| Struct32BytesHomogeneousDouble); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct32BytesHomogeneousDouble passStruct32BytesHomogeneousDoublex5_a0 = |
| Struct32BytesHomogeneousDouble(); |
| Struct32BytesHomogeneousDouble passStruct32BytesHomogeneousDoublex5_a1 = |
| Struct32BytesHomogeneousDouble(); |
| Struct32BytesHomogeneousDouble passStruct32BytesHomogeneousDoublex5_a2 = |
| Struct32BytesHomogeneousDouble(); |
| Struct32BytesHomogeneousDouble passStruct32BytesHomogeneousDoublex5_a3 = |
| Struct32BytesHomogeneousDouble(); |
| Struct32BytesHomogeneousDouble passStruct32BytesHomogeneousDoublex5_a4 = |
| Struct32BytesHomogeneousDouble(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| double passStruct32BytesHomogeneousDoublex5Result = 0.0; |
| |
| double passStruct32BytesHomogeneousDoublex5CalculateResult() { |
| double result = 0; |
| |
| result += passStruct32BytesHomogeneousDoublex5_a0.a0; |
| result += passStruct32BytesHomogeneousDoublex5_a0.a1; |
| result += passStruct32BytesHomogeneousDoublex5_a0.a2; |
| result += passStruct32BytesHomogeneousDoublex5_a0.a3; |
| result += passStruct32BytesHomogeneousDoublex5_a1.a0; |
| result += passStruct32BytesHomogeneousDoublex5_a1.a1; |
| result += passStruct32BytesHomogeneousDoublex5_a1.a2; |
| result += passStruct32BytesHomogeneousDoublex5_a1.a3; |
| result += passStruct32BytesHomogeneousDoublex5_a2.a0; |
| result += passStruct32BytesHomogeneousDoublex5_a2.a1; |
| result += passStruct32BytesHomogeneousDoublex5_a2.a2; |
| result += passStruct32BytesHomogeneousDoublex5_a2.a3; |
| result += passStruct32BytesHomogeneousDoublex5_a3.a0; |
| result += passStruct32BytesHomogeneousDoublex5_a3.a1; |
| result += passStruct32BytesHomogeneousDoublex5_a3.a2; |
| result += passStruct32BytesHomogeneousDoublex5_a3.a3; |
| result += passStruct32BytesHomogeneousDoublex5_a4.a0; |
| result += passStruct32BytesHomogeneousDoublex5_a4.a1; |
| result += passStruct32BytesHomogeneousDoublex5_a4.a2; |
| result += passStruct32BytesHomogeneousDoublex5_a4.a3; |
| |
| passStruct32BytesHomogeneousDoublex5Result = result; |
| |
| return result; |
| } |
| |
| /// Arguments in FPU registers on arm64. |
| /// 5 struct arguments will exhaust available registers. |
| double passStruct32BytesHomogeneousDoublex5( |
| Struct32BytesHomogeneousDouble a0, |
| Struct32BytesHomogeneousDouble a1, |
| Struct32BytesHomogeneousDouble a2, |
| Struct32BytesHomogeneousDouble a3, |
| Struct32BytesHomogeneousDouble a4) { |
| print( |
| "passStruct32BytesHomogeneousDoublex5(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception( |
| "PassStruct32BytesHomogeneousDoublex5 throwing on purpuse!"); |
| } |
| |
| passStruct32BytesHomogeneousDoublex5_a0 = a0; |
| passStruct32BytesHomogeneousDoublex5_a1 = a1; |
| passStruct32BytesHomogeneousDoublex5_a2 = a2; |
| passStruct32BytesHomogeneousDoublex5_a3 = a3; |
| passStruct32BytesHomogeneousDoublex5_a4 = a4; |
| |
| final result = passStruct32BytesHomogeneousDoublex5CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct32BytesHomogeneousDoublex5AfterCallback() { |
| final result = passStruct32BytesHomogeneousDoublex5CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.approxEquals(10.0, result); |
| } |
| |
| typedef PassStruct40BytesHomogeneousDoubleType = Double Function( |
| Struct40BytesHomogeneousDouble); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct40BytesHomogeneousDouble passStruct40BytesHomogeneousDouble_a0 = |
| Struct40BytesHomogeneousDouble(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| double passStruct40BytesHomogeneousDoubleResult = 0.0; |
| |
| double passStruct40BytesHomogeneousDoubleCalculateResult() { |
| double result = 0; |
| |
| result += passStruct40BytesHomogeneousDouble_a0.a0; |
| result += passStruct40BytesHomogeneousDouble_a0.a1; |
| result += passStruct40BytesHomogeneousDouble_a0.a2; |
| result += passStruct40BytesHomogeneousDouble_a0.a3; |
| result += passStruct40BytesHomogeneousDouble_a0.a4; |
| |
| passStruct40BytesHomogeneousDoubleResult = result; |
| |
| return result; |
| } |
| |
| /// Argument too big to go into FPU registers in arm64. |
| double passStruct40BytesHomogeneousDouble(Struct40BytesHomogeneousDouble a0) { |
| print("passStruct40BytesHomogeneousDouble(${a0})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct40BytesHomogeneousDouble throwing on purpuse!"); |
| } |
| |
| passStruct40BytesHomogeneousDouble_a0 = a0; |
| |
| final result = passStruct40BytesHomogeneousDoubleCalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct40BytesHomogeneousDoubleAfterCallback() { |
| final result = passStruct40BytesHomogeneousDoubleCalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.approxEquals(-3.0, result); |
| } |
| |
| typedef PassStruct1024BytesHomogeneousUint64Type = Uint64 Function( |
| Struct1024BytesHomogeneousUint64); |
| |
| // Global variables to be able to test inputs after callback returned. |
| Struct1024BytesHomogeneousUint64 passStruct1024BytesHomogeneousUint64_a0 = |
| Struct1024BytesHomogeneousUint64(); |
| |
| // Result variable also global, so we can delete it after the callback. |
| int passStruct1024BytesHomogeneousUint64Result = 0; |
| |
| int passStruct1024BytesHomogeneousUint64CalculateResult() { |
| int result = 0; |
| |
| result += passStruct1024BytesHomogeneousUint64_a0.a0; |
| result += passStruct1024BytesHomogeneousUint64_a0.a1; |
| result += passStruct1024BytesHomogeneousUint64_a0.a2; |
| result += passStruct1024BytesHomogeneousUint64_a0.a3; |
| result += passStruct1024BytesHomogeneousUint64_a0.a4; |
| result += passStruct1024BytesHomogeneousUint64_a0.a5; |
| result += passStruct1024BytesHomogeneousUint64_a0.a6; |
| result += passStruct1024BytesHomogeneousUint64_a0.a7; |
| result += passStruct1024BytesHomogeneousUint64_a0.a8; |
| result += passStruct1024BytesHomogeneousUint64_a0.a9; |
| result += passStruct1024BytesHomogeneousUint64_a0.a10; |
| result += passStruct1024BytesHomogeneousUint64_a0.a11; |
| result += passStruct1024BytesHomogeneousUint64_a0.a12; |
| result += passStruct1024BytesHomogeneousUint64_a0.a13; |
| result += passStruct1024BytesHomogeneousUint64_a0.a14; |
| result += passStruct1024BytesHomogeneousUint64_a0.a15; |
| result += passStruct1024BytesHomogeneousUint64_a0.a16; |
| result += passStruct1024BytesHomogeneousUint64_a0.a17; |
| result += passStruct1024BytesHomogeneousUint64_a0.a18; |
| result += passStruct1024BytesHomogeneousUint64_a0.a19; |
| result += passStruct1024BytesHomogeneousUint64_a0.a20; |
| result += passStruct1024BytesHomogeneousUint64_a0.a21; |
| result += passStruct1024BytesHomogeneousUint64_a0.a22; |
| result += passStruct1024BytesHomogeneousUint64_a0.a23; |
| result += passStruct1024BytesHomogeneousUint64_a0.a24; |
| result += passStruct1024BytesHomogeneousUint64_a0.a25; |
| result += passStruct1024BytesHomogeneousUint64_a0.a26; |
| result += passStruct1024BytesHomogeneousUint64_a0.a27; |
| result += passStruct1024BytesHomogeneousUint64_a0.a28; |
| result += passStruct1024BytesHomogeneousUint64_a0.a29; |
| result += passStruct1024BytesHomogeneousUint64_a0.a30; |
| result += passStruct1024BytesHomogeneousUint64_a0.a31; |
| result += passStruct1024BytesHomogeneousUint64_a0.a32; |
| result += passStruct1024BytesHomogeneousUint64_a0.a33; |
| result += passStruct1024BytesHomogeneousUint64_a0.a34; |
| result += passStruct1024BytesHomogeneousUint64_a0.a35; |
| result += passStruct1024BytesHomogeneousUint64_a0.a36; |
| result += passStruct1024BytesHomogeneousUint64_a0.a37; |
| result += passStruct1024BytesHomogeneousUint64_a0.a38; |
| result += passStruct1024BytesHomogeneousUint64_a0.a39; |
| result += passStruct1024BytesHomogeneousUint64_a0.a40; |
| result += passStruct1024BytesHomogeneousUint64_a0.a41; |
| result += passStruct1024BytesHomogeneousUint64_a0.a42; |
| result += passStruct1024BytesHomogeneousUint64_a0.a43; |
| result += passStruct1024BytesHomogeneousUint64_a0.a44; |
| result += passStruct1024BytesHomogeneousUint64_a0.a45; |
| result += passStruct1024BytesHomogeneousUint64_a0.a46; |
| result += passStruct1024BytesHomogeneousUint64_a0.a47; |
| result += passStruct1024BytesHomogeneousUint64_a0.a48; |
| result += passStruct1024BytesHomogeneousUint64_a0.a49; |
| result += passStruct1024BytesHomogeneousUint64_a0.a50; |
| result += passStruct1024BytesHomogeneousUint64_a0.a51; |
| result += passStruct1024BytesHomogeneousUint64_a0.a52; |
| result += passStruct1024BytesHomogeneousUint64_a0.a53; |
| result += passStruct1024BytesHomogeneousUint64_a0.a54; |
| result += passStruct1024BytesHomogeneousUint64_a0.a55; |
| result += passStruct1024BytesHomogeneousUint64_a0.a56; |
| result += passStruct1024BytesHomogeneousUint64_a0.a57; |
| result += passStruct1024BytesHomogeneousUint64_a0.a58; |
| result += passStruct1024BytesHomogeneousUint64_a0.a59; |
| result += passStruct1024BytesHomogeneousUint64_a0.a60; |
| result += passStruct1024BytesHomogeneousUint64_a0.a61; |
| result += passStruct1024BytesHomogeneousUint64_a0.a62; |
| result += passStruct1024BytesHomogeneousUint64_a0.a63; |
| result += passStruct1024BytesHomogeneousUint64_a0.a64; |
| result += passStruct1024BytesHomogeneousUint64_a0.a65; |
| result += passStruct1024BytesHomogeneousUint64_a0.a66; |
| result += passStruct1024BytesHomogeneousUint64_a0.a67; |
| result += passStruct1024BytesHomogeneousUint64_a0.a68; |
| result += passStruct1024BytesHomogeneousUint64_a0.a69; |
| result += passStruct1024BytesHomogeneousUint64_a0.a70; |
| result += passStruct1024BytesHomogeneousUint64_a0.a71; |
| result += passStruct1024BytesHomogeneousUint64_a0.a72; |
| result += passStruct1024BytesHomogeneousUint64_a0.a73; |
| result += passStruct1024BytesHomogeneousUint64_a0.a74; |
| result += passStruct1024BytesHomogeneousUint64_a0.a75; |
| result += passStruct1024BytesHomogeneousUint64_a0.a76; |
| result += passStruct1024BytesHomogeneousUint64_a0.a77; |
| result += passStruct1024BytesHomogeneousUint64_a0.a78; |
| result += passStruct1024BytesHomogeneousUint64_a0.a79; |
| result += passStruct1024BytesHomogeneousUint64_a0.a80; |
| result += passStruct1024BytesHomogeneousUint64_a0.a81; |
| result += passStruct1024BytesHomogeneousUint64_a0.a82; |
| result += passStruct1024BytesHomogeneousUint64_a0.a83; |
| result += passStruct1024BytesHomogeneousUint64_a0.a84; |
| result += passStruct1024BytesHomogeneousUint64_a0.a85; |
| result += passStruct1024BytesHomogeneousUint64_a0.a86; |
| result += passStruct1024BytesHomogeneousUint64_a0.a87; |
| result += passStruct1024BytesHomogeneousUint64_a0.a88; |
| result += passStruct1024BytesHomogeneousUint64_a0.a89; |
| result += passStruct1024BytesHomogeneousUint64_a0.a90; |
| result += passStruct1024BytesHomogeneousUint64_a0.a91; |
| result += passStruct1024BytesHomogeneousUint64_a0.a92; |
| result += passStruct1024BytesHomogeneousUint64_a0.a93; |
| result += passStruct1024BytesHomogeneousUint64_a0.a94; |
| result += passStruct1024BytesHomogeneousUint64_a0.a95; |
| result += passStruct1024BytesHomogeneousUint64_a0.a96; |
| result += passStruct1024BytesHomogeneousUint64_a0.a97; |
| result += passStruct1024BytesHomogeneousUint64_a0.a98; |
| result += passStruct1024BytesHomogeneousUint64_a0.a99; |
| result += passStruct1024BytesHomogeneousUint64_a0.a100; |
| result += passStruct1024BytesHomogeneousUint64_a0.a101; |
| result += passStruct1024BytesHomogeneousUint64_a0.a102; |
| result += passStruct1024BytesHomogeneousUint64_a0.a103; |
| result += passStruct1024BytesHomogeneousUint64_a0.a104; |
| result += passStruct1024BytesHomogeneousUint64_a0.a105; |
| result += passStruct1024BytesHomogeneousUint64_a0.a106; |
| result += passStruct1024BytesHomogeneousUint64_a0.a107; |
| result += passStruct1024BytesHomogeneousUint64_a0.a108; |
| result += passStruct1024BytesHomogeneousUint64_a0.a109; |
| result += passStruct1024BytesHomogeneousUint64_a0.a110; |
| result += passStruct1024BytesHomogeneousUint64_a0.a111; |
| result += passStruct1024BytesHomogeneousUint64_a0.a112; |
| result += passStruct1024BytesHomogeneousUint64_a0.a113; |
| result += passStruct1024BytesHomogeneousUint64_a0.a114; |
| result += passStruct1024BytesHomogeneousUint64_a0.a115; |
| result += passStruct1024BytesHomogeneousUint64_a0.a116; |
| result += passStruct1024BytesHomogeneousUint64_a0.a117; |
| result += passStruct1024BytesHomogeneousUint64_a0.a118; |
| result += passStruct1024BytesHomogeneousUint64_a0.a119; |
| result += passStruct1024BytesHomogeneousUint64_a0.a120; |
| result += passStruct1024BytesHomogeneousUint64_a0.a121; |
| result += passStruct1024BytesHomogeneousUint64_a0.a122; |
| result += passStruct1024BytesHomogeneousUint64_a0.a123; |
| result += passStruct1024BytesHomogeneousUint64_a0.a124; |
| result += passStruct1024BytesHomogeneousUint64_a0.a125; |
| result += passStruct1024BytesHomogeneousUint64_a0.a126; |
| result += passStruct1024BytesHomogeneousUint64_a0.a127; |
| |
| passStruct1024BytesHomogeneousUint64Result = result; |
| |
| return result; |
| } |
| |
| /// Test 1kb struct. |
| int passStruct1024BytesHomogeneousUint64(Struct1024BytesHomogeneousUint64 a0) { |
| print("passStruct1024BytesHomogeneousUint64(${a0})"); |
| |
| // In legacy mode, possibly return null. |
| |
| // In both nnbd and legacy mode, possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception( |
| "PassStruct1024BytesHomogeneousUint64 throwing on purpuse!"); |
| } |
| |
| passStruct1024BytesHomogeneousUint64_a0 = a0; |
| |
| final result = passStruct1024BytesHomogeneousUint64CalculateResult(); |
| |
| print("result = $result"); |
| |
| return result; |
| } |
| |
| void passStruct1024BytesHomogeneousUint64AfterCallback() { |
| final result = passStruct1024BytesHomogeneousUint64CalculateResult(); |
| |
| print("after callback result = $result"); |
| |
| Expect.equals(8256, result); |
| } |
| |
| typedef PassFloatStruct16BytesHomogeneousFloatFloatStruct1Type = Float Function( |
| Float, |
| Struct16BytesHomogeneousFloat, |
| Float, |
| Struct16BytesHomogeneousFloat, |
| Float, |
| Struct16BytesHomogeneousFloat, |
| Float, |
| Struct16BytesHomogeneousFloat, |
| Float); |
| |
| // Global variables to be able to test inputs after callback returned. |
| double passFloatStruct16BytesHomogeneousFloatFloatStruct1_a0 = 0.0; |
| Struct16BytesHomogeneousFloat |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1_a1 = |
| Struct16BytesHomogeneousFloat(); |
| double passFloatStruct16BytesHomogeneousFloatFloatStruct1_a2 = 0.0; |
| Struct16BytesHomogeneousFloat |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1_a3 = |
| Struct16BytesHomogeneousFloat(); |
| double passFloatStruct16BytesHomogeneousFloatFloatStruct1_a4 = 0.0; |
| Struct16BytesHomogeneousFloat |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1_a5 = |
| Struct16BytesHomogeneousFloat(); |
| double passFloatStruct16BytesHomogeneousFloatFloatStruct1_a6 = 0.0; |
| Struct16BytesHomogeneousFloat |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1_a7 = |
| Struct16BytesHomogeneousFloat(); |
| double passFloatStruct16BytesHomogeneousFloatFloatStruct1_a8 = 0.0; |
| |
| // Result variable also global, so we can delete it after the callback. |
| double passFloatStruct16BytesHomogeneousFloatFloatStruct1Result = 0.0; |
| |
| double passFloatStruct16BytesHomogeneousFloatFloatStruct1CalculateResult() { |
| double result = 0; |
| |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a0; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a1.a0; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a1.a1; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a1.a2; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a1.a3; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a2; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a3.a0; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a3.a1; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a3.a2; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a3.a3; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a4; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a5.a0; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a5.a1; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a5.a2; |
| result += passFloatStruct16BytesHomogeneousFloatFloatStruct1_a5.a3; |
|