| // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| // |
| // This file has been automatically generated. Please do not edit it manually. |
| // Generated by tests/ffi/generator/structs_by_value_tests_generator.dart. |
| // |
| // SharedObjects=ffi_test_functions |
| // VMOptions= |
| // VMOptions=--deterministic --optimization-counter-threshold=20 |
| // VMOptions=--use-slow-path |
| // VMOptions=--use-slow-path --stacktrace-every=100 |
| |
| import 'dart:ffi'; |
| |
| import 'package:expect/expect.dart'; |
| // ignore: unused_import |
| import 'package:ffi/ffi.dart'; |
| |
| import 'callback_tests_utils.dart'; |
| |
| import 'dylib_utils.dart'; |
| |
| // Reuse the compound classes. |
| import 'function_structs_by_value_generated_compounds.dart'; |
| |
| final ffiTestFunctions = dlopenPlatformSpecific("ffi_test_functions"); |
| |
| void main() { |
| testCases.forEach((t) { |
| print("==== Running " + t.name); |
| t.run(); |
| }); |
| } |
| |
| final testCases = [ |
| CallbackTest.withCheck( |
| "PassStruct1ByteIntx10", |
| NativeCallable<PassStruct1ByteIntx10Type>.isolateLocal( |
| passStruct1ByteIntx10, |
| exceptionalReturn: 0, |
| ), |
| passStruct1ByteIntx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct3BytesHomogeneousUint8x10", |
| NativeCallable<PassStruct3BytesHomogeneousUint8x10Type>.isolateLocal( |
| passStruct3BytesHomogeneousUint8x10, |
| exceptionalReturn: 0, |
| ), |
| passStruct3BytesHomogeneousUint8x10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct3BytesInt2ByteAlignedx10", |
| NativeCallable<PassStruct3BytesInt2ByteAlignedx10Type>.isolateLocal( |
| passStruct3BytesInt2ByteAlignedx10, |
| exceptionalReturn: 0, |
| ), |
| passStruct3BytesInt2ByteAlignedx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct4BytesHomogeneousInt16x10", |
| NativeCallable<PassStruct4BytesHomogeneousInt16x10Type>.isolateLocal( |
| passStruct4BytesHomogeneousInt16x10, |
| exceptionalReturn: 0, |
| ), |
| passStruct4BytesHomogeneousInt16x10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct7BytesHomogeneousUint8x10", |
| NativeCallable<PassStruct7BytesHomogeneousUint8x10Type>.isolateLocal( |
| passStruct7BytesHomogeneousUint8x10, |
| exceptionalReturn: 0, |
| ), |
| passStruct7BytesHomogeneousUint8x10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct7BytesInt4ByteAlignedx10", |
| NativeCallable<PassStruct7BytesInt4ByteAlignedx10Type>.isolateLocal( |
| passStruct7BytesInt4ByteAlignedx10, |
| exceptionalReturn: 0, |
| ), |
| passStruct7BytesInt4ByteAlignedx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct8BytesIntx10", |
| NativeCallable<PassStruct8BytesIntx10Type>.isolateLocal( |
| passStruct8BytesIntx10, |
| exceptionalReturn: 0, |
| ), |
| passStruct8BytesIntx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct8BytesHomogeneousFloatx10", |
| NativeCallable<PassStruct8BytesHomogeneousFloatx10Type>.isolateLocal( |
| passStruct8BytesHomogeneousFloatx10, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct8BytesHomogeneousFloatx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct8BytesMixedx10", |
| NativeCallable<PassStruct8BytesMixedx10Type>.isolateLocal( |
| passStruct8BytesMixedx10, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct8BytesMixedx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct9BytesHomogeneousUint8x10", |
| NativeCallable<PassStruct9BytesHomogeneousUint8x10Type>.isolateLocal( |
| passStruct9BytesHomogeneousUint8x10, |
| exceptionalReturn: 0, |
| ), |
| passStruct9BytesHomogeneousUint8x10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct9BytesInt4Or8ByteAlignedx10", |
| NativeCallable<PassStruct9BytesInt4Or8ByteAlignedx10Type>.isolateLocal( |
| passStruct9BytesInt4Or8ByteAlignedx10, |
| exceptionalReturn: 0, |
| ), |
| passStruct9BytesInt4Or8ByteAlignedx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct12BytesHomogeneousFloatx6", |
| NativeCallable<PassStruct12BytesHomogeneousFloatx6Type>.isolateLocal( |
| passStruct12BytesHomogeneousFloatx6, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct12BytesHomogeneousFloatx6AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct16BytesHomogeneousFloatx5", |
| NativeCallable<PassStruct16BytesHomogeneousFloatx5Type>.isolateLocal( |
| passStruct16BytesHomogeneousFloatx5, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct16BytesHomogeneousFloatx5AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct16BytesMixedx10", |
| NativeCallable<PassStruct16BytesMixedx10Type>.isolateLocal( |
| passStruct16BytesMixedx10, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct16BytesMixedx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct16BytesMixed2x10", |
| NativeCallable<PassStruct16BytesMixed2x10Type>.isolateLocal( |
| passStruct16BytesMixed2x10, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct16BytesMixed2x10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct17BytesIntx10", |
| NativeCallable<PassStruct17BytesIntx10Type>.isolateLocal( |
| passStruct17BytesIntx10, |
| exceptionalReturn: 0, |
| ), |
| passStruct17BytesIntx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct19BytesHomogeneousUint8x10", |
| NativeCallable<PassStruct19BytesHomogeneousUint8x10Type>.isolateLocal( |
| passStruct19BytesHomogeneousUint8x10, |
| exceptionalReturn: 0, |
| ), |
| passStruct19BytesHomogeneousUint8x10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct20BytesHomogeneousInt32x10", |
| NativeCallable<PassStruct20BytesHomogeneousInt32x10Type>.isolateLocal( |
| passStruct20BytesHomogeneousInt32x10, |
| exceptionalReturn: 0, |
| ), |
| passStruct20BytesHomogeneousInt32x10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct20BytesHomogeneousFloat", |
| NativeCallable<PassStruct20BytesHomogeneousFloatType>.isolateLocal( |
| passStruct20BytesHomogeneousFloat, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct20BytesHomogeneousFloatAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct32BytesHomogeneousDoublex5", |
| NativeCallable<PassStruct32BytesHomogeneousDoublex5Type>.isolateLocal( |
| passStruct32BytesHomogeneousDoublex5, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct32BytesHomogeneousDoublex5AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct40BytesHomogeneousDouble", |
| NativeCallable<PassStruct40BytesHomogeneousDoubleType>.isolateLocal( |
| passStruct40BytesHomogeneousDouble, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct40BytesHomogeneousDoubleAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct1024BytesHomogeneousUint64", |
| NativeCallable<PassStruct1024BytesHomogeneousUint64Type>.isolateLocal( |
| passStruct1024BytesHomogeneousUint64, |
| exceptionalReturn: 0, |
| ), |
| passStruct1024BytesHomogeneousUint64AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassFloatStruct16BytesHomogeneousFloatFloatStruct1", |
| NativeCallable< |
| PassFloatStruct16BytesHomogeneousFloatFloatStruct1Type |
| >.isolateLocal( |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1, |
| exceptionalReturn: 0.0, |
| ), |
| passFloatStruct16BytesHomogeneousFloatFloatStruct1AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassFloatStruct32BytesHomogeneousDoubleFloatStruct", |
| NativeCallable< |
| PassFloatStruct32BytesHomogeneousDoubleFloatStructType |
| >.isolateLocal( |
| passFloatStruct32BytesHomogeneousDoubleFloatStruct, |
| exceptionalReturn: 0.0, |
| ), |
| passFloatStruct32BytesHomogeneousDoubleFloatStructAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassInt8Struct16BytesMixedInt8Struct16BytesMixedIn", |
| NativeCallable< |
| PassInt8Struct16BytesMixedInt8Struct16BytesMixedInType |
| >.isolateLocal( |
| passInt8Struct16BytesMixedInt8Struct16BytesMixedIn, |
| exceptionalReturn: 0.0, |
| ), |
| passInt8Struct16BytesMixedInt8Struct16BytesMixedInAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassDoublex6Struct16BytesMixedx4Int32", |
| NativeCallable<PassDoublex6Struct16BytesMixedx4Int32Type>.isolateLocal( |
| passDoublex6Struct16BytesMixedx4Int32, |
| exceptionalReturn: 0.0, |
| ), |
| passDoublex6Struct16BytesMixedx4Int32AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassInt32x4Struct16BytesMixedx4Double", |
| NativeCallable<PassInt32x4Struct16BytesMixedx4DoubleType>.isolateLocal( |
| passInt32x4Struct16BytesMixedx4Double, |
| exceptionalReturn: 0.0, |
| ), |
| passInt32x4Struct16BytesMixedx4DoubleAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct40BytesHomogeneousDoubleStruct4BytesHomo", |
| NativeCallable< |
| PassStruct40BytesHomogeneousDoubleStruct4BytesHomoType |
| >.isolateLocal( |
| passStruct40BytesHomogeneousDoubleStruct4BytesHomo, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct40BytesHomogeneousDoubleStruct4BytesHomoAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int", |
| NativeCallable< |
| PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntType |
| >.isolateLocal( |
| passInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int, |
| exceptionalReturn: 0.0, |
| ), |
| passInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructAlignmentInt16", |
| NativeCallable<PassStructAlignmentInt16Type>.isolateLocal( |
| passStructAlignmentInt16, |
| exceptionalReturn: 0, |
| ), |
| passStructAlignmentInt16AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructAlignmentInt32", |
| NativeCallable<PassStructAlignmentInt32Type>.isolateLocal( |
| passStructAlignmentInt32, |
| exceptionalReturn: 0, |
| ), |
| passStructAlignmentInt32AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructAlignmentInt64", |
| NativeCallable<PassStructAlignmentInt64Type>.isolateLocal( |
| passStructAlignmentInt64, |
| exceptionalReturn: 0, |
| ), |
| passStructAlignmentInt64AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct8BytesNestedIntx10", |
| NativeCallable<PassStruct8BytesNestedIntx10Type>.isolateLocal( |
| passStruct8BytesNestedIntx10, |
| exceptionalReturn: 0, |
| ), |
| passStruct8BytesNestedIntx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct8BytesNestedFloatx10", |
| NativeCallable<PassStruct8BytesNestedFloatx10Type>.isolateLocal( |
| passStruct8BytesNestedFloatx10, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct8BytesNestedFloatx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct8BytesNestedFloat2x10", |
| NativeCallable<PassStruct8BytesNestedFloat2x10Type>.isolateLocal( |
| passStruct8BytesNestedFloat2x10, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct8BytesNestedFloat2x10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct8BytesNestedMixedx10", |
| NativeCallable<PassStruct8BytesNestedMixedx10Type>.isolateLocal( |
| passStruct8BytesNestedMixedx10, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct8BytesNestedMixedx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct16BytesNestedIntx2", |
| NativeCallable<PassStruct16BytesNestedIntx2Type>.isolateLocal( |
| passStruct16BytesNestedIntx2, |
| exceptionalReturn: 0, |
| ), |
| passStruct16BytesNestedIntx2AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct32BytesNestedIntx2", |
| NativeCallable<PassStruct32BytesNestedIntx2Type>.isolateLocal( |
| passStruct32BytesNestedIntx2, |
| exceptionalReturn: 0, |
| ), |
| passStruct32BytesNestedIntx2AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructNestedIntStructAlignmentInt16", |
| NativeCallable<PassStructNestedIntStructAlignmentInt16Type>.isolateLocal( |
| passStructNestedIntStructAlignmentInt16, |
| exceptionalReturn: 0, |
| ), |
| passStructNestedIntStructAlignmentInt16AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructNestedIntStructAlignmentInt32", |
| NativeCallable<PassStructNestedIntStructAlignmentInt32Type>.isolateLocal( |
| passStructNestedIntStructAlignmentInt32, |
| exceptionalReturn: 0, |
| ), |
| passStructNestedIntStructAlignmentInt32AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructNestedIntStructAlignmentInt64", |
| NativeCallable<PassStructNestedIntStructAlignmentInt64Type>.isolateLocal( |
| passStructNestedIntStructAlignmentInt64, |
| exceptionalReturn: 0, |
| ), |
| passStructNestedIntStructAlignmentInt64AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructNestedIrregularEvenBiggerx4", |
| NativeCallable<PassStructNestedIrregularEvenBiggerx4Type>.isolateLocal( |
| passStructNestedIrregularEvenBiggerx4, |
| exceptionalReturn: 0.0, |
| ), |
| passStructNestedIrregularEvenBiggerx4AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct8BytesInlineArrayIntx4", |
| NativeCallable<PassStruct8BytesInlineArrayIntx4Type>.isolateLocal( |
| passStruct8BytesInlineArrayIntx4, |
| exceptionalReturn: 0, |
| ), |
| passStruct8BytesInlineArrayIntx4AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructInlineArrayIrregularx4", |
| NativeCallable<PassStructInlineArrayIrregularx4Type>.isolateLocal( |
| passStructInlineArrayIrregularx4, |
| exceptionalReturn: 0, |
| ), |
| passStructInlineArrayIrregularx4AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructInlineArray100Bytes", |
| NativeCallable<PassStructInlineArray100BytesType>.isolateLocal( |
| passStructInlineArray100Bytes, |
| exceptionalReturn: 0, |
| ), |
| passStructInlineArray100BytesAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructStruct16BytesHomogeneousFloat2x5", |
| NativeCallable<PassStructStruct16BytesHomogeneousFloat2x5Type>.isolateLocal( |
| passStructStruct16BytesHomogeneousFloat2x5, |
| exceptionalReturn: 0.0, |
| ), |
| passStructStruct16BytesHomogeneousFloat2x5AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructStruct32BytesHomogeneousDouble2x5", |
| NativeCallable< |
| PassStructStruct32BytesHomogeneousDouble2x5Type |
| >.isolateLocal( |
| passStructStruct32BytesHomogeneousDouble2x5, |
| exceptionalReturn: 0.0, |
| ), |
| passStructStruct32BytesHomogeneousDouble2x5AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructStruct16BytesMixed3x10", |
| NativeCallable<PassStructStruct16BytesMixed3x10Type>.isolateLocal( |
| passStructStruct16BytesMixed3x10, |
| exceptionalReturn: 0.0, |
| ), |
| passStructStruct16BytesMixed3x10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassUint8Struct32BytesInlineArrayMultiDimensionalI", |
| NativeCallable< |
| PassUint8Struct32BytesInlineArrayMultiDimensionalIType |
| >.isolateLocal( |
| passUint8Struct32BytesInlineArrayMultiDimensionalI, |
| exceptionalReturn: 0, |
| ), |
| passUint8Struct32BytesInlineArrayMultiDimensionalIAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassUint8Struct4BytesInlineArrayMultiDimensionalIn", |
| NativeCallable< |
| PassUint8Struct4BytesInlineArrayMultiDimensionalInType |
| >.isolateLocal( |
| passUint8Struct4BytesInlineArrayMultiDimensionalIn, |
| exceptionalReturn: 0, |
| ), |
| passUint8Struct4BytesInlineArrayMultiDimensionalInAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct3BytesPackedIntx10", |
| NativeCallable<PassStruct3BytesPackedIntx10Type>.isolateLocal( |
| passStruct3BytesPackedIntx10, |
| exceptionalReturn: 0, |
| ), |
| passStruct3BytesPackedIntx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct8BytesPackedIntx10", |
| NativeCallable<PassStruct8BytesPackedIntx10Type>.isolateLocal( |
| passStruct8BytesPackedIntx10, |
| exceptionalReturn: 0, |
| ), |
| passStruct8BytesPackedIntx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct9BytesPackedMixedx10DoubleInt32x2", |
| NativeCallable< |
| PassStruct9BytesPackedMixedx10DoubleInt32x2Type |
| >.isolateLocal( |
| passStruct9BytesPackedMixedx10DoubleInt32x2, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct9BytesPackedMixedx10DoubleInt32x2AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct5BytesPackedMixed", |
| NativeCallable<PassStruct5BytesPackedMixedType>.isolateLocal( |
| passStruct5BytesPackedMixed, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct5BytesPackedMixedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStructNestedAlignmentStruct5BytesPackedMixed", |
| NativeCallable< |
| PassStructNestedAlignmentStruct5BytesPackedMixedType |
| >.isolateLocal( |
| passStructNestedAlignmentStruct5BytesPackedMixed, |
| exceptionalReturn: 0.0, |
| ), |
| passStructNestedAlignmentStruct5BytesPackedMixedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct6BytesInlineArrayInt", |
| NativeCallable<PassStruct6BytesInlineArrayIntType>.isolateLocal( |
| passStruct6BytesInlineArrayInt, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct6BytesInlineArrayIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassStruct15BytesInlineArrayMixed", |
| NativeCallable<PassStruct15BytesInlineArrayMixedType>.isolateLocal( |
| passStruct15BytesInlineArrayMixed, |
| exceptionalReturn: 0.0, |
| ), |
| passStruct15BytesInlineArrayMixedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassUnion4BytesMixedx10", |
| NativeCallable<PassUnion4BytesMixedx10Type>.isolateLocal( |
| passUnion4BytesMixedx10, |
| exceptionalReturn: 0.0, |
| ), |
| passUnion4BytesMixedx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassUnion8BytesNestedFloatx10", |
| NativeCallable<PassUnion8BytesNestedFloatx10Type>.isolateLocal( |
| passUnion8BytesNestedFloatx10, |
| exceptionalReturn: 0.0, |
| ), |
| passUnion8BytesNestedFloatx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassUnion9BytesNestedIntx10", |
| NativeCallable<PassUnion9BytesNestedIntx10Type>.isolateLocal( |
| passUnion9BytesNestedIntx10, |
| exceptionalReturn: 0.0, |
| ), |
| passUnion9BytesNestedIntx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassUnion16BytesNestedInlineArrayFloatx10", |
| NativeCallable<PassUnion16BytesNestedInlineArrayFloatx10Type>.isolateLocal( |
| passUnion16BytesNestedInlineArrayFloatx10, |
| exceptionalReturn: 0.0, |
| ), |
| passUnion16BytesNestedInlineArrayFloatx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassUnion16BytesNestedFloatx10", |
| NativeCallable<PassUnion16BytesNestedFloatx10Type>.isolateLocal( |
| passUnion16BytesNestedFloatx10, |
| exceptionalReturn: 0.0, |
| ), |
| passUnion16BytesNestedFloatx10AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassUint8Boolx9Struct10BytesHomogeneousBoolBool", |
| NativeCallable< |
| PassUint8Boolx9Struct10BytesHomogeneousBoolBoolType |
| >.isolateLocal( |
| passUint8Boolx9Struct10BytesHomogeneousBoolBool, |
| exceptionalReturn: 0, |
| ), |
| passUint8Boolx9Struct10BytesHomogeneousBoolBoolAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassUint8Boolx9Struct10BytesInlineArrayBoolBool", |
| NativeCallable< |
| PassUint8Boolx9Struct10BytesInlineArrayBoolBoolType |
| >.isolateLocal( |
| passUint8Boolx9Struct10BytesInlineArrayBoolBool, |
| exceptionalReturn: 0, |
| ), |
| passUint8Boolx9Struct10BytesInlineArrayBoolBoolAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassUint8Struct1ByteBool", |
| NativeCallable<PassUint8Struct1ByteBoolType>.isolateLocal( |
| passUint8Struct1ByteBool, |
| exceptionalReturn: false, |
| ), |
| passUint8Struct1ByteBoolAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassWCharStructInlineArrayIntUintPtrx2LongUnsigned", |
| NativeCallable< |
| PassWCharStructInlineArrayIntUintPtrx2LongUnsignedType |
| >.isolateLocal( |
| passWCharStructInlineArrayIntUintPtrx2LongUnsigned, |
| exceptionalReturn: 0, |
| ), |
| passWCharStructInlineArrayIntUintPtrx2LongUnsignedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassInt64x7Struct12BytesHomogeneousInt32", |
| NativeCallable<PassInt64x7Struct12BytesHomogeneousInt32Type>.isolateLocal( |
| passInt64x7Struct12BytesHomogeneousInt32, |
| exceptionalReturn: 0, |
| ), |
| passInt64x7Struct12BytesHomogeneousInt32AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "PassPointerStruct12BytesHomogeneousInt32", |
| NativeCallable<PassPointerStruct12BytesHomogeneousInt32Type>.isolateLocal( |
| passPointerStruct12BytesHomogeneousInt32, |
| exceptionalReturn: 0, |
| ), |
| noChecks, |
| ), |
| CallbackTest.withCheck( |
| "PassPointerStructInlineArrayVariable", |
| NativeCallable<PassPointerStructInlineArrayVariableType>.isolateLocal( |
| passPointerStructInlineArrayVariable, |
| exceptionalReturn: 0, |
| ), |
| noChecks, |
| ), |
| CallbackTest.withCheck( |
| "PassPointerStructInlineArrayVariableAlign", |
| NativeCallable<PassPointerStructInlineArrayVariableAlignType>.isolateLocal( |
| passPointerStructInlineArrayVariableAlign, |
| exceptionalReturn: 0, |
| ), |
| noChecks, |
| ), |
| CallbackTest.withCheck( |
| "PassPointerStructInlineArrayVariable2", |
| NativeCallable<PassPointerStructInlineArrayVariable2Type>.isolateLocal( |
| passPointerStructInlineArrayVariable2, |
| exceptionalReturn: 0, |
| ), |
| noChecks, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct1ByteInt", |
| NativeCallable<ReturnStruct1ByteIntType>.isolateLocal(returnStruct1ByteInt), |
| returnStruct1ByteIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct3BytesHomogeneousUint8", |
| NativeCallable<ReturnStruct3BytesHomogeneousUint8Type>.isolateLocal( |
| returnStruct3BytesHomogeneousUint8, |
| ), |
| returnStruct3BytesHomogeneousUint8AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct3BytesInt2ByteAligned", |
| NativeCallable<ReturnStruct3BytesInt2ByteAlignedType>.isolateLocal( |
| returnStruct3BytesInt2ByteAligned, |
| ), |
| returnStruct3BytesInt2ByteAlignedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct4BytesHomogeneousInt16", |
| NativeCallable<ReturnStruct4BytesHomogeneousInt16Type>.isolateLocal( |
| returnStruct4BytesHomogeneousInt16, |
| ), |
| returnStruct4BytesHomogeneousInt16AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct7BytesHomogeneousUint8", |
| NativeCallable<ReturnStruct7BytesHomogeneousUint8Type>.isolateLocal( |
| returnStruct7BytesHomogeneousUint8, |
| ), |
| returnStruct7BytesHomogeneousUint8AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct7BytesInt4ByteAligned", |
| NativeCallable<ReturnStruct7BytesInt4ByteAlignedType>.isolateLocal( |
| returnStruct7BytesInt4ByteAligned, |
| ), |
| returnStruct7BytesInt4ByteAlignedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesInt", |
| NativeCallable<ReturnStruct8BytesIntType>.isolateLocal( |
| returnStruct8BytesInt, |
| ), |
| returnStruct8BytesIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesHomogeneousFloat", |
| NativeCallable<ReturnStruct8BytesHomogeneousFloatType>.isolateLocal( |
| returnStruct8BytesHomogeneousFloat, |
| ), |
| returnStruct8BytesHomogeneousFloatAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesMixed", |
| NativeCallable<ReturnStruct8BytesMixedType>.isolateLocal( |
| returnStruct8BytesMixed, |
| ), |
| returnStruct8BytesMixedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct9BytesHomogeneousUint8", |
| NativeCallable<ReturnStruct9BytesHomogeneousUint8Type>.isolateLocal( |
| returnStruct9BytesHomogeneousUint8, |
| ), |
| returnStruct9BytesHomogeneousUint8AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct9BytesInt4Or8ByteAligned", |
| NativeCallable<ReturnStruct9BytesInt4Or8ByteAlignedType>.isolateLocal( |
| returnStruct9BytesInt4Or8ByteAligned, |
| ), |
| returnStruct9BytesInt4Or8ByteAlignedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct12BytesHomogeneousFloat", |
| NativeCallable<ReturnStruct12BytesHomogeneousFloatType>.isolateLocal( |
| returnStruct12BytesHomogeneousFloat, |
| ), |
| returnStruct12BytesHomogeneousFloatAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct16BytesHomogeneousFloat", |
| NativeCallable<ReturnStruct16BytesHomogeneousFloatType>.isolateLocal( |
| returnStruct16BytesHomogeneousFloat, |
| ), |
| returnStruct16BytesHomogeneousFloatAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct16BytesMixed", |
| NativeCallable<ReturnStruct16BytesMixedType>.isolateLocal( |
| returnStruct16BytesMixed, |
| ), |
| returnStruct16BytesMixedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct16BytesMixed2", |
| NativeCallable<ReturnStruct16BytesMixed2Type>.isolateLocal( |
| returnStruct16BytesMixed2, |
| ), |
| returnStruct16BytesMixed2AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct17BytesInt", |
| NativeCallable<ReturnStruct17BytesIntType>.isolateLocal( |
| returnStruct17BytesInt, |
| ), |
| returnStruct17BytesIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct19BytesHomogeneousUint8", |
| NativeCallable<ReturnStruct19BytesHomogeneousUint8Type>.isolateLocal( |
| returnStruct19BytesHomogeneousUint8, |
| ), |
| returnStruct19BytesHomogeneousUint8AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct20BytesHomogeneousInt32", |
| NativeCallable<ReturnStruct20BytesHomogeneousInt32Type>.isolateLocal( |
| returnStruct20BytesHomogeneousInt32, |
| ), |
| returnStruct20BytesHomogeneousInt32AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct20BytesHomogeneousFloat", |
| NativeCallable<ReturnStruct20BytesHomogeneousFloatType>.isolateLocal( |
| returnStruct20BytesHomogeneousFloat, |
| ), |
| returnStruct20BytesHomogeneousFloatAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct32BytesHomogeneousDouble", |
| NativeCallable<ReturnStruct32BytesHomogeneousDoubleType>.isolateLocal( |
| returnStruct32BytesHomogeneousDouble, |
| ), |
| returnStruct32BytesHomogeneousDoubleAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct40BytesHomogeneousDouble", |
| NativeCallable<ReturnStruct40BytesHomogeneousDoubleType>.isolateLocal( |
| returnStruct40BytesHomogeneousDouble, |
| ), |
| returnStruct40BytesHomogeneousDoubleAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct1024BytesHomogeneousUint64", |
| NativeCallable<ReturnStruct1024BytesHomogeneousUint64Type>.isolateLocal( |
| returnStruct1024BytesHomogeneousUint64, |
| ), |
| returnStruct1024BytesHomogeneousUint64AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct3BytesPackedInt", |
| NativeCallable<ReturnStruct3BytesPackedIntType>.isolateLocal( |
| returnStruct3BytesPackedInt, |
| ), |
| returnStruct3BytesPackedIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesPackedInt", |
| NativeCallable<ReturnStruct8BytesPackedIntType>.isolateLocal( |
| returnStruct8BytesPackedInt, |
| ), |
| returnStruct8BytesPackedIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct9BytesPackedMixed", |
| NativeCallable<ReturnStruct9BytesPackedMixedType>.isolateLocal( |
| returnStruct9BytesPackedMixed, |
| ), |
| returnStruct9BytesPackedMixedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnUnion4BytesMixed", |
| NativeCallable<ReturnUnion4BytesMixedType>.isolateLocal( |
| returnUnion4BytesMixed, |
| ), |
| returnUnion4BytesMixedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnUnion8BytesNestedFloat", |
| NativeCallable<ReturnUnion8BytesNestedFloatType>.isolateLocal( |
| returnUnion8BytesNestedFloat, |
| ), |
| returnUnion8BytesNestedFloatAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnUnion9BytesNestedInt", |
| NativeCallable<ReturnUnion9BytesNestedIntType>.isolateLocal( |
| returnUnion9BytesNestedInt, |
| ), |
| returnUnion9BytesNestedIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnUnion16BytesNestedFloat", |
| NativeCallable<ReturnUnion16BytesNestedFloatType>.isolateLocal( |
| returnUnion16BytesNestedFloat, |
| ), |
| returnUnion16BytesNestedFloatAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentStruct1ByteInt", |
| NativeCallable<ReturnStructArgumentStruct1ByteIntType>.isolateLocal( |
| returnStructArgumentStruct1ByteInt, |
| ), |
| returnStructArgumentStruct1ByteIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentInt32x8Struct1ByteInt", |
| NativeCallable<ReturnStructArgumentInt32x8Struct1ByteIntType>.isolateLocal( |
| returnStructArgumentInt32x8Struct1ByteInt, |
| ), |
| returnStructArgumentInt32x8Struct1ByteIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentStruct8BytesHomogeneousFloat", |
| NativeCallable< |
| ReturnStructArgumentStruct8BytesHomogeneousFloatType |
| >.isolateLocal(returnStructArgumentStruct8BytesHomogeneousFloat), |
| returnStructArgumentStruct8BytesHomogeneousFloatAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentStruct20BytesHomogeneousInt32", |
| NativeCallable< |
| ReturnStructArgumentStruct20BytesHomogeneousInt32Type |
| >.isolateLocal(returnStructArgumentStruct20BytesHomogeneousInt32), |
| returnStructArgumentStruct20BytesHomogeneousInt32AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentInt32x8Struct20BytesHomogeneou", |
| NativeCallable< |
| ReturnStructArgumentInt32x8Struct20BytesHomogeneouType |
| >.isolateLocal(returnStructArgumentInt32x8Struct20BytesHomogeneou), |
| returnStructArgumentInt32x8Struct20BytesHomogeneouAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentStruct8BytesInlineArrayInt", |
| NativeCallable< |
| ReturnStructArgumentStruct8BytesInlineArrayIntType |
| >.isolateLocal(returnStructArgumentStruct8BytesInlineArrayInt), |
| returnStructArgumentStruct8BytesInlineArrayIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentStructStruct16BytesHomogeneous", |
| NativeCallable< |
| ReturnStructArgumentStructStruct16BytesHomogeneousType |
| >.isolateLocal(returnStructArgumentStructStruct16BytesHomogeneous), |
| returnStructArgumentStructStruct16BytesHomogeneousAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentStructStruct32BytesHomogeneous", |
| NativeCallable< |
| ReturnStructArgumentStructStruct32BytesHomogeneousType |
| >.isolateLocal(returnStructArgumentStructStruct32BytesHomogeneous), |
| returnStructArgumentStructStruct32BytesHomogeneousAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructArgumentStructStruct16BytesMixed3", |
| NativeCallable< |
| ReturnStructArgumentStructStruct16BytesMixed3Type |
| >.isolateLocal(returnStructArgumentStructStruct16BytesMixed3), |
| returnStructArgumentStructStruct16BytesMixed3AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructAlignmentInt16", |
| NativeCallable<ReturnStructAlignmentInt16Type>.isolateLocal( |
| returnStructAlignmentInt16, |
| ), |
| returnStructAlignmentInt16AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructAlignmentInt32", |
| NativeCallable<ReturnStructAlignmentInt32Type>.isolateLocal( |
| returnStructAlignmentInt32, |
| ), |
| returnStructAlignmentInt32AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructAlignmentInt64", |
| NativeCallable<ReturnStructAlignmentInt64Type>.isolateLocal( |
| returnStructAlignmentInt64, |
| ), |
| returnStructAlignmentInt64AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesNestedInt", |
| NativeCallable<ReturnStruct8BytesNestedIntType>.isolateLocal( |
| returnStruct8BytesNestedInt, |
| ), |
| returnStruct8BytesNestedIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesNestedFloat", |
| NativeCallable<ReturnStruct8BytesNestedFloatType>.isolateLocal( |
| returnStruct8BytesNestedFloat, |
| ), |
| returnStruct8BytesNestedFloatAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesNestedFloat2", |
| NativeCallable<ReturnStruct8BytesNestedFloat2Type>.isolateLocal( |
| returnStruct8BytesNestedFloat2, |
| ), |
| returnStruct8BytesNestedFloat2AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct8BytesNestedMixed", |
| NativeCallable<ReturnStruct8BytesNestedMixedType>.isolateLocal( |
| returnStruct8BytesNestedMixed, |
| ), |
| returnStruct8BytesNestedMixedAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct16BytesNestedInt", |
| NativeCallable<ReturnStruct16BytesNestedIntType>.isolateLocal( |
| returnStruct16BytesNestedInt, |
| ), |
| returnStruct16BytesNestedIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStruct32BytesNestedInt", |
| NativeCallable<ReturnStruct32BytesNestedIntType>.isolateLocal( |
| returnStruct32BytesNestedInt, |
| ), |
| returnStruct32BytesNestedIntAfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructNestedIntStructAlignmentInt16", |
| NativeCallable<ReturnStructNestedIntStructAlignmentInt16Type>.isolateLocal( |
| returnStructNestedIntStructAlignmentInt16, |
| ), |
| returnStructNestedIntStructAlignmentInt16AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructNestedIntStructAlignmentInt32", |
| NativeCallable<ReturnStructNestedIntStructAlignmentInt32Type>.isolateLocal( |
| returnStructNestedIntStructAlignmentInt32, |
| ), |
| returnStructNestedIntStructAlignmentInt32AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructNestedIntStructAlignmentInt64", |
| NativeCallable<ReturnStructNestedIntStructAlignmentInt64Type>.isolateLocal( |
| returnStructNestedIntStructAlignmentInt64, |
| ), |
| returnStructNestedIntStructAlignmentInt64AfterCallback, |
| ), |
| CallbackTest.withCheck( |
| "ReturnStructNestedIrregularEvenBigger", |
| NativeCallable<ReturnStructNestedIrregularEvenBiggerType>.isolateLocal( |
| 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 = |
| Pointer<Struct1ByteInt>.fromAddress(0).ref; |
| Struct1ByteInt passStruct1ByteIntx10_a1 = |
| Pointer<Struct1ByteInt>.fromAddress(0).ref; |
| Struct1ByteInt passStruct1ByteIntx10_a2 = |
| Pointer<Struct1ByteInt>.fromAddress(0).ref; |
| Struct1ByteInt passStruct1ByteIntx10_a3 = |
| Pointer<Struct1ByteInt>.fromAddress(0).ref; |
| Struct1ByteInt passStruct1ByteIntx10_a4 = |
| Pointer<Struct1ByteInt>.fromAddress(0).ref; |
| Struct1ByteInt passStruct1ByteIntx10_a5 = |
| Pointer<Struct1ByteInt>.fromAddress(0).ref; |
| Struct1ByteInt passStruct1ByteIntx10_a6 = |
| Pointer<Struct1ByteInt>.fromAddress(0).ref; |
| Struct1ByteInt passStruct1ByteIntx10_a7 = |
| Pointer<Struct1ByteInt>.fromAddress(0).ref; |
| Struct1ByteInt passStruct1ByteIntx10_a8 = |
| Pointer<Struct1ByteInt>.fromAddress(0).ref; |
| Struct1ByteInt passStruct1ByteIntx10_a9 = |
| Pointer<Struct1ByteInt>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct1ByteIntx10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct3BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a1 = |
| Pointer<Struct3BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a2 = |
| Pointer<Struct3BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a3 = |
| Pointer<Struct3BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a4 = |
| Pointer<Struct3BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a5 = |
| Pointer<Struct3BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a6 = |
| Pointer<Struct3BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a7 = |
| Pointer<Struct3BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a8 = |
| Pointer<Struct3BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct3BytesHomogeneousUint8 passStruct3BytesHomogeneousUint8x10_a9 = |
| Pointer<Struct3BytesHomogeneousUint8>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct3BytesHomogeneousUint8x10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct3BytesInt2ByteAligned>.fromAddress(0).ref; |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a1 = |
| Pointer<Struct3BytesInt2ByteAligned>.fromAddress(0).ref; |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a2 = |
| Pointer<Struct3BytesInt2ByteAligned>.fromAddress(0).ref; |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a3 = |
| Pointer<Struct3BytesInt2ByteAligned>.fromAddress(0).ref; |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a4 = |
| Pointer<Struct3BytesInt2ByteAligned>.fromAddress(0).ref; |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a5 = |
| Pointer<Struct3BytesInt2ByteAligned>.fromAddress(0).ref; |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a6 = |
| Pointer<Struct3BytesInt2ByteAligned>.fromAddress(0).ref; |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a7 = |
| Pointer<Struct3BytesInt2ByteAligned>.fromAddress(0).ref; |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a8 = |
| Pointer<Struct3BytesInt2ByteAligned>.fromAddress(0).ref; |
| Struct3BytesInt2ByteAligned passStruct3BytesInt2ByteAlignedx10_a9 = |
| Pointer<Struct3BytesInt2ByteAligned>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct3BytesInt2ByteAlignedx10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct4BytesHomogeneousInt16>.fromAddress(0).ref; |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a1 = |
| Pointer<Struct4BytesHomogeneousInt16>.fromAddress(0).ref; |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a2 = |
| Pointer<Struct4BytesHomogeneousInt16>.fromAddress(0).ref; |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a3 = |
| Pointer<Struct4BytesHomogeneousInt16>.fromAddress(0).ref; |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a4 = |
| Pointer<Struct4BytesHomogeneousInt16>.fromAddress(0).ref; |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a5 = |
| Pointer<Struct4BytesHomogeneousInt16>.fromAddress(0).ref; |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a6 = |
| Pointer<Struct4BytesHomogeneousInt16>.fromAddress(0).ref; |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a7 = |
| Pointer<Struct4BytesHomogeneousInt16>.fromAddress(0).ref; |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a8 = |
| Pointer<Struct4BytesHomogeneousInt16>.fromAddress(0).ref; |
| Struct4BytesHomogeneousInt16 passStruct4BytesHomogeneousInt16x10_a9 = |
| Pointer<Struct4BytesHomogeneousInt16>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct4BytesHomogeneousInt16x10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct7BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a1 = |
| Pointer<Struct7BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a2 = |
| Pointer<Struct7BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a3 = |
| Pointer<Struct7BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a4 = |
| Pointer<Struct7BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a5 = |
| Pointer<Struct7BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a6 = |
| Pointer<Struct7BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a7 = |
| Pointer<Struct7BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a8 = |
| Pointer<Struct7BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct7BytesHomogeneousUint8 passStruct7BytesHomogeneousUint8x10_a9 = |
| Pointer<Struct7BytesHomogeneousUint8>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct7BytesHomogeneousUint8x10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct7BytesInt4ByteAligned>.fromAddress(0).ref; |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a1 = |
| Pointer<Struct7BytesInt4ByteAligned>.fromAddress(0).ref; |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a2 = |
| Pointer<Struct7BytesInt4ByteAligned>.fromAddress(0).ref; |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a3 = |
| Pointer<Struct7BytesInt4ByteAligned>.fromAddress(0).ref; |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a4 = |
| Pointer<Struct7BytesInt4ByteAligned>.fromAddress(0).ref; |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a5 = |
| Pointer<Struct7BytesInt4ByteAligned>.fromAddress(0).ref; |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a6 = |
| Pointer<Struct7BytesInt4ByteAligned>.fromAddress(0).ref; |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a7 = |
| Pointer<Struct7BytesInt4ByteAligned>.fromAddress(0).ref; |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a8 = |
| Pointer<Struct7BytesInt4ByteAligned>.fromAddress(0).ref; |
| Struct7BytesInt4ByteAligned passStruct7BytesInt4ByteAlignedx10_a9 = |
| Pointer<Struct7BytesInt4ByteAligned>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct7BytesInt4ByteAlignedx10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct8BytesInt>.fromAddress(0).ref; |
| Struct8BytesInt passStruct8BytesIntx10_a1 = |
| Pointer<Struct8BytesInt>.fromAddress(0).ref; |
| Struct8BytesInt passStruct8BytesIntx10_a2 = |
| Pointer<Struct8BytesInt>.fromAddress(0).ref; |
| Struct8BytesInt passStruct8BytesIntx10_a3 = |
| Pointer<Struct8BytesInt>.fromAddress(0).ref; |
| Struct8BytesInt passStruct8BytesIntx10_a4 = |
| Pointer<Struct8BytesInt>.fromAddress(0).ref; |
| Struct8BytesInt passStruct8BytesIntx10_a5 = |
| Pointer<Struct8BytesInt>.fromAddress(0).ref; |
| Struct8BytesInt passStruct8BytesIntx10_a6 = |
| Pointer<Struct8BytesInt>.fromAddress(0).ref; |
| Struct8BytesInt passStruct8BytesIntx10_a7 = |
| Pointer<Struct8BytesInt>.fromAddress(0).ref; |
| Struct8BytesInt passStruct8BytesIntx10_a8 = |
| Pointer<Struct8BytesInt>.fromAddress(0).ref; |
| Struct8BytesInt passStruct8BytesIntx10_a9 = |
| Pointer<Struct8BytesInt>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct8BytesIntx10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct8BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a1 = |
| Pointer<Struct8BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a2 = |
| Pointer<Struct8BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a3 = |
| Pointer<Struct8BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a4 = |
| Pointer<Struct8BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a5 = |
| Pointer<Struct8BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a6 = |
| Pointer<Struct8BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a7 = |
| Pointer<Struct8BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a8 = |
| Pointer<Struct8BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct8BytesHomogeneousFloat passStruct8BytesHomogeneousFloatx10_a9 = |
| Pointer<Struct8BytesHomogeneousFloat>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct8BytesHomogeneousFloatx10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct8BytesMixed>.fromAddress(0).ref; |
| Struct8BytesMixed passStruct8BytesMixedx10_a1 = |
| Pointer<Struct8BytesMixed>.fromAddress(0).ref; |
| Struct8BytesMixed passStruct8BytesMixedx10_a2 = |
| Pointer<Struct8BytesMixed>.fromAddress(0).ref; |
| Struct8BytesMixed passStruct8BytesMixedx10_a3 = |
| Pointer<Struct8BytesMixed>.fromAddress(0).ref; |
| Struct8BytesMixed passStruct8BytesMixedx10_a4 = |
| Pointer<Struct8BytesMixed>.fromAddress(0).ref; |
| Struct8BytesMixed passStruct8BytesMixedx10_a5 = |
| Pointer<Struct8BytesMixed>.fromAddress(0).ref; |
| Struct8BytesMixed passStruct8BytesMixedx10_a6 = |
| Pointer<Struct8BytesMixed>.fromAddress(0).ref; |
| Struct8BytesMixed passStruct8BytesMixedx10_a7 = |
| Pointer<Struct8BytesMixed>.fromAddress(0).ref; |
| Struct8BytesMixed passStruct8BytesMixedx10_a8 = |
| Pointer<Struct8BytesMixed>.fromAddress(0).ref; |
| Struct8BytesMixed passStruct8BytesMixedx10_a9 = |
| Pointer<Struct8BytesMixed>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct8BytesMixedx10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct9BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a1 = |
| Pointer<Struct9BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a2 = |
| Pointer<Struct9BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a3 = |
| Pointer<Struct9BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a4 = |
| Pointer<Struct9BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a5 = |
| Pointer<Struct9BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a6 = |
| Pointer<Struct9BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a7 = |
| Pointer<Struct9BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a8 = |
| Pointer<Struct9BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct9BytesHomogeneousUint8 passStruct9BytesHomogeneousUint8x10_a9 = |
| Pointer<Struct9BytesHomogeneousUint8>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct9BytesHomogeneousUint8x10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct9BytesInt4Or8ByteAligned>.fromAddress(0).ref; |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a1 = |
| Pointer<Struct9BytesInt4Or8ByteAligned>.fromAddress(0).ref; |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a2 = |
| Pointer<Struct9BytesInt4Or8ByteAligned>.fromAddress(0).ref; |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a3 = |
| Pointer<Struct9BytesInt4Or8ByteAligned>.fromAddress(0).ref; |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a4 = |
| Pointer<Struct9BytesInt4Or8ByteAligned>.fromAddress(0).ref; |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a5 = |
| Pointer<Struct9BytesInt4Or8ByteAligned>.fromAddress(0).ref; |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a6 = |
| Pointer<Struct9BytesInt4Or8ByteAligned>.fromAddress(0).ref; |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a7 = |
| Pointer<Struct9BytesInt4Or8ByteAligned>.fromAddress(0).ref; |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a8 = |
| Pointer<Struct9BytesInt4Or8ByteAligned>.fromAddress(0).ref; |
| Struct9BytesInt4Or8ByteAligned passStruct9BytesInt4Or8ByteAlignedx10_a9 = |
| Pointer<Struct9BytesInt4Or8ByteAligned>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception( |
| "PassStruct9BytesInt4Or8ByteAlignedx10 throwing on purpose!", |
| ); |
| } |
| |
| 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 = |
| Pointer<Struct12BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a1 = |
| Pointer<Struct12BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a2 = |
| Pointer<Struct12BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a3 = |
| Pointer<Struct12BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a4 = |
| Pointer<Struct12BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct12BytesHomogeneousFloat passStruct12BytesHomogeneousFloatx6_a5 = |
| Pointer<Struct12BytesHomogeneousFloat>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct12BytesHomogeneousFloatx6 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct16BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct16BytesHomogeneousFloat passStruct16BytesHomogeneousFloatx5_a1 = |
| Pointer<Struct16BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct16BytesHomogeneousFloat passStruct16BytesHomogeneousFloatx5_a2 = |
| Pointer<Struct16BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct16BytesHomogeneousFloat passStruct16BytesHomogeneousFloatx5_a3 = |
| Pointer<Struct16BytesHomogeneousFloat>.fromAddress(0).ref; |
| Struct16BytesHomogeneousFloat passStruct16BytesHomogeneousFloatx5_a4 = |
| Pointer<Struct16BytesHomogeneousFloat>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct16BytesHomogeneousFloatx5 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct16BytesMixed>.fromAddress(0).ref; |
| Struct16BytesMixed passStruct16BytesMixedx10_a1 = |
| Pointer<Struct16BytesMixed>.fromAddress(0).ref; |
| Struct16BytesMixed passStruct16BytesMixedx10_a2 = |
| Pointer<Struct16BytesMixed>.fromAddress(0).ref; |
| Struct16BytesMixed passStruct16BytesMixedx10_a3 = |
| Pointer<Struct16BytesMixed>.fromAddress(0).ref; |
| Struct16BytesMixed passStruct16BytesMixedx10_a4 = |
| Pointer<Struct16BytesMixed>.fromAddress(0).ref; |
| Struct16BytesMixed passStruct16BytesMixedx10_a5 = |
| Pointer<Struct16BytesMixed>.fromAddress(0).ref; |
| Struct16BytesMixed passStruct16BytesMixedx10_a6 = |
| Pointer<Struct16BytesMixed>.fromAddress(0).ref; |
| Struct16BytesMixed passStruct16BytesMixedx10_a7 = |
| Pointer<Struct16BytesMixed>.fromAddress(0).ref; |
| Struct16BytesMixed passStruct16BytesMixedx10_a8 = |
| Pointer<Struct16BytesMixed>.fromAddress(0).ref; |
| Struct16BytesMixed passStruct16BytesMixedx10_a9 = |
| Pointer<Struct16BytesMixed>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct16BytesMixedx10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct16BytesMixed2>.fromAddress(0).ref; |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a1 = |
| Pointer<Struct16BytesMixed2>.fromAddress(0).ref; |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a2 = |
| Pointer<Struct16BytesMixed2>.fromAddress(0).ref; |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a3 = |
| Pointer<Struct16BytesMixed2>.fromAddress(0).ref; |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a4 = |
| Pointer<Struct16BytesMixed2>.fromAddress(0).ref; |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a5 = |
| Pointer<Struct16BytesMixed2>.fromAddress(0).ref; |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a6 = |
| Pointer<Struct16BytesMixed2>.fromAddress(0).ref; |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a7 = |
| Pointer<Struct16BytesMixed2>.fromAddress(0).ref; |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a8 = |
| Pointer<Struct16BytesMixed2>.fromAddress(0).ref; |
| Struct16BytesMixed2 passStruct16BytesMixed2x10_a9 = |
| Pointer<Struct16BytesMixed2>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct16BytesMixed2x10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct17BytesInt>.fromAddress(0).ref; |
| Struct17BytesInt passStruct17BytesIntx10_a1 = |
| Pointer<Struct17BytesInt>.fromAddress(0).ref; |
| Struct17BytesInt passStruct17BytesIntx10_a2 = |
| Pointer<Struct17BytesInt>.fromAddress(0).ref; |
| Struct17BytesInt passStruct17BytesIntx10_a3 = |
| Pointer<Struct17BytesInt>.fromAddress(0).ref; |
| Struct17BytesInt passStruct17BytesIntx10_a4 = |
| Pointer<Struct17BytesInt>.fromAddress(0).ref; |
| Struct17BytesInt passStruct17BytesIntx10_a5 = |
| Pointer<Struct17BytesInt>.fromAddress(0).ref; |
| Struct17BytesInt passStruct17BytesIntx10_a6 = |
| Pointer<Struct17BytesInt>.fromAddress(0).ref; |
| Struct17BytesInt passStruct17BytesIntx10_a7 = |
| Pointer<Struct17BytesInt>.fromAddress(0).ref; |
| Struct17BytesInt passStruct17BytesIntx10_a8 = |
| Pointer<Struct17BytesInt>.fromAddress(0).ref; |
| Struct17BytesInt passStruct17BytesIntx10_a9 = |
| Pointer<Struct17BytesInt>.fromAddress(0).ref; |
| |
| // 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})", |
| ); |
| |
| // Possibly throw. |
| if (a0.a0 == 42 || a0.a0 == 84) { |
| print("throwing!"); |
| throw Exception("PassStruct17BytesIntx10 throwing on purpose!"); |
| } |
| |
| 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 = |
| Pointer<Struct19BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a1 = |
| Pointer<Struct19BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a2 = |
| Pointer<Struct19BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a3 = |
| Pointer<Struct19BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a4 = |
| Pointer<Struct19BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a5 = |
| Pointer<Struct19BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a6 = |
| Pointer<Struct19BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a7 = |
| Pointer<Struct19BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a8 = |
| Pointer<Struct19BytesHomogeneousUint8>.fromAddress(0).ref; |
| Struct19BytesHomogeneousUint8 passStruct19BytesHomogeneousUint8x10_a9 = |
| Pointer<Struct19BytesHomogeneousUint8>.fromAddress(0).ref; |
| |
| // 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 |