blob: 147910ebb544f9a583055bb332eee86401c44c8c [file] [log] [blame]
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// This file has been automatically generated. Please do not edit it manually.
// 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",
Pointer.fromFunction<PassStruct1ByteIntx10Type>(passStruct1ByteIntx10, 0),
passStruct1ByteIntx10AfterCallback),
CallbackTest.withCheck(
"PassStruct3BytesHomogeneousUint8x10",
Pointer.fromFunction<PassStruct3BytesHomogeneousUint8x10Type>(
passStruct3BytesHomogeneousUint8x10, 0),
passStruct3BytesHomogeneousUint8x10AfterCallback),
CallbackTest.withCheck(
"PassStruct3BytesInt2ByteAlignedx10",
Pointer.fromFunction<PassStruct3BytesInt2ByteAlignedx10Type>(
passStruct3BytesInt2ByteAlignedx10, 0),
passStruct3BytesInt2ByteAlignedx10AfterCallback),
CallbackTest.withCheck(
"PassStruct4BytesHomogeneousInt16x10",
Pointer.fromFunction<PassStruct4BytesHomogeneousInt16x10Type>(
passStruct4BytesHomogeneousInt16x10, 0),
passStruct4BytesHomogeneousInt16x10AfterCallback),
CallbackTest.withCheck(
"PassStruct7BytesHomogeneousUint8x10",
Pointer.fromFunction<PassStruct7BytesHomogeneousUint8x10Type>(
passStruct7BytesHomogeneousUint8x10, 0),
passStruct7BytesHomogeneousUint8x10AfterCallback),
CallbackTest.withCheck(
"PassStruct7BytesInt4ByteAlignedx10",
Pointer.fromFunction<PassStruct7BytesInt4ByteAlignedx10Type>(
passStruct7BytesInt4ByteAlignedx10, 0),
passStruct7BytesInt4ByteAlignedx10AfterCallback),
CallbackTest.withCheck(
"PassStruct8BytesIntx10",
Pointer.fromFunction<PassStruct8BytesIntx10Type>(
passStruct8BytesIntx10, 0),
passStruct8BytesIntx10AfterCallback),
CallbackTest.withCheck(
"PassStruct8BytesHomogeneousFloatx10",
Pointer.fromFunction<PassStruct8BytesHomogeneousFloatx10Type>(
passStruct8BytesHomogeneousFloatx10, 0.0),
passStruct8BytesHomogeneousFloatx10AfterCallback),
CallbackTest.withCheck(
"PassStruct8BytesMixedx10",
Pointer.fromFunction<PassStruct8BytesMixedx10Type>(
passStruct8BytesMixedx10, 0.0),
passStruct8BytesMixedx10AfterCallback),
CallbackTest.withCheck(
"PassStruct9BytesHomogeneousUint8x10",
Pointer.fromFunction<PassStruct9BytesHomogeneousUint8x10Type>(
passStruct9BytesHomogeneousUint8x10, 0),
passStruct9BytesHomogeneousUint8x10AfterCallback),
CallbackTest.withCheck(
"PassStruct9BytesInt4Or8ByteAlignedx10",
Pointer.fromFunction<PassStruct9BytesInt4Or8ByteAlignedx10Type>(
passStruct9BytesInt4Or8ByteAlignedx10, 0),
passStruct9BytesInt4Or8ByteAlignedx10AfterCallback),
CallbackTest.withCheck(
"PassStruct12BytesHomogeneousFloatx6",
Pointer.fromFunction<PassStruct12BytesHomogeneousFloatx6Type>(
passStruct12BytesHomogeneousFloatx6, 0.0),
passStruct12BytesHomogeneousFloatx6AfterCallback),
CallbackTest.withCheck(
"PassStruct16BytesHomogeneousFloatx5",
Pointer.fromFunction<PassStruct16BytesHomogeneousFloatx5Type>(
passStruct16BytesHomogeneousFloatx5, 0.0),
passStruct16BytesHomogeneousFloatx5AfterCallback),
CallbackTest.withCheck(
"PassStruct16BytesMixedx10",
Pointer.fromFunction<PassStruct16BytesMixedx10Type>(
passStruct16BytesMixedx10, 0.0),
passStruct16BytesMixedx10AfterCallback),
CallbackTest.withCheck(
"PassStruct16BytesMixed2x10",
Pointer.fromFunction<PassStruct16BytesMixed2x10Type>(
passStruct16BytesMixed2x10, 0.0),
passStruct16BytesMixed2x10AfterCallback),
CallbackTest.withCheck(
"PassStruct17BytesIntx10",
Pointer.fromFunction<PassStruct17BytesIntx10Type>(
passStruct17BytesIntx10, 0),
passStruct17BytesIntx10AfterCallback),
CallbackTest.withCheck(
"PassStruct19BytesHomogeneousUint8x10",
Pointer.fromFunction<PassStruct19BytesHomogeneousUint8x10Type>(
passStruct19BytesHomogeneousUint8x10, 0),
passStruct19BytesHomogeneousUint8x10AfterCallback),
CallbackTest.withCheck(
"PassStruct20BytesHomogeneousInt32x10",
Pointer.fromFunction<PassStruct20BytesHomogeneousInt32x10Type>(
passStruct20BytesHomogeneousInt32x10, 0),
passStruct20BytesHomogeneousInt32x10AfterCallback),
CallbackTest.withCheck(
"PassStruct20BytesHomogeneousFloat",
Pointer.fromFunction<PassStruct20BytesHomogeneousFloatType>(
passStruct20BytesHomogeneousFloat, 0.0),
passStruct20BytesHomogeneousFloatAfterCallback),
CallbackTest.withCheck(
"PassStruct32BytesHomogeneousDoublex5",
Pointer.fromFunction<PassStruct32BytesHomogeneousDoublex5Type>(
passStruct32BytesHomogeneousDoublex5, 0.0),
passStruct32BytesHomogeneousDoublex5AfterCallback),
CallbackTest.withCheck(
"PassStruct40BytesHomogeneousDouble",
Pointer.fromFunction<PassStruct40BytesHomogeneousDoubleType>(
passStruct40BytesHomogeneousDouble, 0.0),
passStruct40BytesHomogeneousDoubleAfterCallback),
CallbackTest.withCheck(
"PassStruct1024BytesHomogeneousUint64",
Pointer.fromFunction<PassStruct1024BytesHomogeneousUint64Type>(
passStruct1024BytesHomogeneousUint64, 0),
passStruct1024BytesHomogeneousUint64AfterCallback),
CallbackTest.withCheck(
"PassFloatStruct16BytesHomogeneousFloatFloatStruct1",
Pointer.fromFunction<
PassFloatStruct16BytesHomogeneousFloatFloatStruct1Type>(
passFloatStruct16BytesHomogeneousFloatFloatStruct1, 0.0),
passFloatStruct16BytesHomogeneousFloatFloatStruct1AfterCallback),
CallbackTest.withCheck(
"PassFloatStruct32BytesHomogeneousDoubleFloatStruct",
Pointer.fromFunction<
PassFloatStruct32BytesHomogeneousDoubleFloatStructType>(
passFloatStruct32BytesHomogeneousDoubleFloatStruct, 0.0),
passFloatStruct32BytesHomogeneousDoubleFloatStructAfterCallback),
CallbackTest.withCheck(
"PassInt8Struct16BytesMixedInt8Struct16BytesMixedIn",
Pointer.fromFunction<
PassInt8Struct16BytesMixedInt8Struct16BytesMixedInType>(
passInt8Struct16BytesMixedInt8Struct16BytesMixedIn, 0.0),
passInt8Struct16BytesMixedInt8Struct16BytesMixedInAfterCallback),
CallbackTest.withCheck(
"PassDoublex6Struct16BytesMixedx4Int32",
Pointer.fromFunction<PassDoublex6Struct16BytesMixedx4Int32Type>(
passDoublex6Struct16BytesMixedx4Int32, 0.0),
passDoublex6Struct16BytesMixedx4Int32AfterCallback),
CallbackTest.withCheck(
"PassInt32x4Struct16BytesMixedx4Double",
Pointer.fromFunction<PassInt32x4Struct16BytesMixedx4DoubleType>(
passInt32x4Struct16BytesMixedx4Double, 0.0),
passInt32x4Struct16BytesMixedx4DoubleAfterCallback),
CallbackTest.withCheck(
"PassStruct40BytesHomogeneousDoubleStruct4BytesHomo",
Pointer.fromFunction<
PassStruct40BytesHomogeneousDoubleStruct4BytesHomoType>(
passStruct40BytesHomogeneousDoubleStruct4BytesHomo, 0.0),
passStruct40BytesHomogeneousDoubleStruct4BytesHomoAfterCallback),
CallbackTest.withCheck(
"PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int",
Pointer.fromFunction<
PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntType>(
passInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int, 0.0),
passInt32x8Doublex8Int64Int8Struct1ByteIntInt64IntAfterCallback),
CallbackTest.withCheck(
"PassStructAlignmentInt16",
Pointer.fromFunction<PassStructAlignmentInt16Type>(
passStructAlignmentInt16, 0),
passStructAlignmentInt16AfterCallback),
CallbackTest.withCheck(
"PassStructAlignmentInt32",
Pointer.fromFunction<PassStructAlignmentInt32Type>(
passStructAlignmentInt32, 0),
passStructAlignmentInt32AfterCallback),
CallbackTest.withCheck(
"PassStructAlignmentInt64",
Pointer.fromFunction<PassStructAlignmentInt64Type>(
passStructAlignmentInt64, 0),
passStructAlignmentInt64AfterCallback),
CallbackTest.withCheck(
"PassStruct8BytesNestedIntx10",
Pointer.fromFunction<PassStruct8BytesNestedIntx10Type>(
passStruct8BytesNestedIntx10, 0),
passStruct8BytesNestedIntx10AfterCallback),
CallbackTest.withCheck(
"PassStruct8BytesNestedFloatx10",
Pointer.fromFunction<PassStruct8BytesNestedFloatx10Type>(
passStruct8BytesNestedFloatx10, 0.0),
passStruct8BytesNestedFloatx10AfterCallback),
CallbackTest.withCheck(
"PassStruct8BytesNestedFloat2x10",
Pointer.fromFunction<PassStruct8BytesNestedFloat2x10Type>(
passStruct8BytesNestedFloat2x10, 0.0),
passStruct8BytesNestedFloat2x10AfterCallback),
CallbackTest.withCheck(
"PassStruct8BytesNestedMixedx10",
Pointer.fromFunction<PassStruct8BytesNestedMixedx10Type>(
passStruct8BytesNestedMixedx10, 0.0),
passStruct8BytesNestedMixedx10AfterCallback),
CallbackTest.withCheck(
"PassStruct16BytesNestedIntx2",
Pointer.fromFunction<PassStruct16BytesNestedIntx2Type>(
passStruct16BytesNestedIntx2, 0),
passStruct16BytesNestedIntx2AfterCallback),
CallbackTest.withCheck(
"PassStruct32BytesNestedIntx2",
Pointer.fromFunction<PassStruct32BytesNestedIntx2Type>(
passStruct32BytesNestedIntx2, 0),
passStruct32BytesNestedIntx2AfterCallback),
CallbackTest.withCheck(
"PassStructNestedIntStructAlignmentInt16",
Pointer.fromFunction<PassStructNestedIntStructAlignmentInt16Type>(
passStructNestedIntStructAlignmentInt16, 0),
passStructNestedIntStructAlignmentInt16AfterCallback),
CallbackTest.withCheck(
"PassStructNestedIntStructAlignmentInt32",
Pointer.fromFunction<PassStructNestedIntStructAlignmentInt32Type>(
passStructNestedIntStructAlignmentInt32, 0),
passStructNestedIntStructAlignmentInt32AfterCallback),
CallbackTest.withCheck(
"PassStructNestedIntStructAlignmentInt64",
Pointer.fromFunction<PassStructNestedIntStructAlignmentInt64Type>(
passStructNestedIntStructAlignmentInt64, 0),
passStructNestedIntStructAlignmentInt64AfterCallback),
CallbackTest.withCheck(
"PassStructNestedIrregularEvenBiggerx4",
Pointer.fromFunction<PassStructNestedIrregularEvenBiggerx4Type>(
passStructNestedIrregularEvenBiggerx4, 0.0),
passStructNestedIrregularEvenBiggerx4AfterCallback),
CallbackTest.withCheck(
"PassStruct8BytesInlineArrayIntx4",
Pointer.fromFunction<PassStruct8BytesInlineArrayIntx4Type>(
passStruct8BytesInlineArrayIntx4, 0),
passStruct8BytesInlineArrayIntx4AfterCallback),
CallbackTest.withCheck(
"PassStructInlineArrayIrregularx4",
Pointer.fromFunction<PassStructInlineArrayIrregularx4Type>(
passStructInlineArrayIrregularx4, 0),
passStructInlineArrayIrregularx4AfterCallback),
CallbackTest.withCheck(
"PassStructInlineArray100Bytes",
Pointer.fromFunction<PassStructInlineArray100BytesType>(
passStructInlineArray100Bytes, 0),
passStructInlineArray100BytesAfterCallback),
CallbackTest.withCheck(
"PassStructStruct16BytesHomogeneousFloat2x5",
Pointer.fromFunction<PassStructStruct16BytesHomogeneousFloat2x5Type>(
passStructStruct16BytesHomogeneousFloat2x5, 0.0),
passStructStruct16BytesHomogeneousFloat2x5AfterCallback),
CallbackTest.withCheck(
"PassStructStruct32BytesHomogeneousDouble2x5",
Pointer.fromFunction<PassStructStruct32BytesHomogeneousDouble2x5Type>(
passStructStruct32BytesHomogeneousDouble2x5, 0.0),
passStructStruct32BytesHomogeneousDouble2x5AfterCallback),
CallbackTest.withCheck(
"PassStructStruct16BytesMixed3x10",
Pointer.fromFunction<PassStructStruct16BytesMixed3x10Type>(
passStructStruct16BytesMixed3x10, 0.0),
passStructStruct16BytesMixed3x10AfterCallback),
CallbackTest.withCheck(
"PassUint8Struct32BytesInlineArrayMultiDimensionalI",
Pointer.fromFunction<
PassUint8Struct32BytesInlineArrayMultiDimensionalIType>(
passUint8Struct32BytesInlineArrayMultiDimensionalI, 0),
passUint8Struct32BytesInlineArrayMultiDimensionalIAfterCallback),
CallbackTest.withCheck(
"PassUint8Struct4BytesInlineArrayMultiDimensionalIn",
Pointer.fromFunction<
PassUint8Struct4BytesInlineArrayMultiDimensionalInType>(
passUint8Struct4BytesInlineArrayMultiDimensionalIn, 0),
passUint8Struct4BytesInlineArrayMultiDimensionalInAfterCallback),
CallbackTest.withCheck(
"PassStruct3BytesPackedIntx10",
Pointer.fromFunction<PassStruct3BytesPackedIntx10Type>(
passStruct3BytesPackedIntx10, 0),
passStruct3BytesPackedIntx10AfterCallback),
CallbackTest.withCheck(
"PassStruct8BytesPackedIntx10",
Pointer.fromFunction<PassStruct8BytesPackedIntx10Type>(
passStruct8BytesPackedIntx10, 0),
passStruct8BytesPackedIntx10AfterCallback),
CallbackTest.withCheck(
"PassStruct9BytesPackedMixedx10DoubleInt32x2",
Pointer.fromFunction<PassStruct9BytesPackedMixedx10DoubleInt32x2Type>(
passStruct9BytesPackedMixedx10DoubleInt32x2, 0.0),
passStruct9BytesPackedMixedx10DoubleInt32x2AfterCallback),
CallbackTest.withCheck(
"PassStruct5BytesPackedMixed",
Pointer.fromFunction<PassStruct5BytesPackedMixedType>(
passStruct5BytesPackedMixed, 0.0),
passStruct5BytesPackedMixedAfterCallback),
CallbackTest.withCheck(
"PassStructNestedAlignmentStruct5BytesPackedMixed",
Pointer.fromFunction<
PassStructNestedAlignmentStruct5BytesPackedMixedType>(
passStructNestedAlignmentStruct5BytesPackedMixed, 0.0),
passStructNestedAlignmentStruct5BytesPackedMixedAfterCallback),
CallbackTest.withCheck(
"PassStruct6BytesInlineArrayInt",
Pointer.fromFunction<PassStruct6BytesInlineArrayIntType>(
passStruct6BytesInlineArrayInt, 0.0),
passStruct6BytesInlineArrayIntAfterCallback),
CallbackTest.withCheck(
"PassStruct15BytesInlineArrayMixed",
Pointer.fromFunction<PassStruct15BytesInlineArrayMixedType>(
passStruct15BytesInlineArrayMixed, 0.0),
passStruct15BytesInlineArrayMixedAfterCallback),
CallbackTest.withCheck(
"PassUnion4BytesMixedx10",
Pointer.fromFunction<PassUnion4BytesMixedx10Type>(
passUnion4BytesMixedx10, 0.0),
passUnion4BytesMixedx10AfterCallback),
CallbackTest.withCheck(
"PassUnion8BytesNestedFloatx10",
Pointer.fromFunction<PassUnion8BytesNestedFloatx10Type>(
passUnion8BytesNestedFloatx10, 0.0),
passUnion8BytesNestedFloatx10AfterCallback),
CallbackTest.withCheck(
"PassUnion9BytesNestedIntx10",
Pointer.fromFunction<PassUnion9BytesNestedIntx10Type>(
passUnion9BytesNestedIntx10, 0.0),
passUnion9BytesNestedIntx10AfterCallback),
CallbackTest.withCheck(
"PassUnion16BytesNestedInlineArrayFloatx10",
Pointer.fromFunction<PassUnion16BytesNestedInlineArrayFloatx10Type>(
passUnion16BytesNestedInlineArrayFloatx10, 0.0),
passUnion16BytesNestedInlineArrayFloatx10AfterCallback),
CallbackTest.withCheck(
"PassUnion16BytesNestedFloatx10",
Pointer.fromFunction<PassUnion16BytesNestedFloatx10Type>(
passUnion16BytesNestedFloatx10, 0.0),
passUnion16BytesNestedFloatx10AfterCallback),
CallbackTest.withCheck(
"PassUint8Boolx9Struct10BytesHomogeneousBoolBool",
Pointer.fromFunction<PassUint8Boolx9Struct10BytesHomogeneousBoolBoolType>(
passUint8Boolx9Struct10BytesHomogeneousBoolBool, 0),
passUint8Boolx9Struct10BytesHomogeneousBoolBoolAfterCallback),
CallbackTest.withCheck(
"PassUint8Boolx9Struct10BytesInlineArrayBoolBool",
Pointer.fromFunction<PassUint8Boolx9Struct10BytesInlineArrayBoolBoolType>(
passUint8Boolx9Struct10BytesInlineArrayBoolBool, 0),
passUint8Boolx9Struct10BytesInlineArrayBoolBoolAfterCallback),
CallbackTest.withCheck(
"PassUint8Struct1ByteBool",
Pointer.fromFunction<PassUint8Struct1ByteBoolType>(
passUint8Struct1ByteBool, false),
passUint8Struct1ByteBoolAfterCallback),
CallbackTest.withCheck(
"PassWCharStructInlineArrayIntUintPtrx2LongUnsigned",
Pointer.fromFunction<
PassWCharStructInlineArrayIntUintPtrx2LongUnsignedType>(
passWCharStructInlineArrayIntUintPtrx2LongUnsigned, 0),
passWCharStructInlineArrayIntUintPtrx2LongUnsignedAfterCallback),
CallbackTest.withCheck(
"PassInt64x7Struct12BytesHomogeneousInt32",
Pointer.fromFunction<PassInt64x7Struct12BytesHomogeneousInt32Type>(
passInt64x7Struct12BytesHomogeneousInt32, 0),
passInt64x7Struct12BytesHomogeneousInt32AfterCallback),
CallbackTest.withCheck(
"PassPointerStruct12BytesHomogeneousInt32",
Pointer.fromFunction<PassPointerStruct12BytesHomogeneousInt32Type>(
passPointerStruct12BytesHomogeneousInt32, 0),
noChecks),
CallbackTest.withCheck(
"ReturnStruct1ByteInt",
Pointer.fromFunction<ReturnStruct1ByteIntType>(returnStruct1ByteInt),
returnStruct1ByteIntAfterCallback),
CallbackTest.withCheck(
"ReturnStruct3BytesHomogeneousUint8",
Pointer.fromFunction<ReturnStruct3BytesHomogeneousUint8Type>(
returnStruct3BytesHomogeneousUint8),
returnStruct3BytesHomogeneousUint8AfterCallback),
CallbackTest.withCheck(
"ReturnStruct3BytesInt2ByteAligned",
Pointer.fromFunction<ReturnStruct3BytesInt2ByteAlignedType>(
returnStruct3BytesInt2ByteAligned),
returnStruct3BytesInt2ByteAlignedAfterCallback),
CallbackTest.withCheck(
"ReturnStruct4BytesHomogeneousInt16",
Pointer.fromFunction<ReturnStruct4BytesHomogeneousInt16Type>(
returnStruct4BytesHomogeneousInt16),
returnStruct4BytesHomogeneousInt16AfterCallback),
CallbackTest.withCheck(
"ReturnStruct7BytesHomogeneousUint8",
Pointer.fromFunction<ReturnStruct7BytesHomogeneousUint8Type>(
returnStruct7BytesHomogeneousUint8),
returnStruct7BytesHomogeneousUint8AfterCallback),
CallbackTest.withCheck(
"ReturnStruct7BytesInt4ByteAligned",
Pointer.fromFunction<ReturnStruct7BytesInt4ByteAlignedType>(
returnStruct7BytesInt4ByteAligned),
returnStruct7BytesInt4ByteAlignedAfterCallback),
CallbackTest.withCheck(
"ReturnStruct8BytesInt",
Pointer.fromFunction<ReturnStruct8BytesIntType>(returnStruct8BytesInt),
returnStruct8BytesIntAfterCallback),
CallbackTest.withCheck(
"ReturnStruct8BytesHomogeneousFloat",
Pointer.fromFunction<ReturnStruct8BytesHomogeneousFloatType>(
returnStruct8BytesHomogeneousFloat),
returnStruct8BytesHomogeneousFloatAfterCallback),
CallbackTest.withCheck(
"ReturnStruct8BytesMixed",
Pointer.fromFunction<ReturnStruct8BytesMixedType>(
returnStruct8BytesMixed),
returnStruct8BytesMixedAfterCallback),
CallbackTest.withCheck(
"ReturnStruct9BytesHomogeneousUint8",
Pointer.fromFunction<ReturnStruct9BytesHomogeneousUint8Type>(
returnStruct9BytesHomogeneousUint8),
returnStruct9BytesHomogeneousUint8AfterCallback),
CallbackTest.withCheck(
"ReturnStruct9BytesInt4Or8ByteAligned",
Pointer.fromFunction<ReturnStruct9BytesInt4Or8ByteAlignedType>(
returnStruct9BytesInt4Or8ByteAligned),
returnStruct9BytesInt4Or8ByteAlignedAfterCallback),
CallbackTest.withCheck(
"ReturnStruct12BytesHomogeneousFloat",
Pointer.fromFunction<ReturnStruct12BytesHomogeneousFloatType>(
returnStruct12BytesHomogeneousFloat),
returnStruct12BytesHomogeneousFloatAfterCallback),
CallbackTest.withCheck(
"ReturnStruct16BytesHomogeneousFloat",
Pointer.fromFunction<ReturnStruct16BytesHomogeneousFloatType>(
returnStruct16BytesHomogeneousFloat),
returnStruct16BytesHomogeneousFloatAfterCallback),
CallbackTest.withCheck(
"ReturnStruct16BytesMixed",
Pointer.fromFunction<ReturnStruct16BytesMixedType>(
returnStruct16BytesMixed),
returnStruct16BytesMixedAfterCallback),
CallbackTest.withCheck(
"ReturnStruct16BytesMixed2",
Pointer.fromFunction<ReturnStruct16BytesMixed2Type>(
returnStruct16BytesMixed2),
returnStruct16BytesMixed2AfterCallback),
CallbackTest.withCheck(
"ReturnStruct17BytesInt",
Pointer.fromFunction<ReturnStruct17BytesIntType>(returnStruct17BytesInt),
returnStruct17BytesIntAfterCallback),
CallbackTest.withCheck(
"ReturnStruct19BytesHomogeneousUint8",
Pointer.fromFunction<ReturnStruct19BytesHomogeneousUint8Type>(
returnStruct19BytesHomogeneousUint8),
returnStruct19BytesHomogeneousUint8AfterCallback),
CallbackTest.withCheck(
"ReturnStruct20BytesHomogeneousInt32",
Pointer.fromFunction<ReturnStruct20BytesHomogeneousInt32Type>(
returnStruct20BytesHomogeneousInt32),
returnStruct20BytesHomogeneousInt32AfterCallback),
CallbackTest.withCheck(
"ReturnStruct20BytesHomogeneousFloat",
Pointer.fromFunction<ReturnStruct20BytesHomogeneousFloatType>(
returnStruct20BytesHomogeneousFloat),
returnStruct20BytesHomogeneousFloatAfterCallback),
CallbackTest.withCheck(
"ReturnStruct32BytesHomogeneousDouble",
Pointer.fromFunction<ReturnStruct32BytesHomogeneousDoubleType>(
returnStruct32BytesHomogeneousDouble),
returnStruct32BytesHomogeneousDoubleAfterCallback),
CallbackTest.withCheck(
"ReturnStruct40BytesHomogeneousDouble",
Pointer.fromFunction<ReturnStruct40BytesHomogeneousDoubleType>(
returnStruct40BytesHomogeneousDouble),
returnStruct40BytesHomogeneousDoubleAfterCallback),
CallbackTest.withCheck(
"ReturnStruct1024BytesHomogeneousUint64",
Pointer.fromFunction<ReturnStruct1024BytesHomogeneousUint64Type>(
returnStruct1024BytesHomogeneousUint64),
returnStruct1024BytesHomogeneousUint64AfterCallback),
CallbackTest.withCheck(
"ReturnStruct3BytesPackedInt",
Pointer.fromFunction<ReturnStruct3BytesPackedIntType>(
returnStruct3BytesPackedInt),
returnStruct3BytesPackedIntAfterCallback),
CallbackTest.withCheck(
"ReturnStruct8BytesPackedInt",
Pointer.fromFunction<ReturnStruct8BytesPackedIntType>(
returnStruct8BytesPackedInt),
returnStruct8BytesPackedIntAfterCallback),
CallbackTest.withCheck(
"ReturnStruct9BytesPackedMixed",
Pointer.fromFunction<ReturnStruct9BytesPackedMixedType>(
returnStruct9BytesPackedMixed),
returnStruct9BytesPackedMixedAfterCallback),
CallbackTest.withCheck(
"ReturnUnion4BytesMixed",
Pointer.fromFunction<ReturnUnion4BytesMixedType>(returnUnion4BytesMixed),
returnUnion4BytesMixedAfterCallback),
CallbackTest.withCheck(
"ReturnUnion8BytesNestedFloat",
Pointer.fromFunction<ReturnUnion8BytesNestedFloatType>(
returnUnion8BytesNestedFloat),
returnUnion8BytesNestedFloatAfterCallback),
CallbackTest.withCheck(
"ReturnUnion9BytesNestedInt",
Pointer.fromFunction<ReturnUnion9BytesNestedIntType>(
returnUnion9BytesNestedInt),
returnUnion9BytesNestedIntAfterCallback),
CallbackTest.withCheck(
"ReturnUnion16BytesNestedFloat",
Pointer.fromFunction<ReturnUnion16BytesNestedFloatType>(
returnUnion16BytesNestedFloat),
returnUnion16BytesNestedFloatAfterCallback),
CallbackTest.withCheck(
"ReturnStructArgumentStruct1ByteInt",
Pointer.fromFunction<ReturnStructArgumentStruct1ByteIntType>(
returnStructArgumentStruct1ByteInt),
returnStructArgumentStruct1ByteIntAfterCallback),
CallbackTest.withCheck(
"ReturnStructArgumentInt32x8Struct1ByteInt",
Pointer.fromFunction<ReturnStructArgumentInt32x8Struct1ByteIntType>(
returnStructArgumentInt32x8Struct1ByteInt),
returnStructArgumentInt32x8Struct1ByteIntAfterCallback),
CallbackTest.withCheck(
"ReturnStructArgumentStruct8BytesHomogeneousFloat",
Pointer.fromFunction<
ReturnStructArgumentStruct8BytesHomogeneousFloatType>(
returnStructArgumentStruct8BytesHomogeneousFloat),
returnStructArgumentStruct8BytesHomogeneousFloatAfterCallback),
CallbackTest.withCheck(
"ReturnStructArgumentStruct20BytesHomogeneousInt32",
Pointer.fromFunction<
ReturnStructArgumentStruct20BytesHomogeneousInt32Type>(
returnStructArgumentStruct20BytesHomogeneousInt32),
returnStructArgumentStruct20BytesHomogeneousInt32AfterCallback),
CallbackTest.withCheck(
"ReturnStructArgumentInt32x8Struct20BytesHomogeneou",
Pointer.fromFunction<
ReturnStructArgumentInt32x8Struct20BytesHomogeneouType>(
returnStructArgumentInt32x8Struct20BytesHomogeneou),
returnStructArgumentInt32x8Struct20BytesHomogeneouAfterCallback),
CallbackTest.withCheck(
"ReturnStructArgumentStruct8BytesInlineArrayInt",
Pointer.fromFunction<ReturnStructArgumentStruct8BytesInlineArrayIntType>(
returnStructArgumentStruct8BytesInlineArrayInt),
returnStructArgumentStruct8BytesInlineArrayIntAfterCallback),
CallbackTest.withCheck(
"ReturnStructArgumentStructStruct16BytesHomogeneous",
Pointer.fromFunction<
ReturnStructArgumentStructStruct16BytesHomogeneousType>(
returnStructArgumentStructStruct16BytesHomogeneous),
returnStructArgumentStructStruct16BytesHomogeneousAfterCallback),
CallbackTest.withCheck(
"ReturnStructArgumentStructStruct32BytesHomogeneous",
Pointer.fromFunction<
ReturnStructArgumentStructStruct32BytesHomogeneousType>(
returnStructArgumentStructStruct32BytesHomogeneous),
returnStructArgumentStructStruct32BytesHomogeneousAfterCallback),
CallbackTest.withCheck(
"ReturnStructArgumentStructStruct16BytesMixed3",
Pointer.fromFunction<ReturnStructArgumentStructStruct16BytesMixed3Type>(
returnStructArgumentStructStruct16BytesMixed3),
returnStructArgumentStructStruct16BytesMixed3AfterCallback),
CallbackTest.withCheck(
"ReturnStructAlignmentInt16",
Pointer.fromFunction<ReturnStructAlignmentInt16Type>(
returnStructAlignmentInt16),
returnStructAlignmentInt16AfterCallback),
CallbackTest.withCheck(
"ReturnStructAlignmentInt32",
Pointer.fromFunction<ReturnStructAlignmentInt32Type>(
returnStructAlignmentInt32),
returnStructAlignmentInt32AfterCallback),
CallbackTest.withCheck(
"ReturnStructAlignmentInt64",
Pointer.fromFunction<ReturnStructAlignmentInt64Type>(
returnStructAlignmentInt64),
returnStructAlignmentInt64AfterCallback),
CallbackTest.withCheck(
"ReturnStruct8BytesNestedInt",
Pointer.fromFunction<ReturnStruct8BytesNestedIntType>(
returnStruct8BytesNestedInt),
returnStruct8BytesNestedIntAfterCallback),
CallbackTest.withCheck(
"ReturnStruct8BytesNestedFloat",
Pointer.fromFunction<ReturnStruct8BytesNestedFloatType>(
returnStruct8BytesNestedFloat),
returnStruct8BytesNestedFloatAfterCallback),
CallbackTest.withCheck(
"ReturnStruct8BytesNestedFloat2",
Pointer.fromFunction<ReturnStruct8BytesNestedFloat2Type>(
returnStruct8BytesNestedFloat2),
returnStruct8BytesNestedFloat2AfterCallback),
CallbackTest.withCheck(
"ReturnStruct8BytesNestedMixed",
Pointer.fromFunction<ReturnStruct8BytesNestedMixedType>(
returnStruct8BytesNestedMixed),
returnStruct8BytesNestedMixedAfterCallback),
CallbackTest.withCheck(
"ReturnStruct16BytesNestedInt",
Pointer.fromFunction<ReturnStruct16BytesNestedIntType>(
returnStruct16BytesNestedInt),
returnStruct16BytesNestedIntAfterCallback),
CallbackTest.withCheck(
"ReturnStruct32BytesNestedInt",
Pointer.fromFunction<ReturnStruct32BytesNestedIntType>(
returnStruct32BytesNestedInt),
returnStruct32BytesNestedIntAfterCallback),
CallbackTest.withCheck(
"ReturnStructNestedIntStructAlignmentInt16",
Pointer.fromFunction<ReturnStructNestedIntStructAlignmentInt16Type>(
returnStructNestedIntStructAlignmentInt16),
returnStructNestedIntStructAlignmentInt16AfterCallback),
CallbackTest.withCheck(
"ReturnStructNestedIntStructAlignmentInt32",
Pointer.fromFunction<ReturnStructNestedIntStructAlignmentInt32Type>(
returnStructNestedIntStructAlignmentInt32),
returnStructNestedIntStructAlignmentInt32AfterCallback),
CallbackTest.withCheck(
"ReturnStructNestedIntStructAlignmentInt64",
Pointer.fromFunction<ReturnStructNestedIntStructAlignmentInt64Type>(
returnStructNestedIntStructAlignmentInt64),
returnStructNestedIntStructAlignmentInt64AfterCallback),
CallbackTest.withCheck(
"ReturnStructNestedIrregularEvenBigger",
Pointer.fromFunction<ReturnStructNestedIrregularEvenBiggerType>(
returnStructNestedIrregularEvenBigger),
returnStructNestedIrregularEvenBiggerAfterCallback),
];
typedef PassStruct1ByteIntx10Type = Int64 Function(
Struct1ByteInt,
Struct1ByteInt,
Struct1ByteInt,
Struct1ByteInt,
Struct1ByteInt,
Struct1ByteInt,
Struct1ByteInt,
Struct1ByteInt,
Struct1ByteInt,
Struct1ByteInt);
// Global variables to be able to test inputs after callback returned.
Struct1ByteInt passStruct1ByteIntx10_a0 =
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.a17;
result += passStruct19BytesHomogeneousUint8x10_a9.a18;
passStruct19BytesHomogeneousUint8x10Result = result;
return result;
}
/// The minimum alignment of this struct is only 1 byte based on its fields.
/// Test that the memory backing these structs is extended to the right size.
///
int passStruct19BytesHomogeneousUint8x10(
Struct19BytesHomogeneousUint8 a0,
Struct19BytesHomogeneousUint8 a1,
Struct19BytesHomogeneousUint8 a2,
Struct19BytesHomogeneousUint8 a3,
Struct19BytesHomogeneousUint8 a4,
Struct19BytesHomogeneousUint8 a5,
Struct19BytesHomogeneousUint8 a6,
Struct19BytesHomogeneousUint8 a7,
Struct19BytesHomogeneousUint8 a8,
Struct19BytesHomogeneousUint8 a9) {
print(
"passStruct19BytesHomogeneousUint8x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})");
// Possibly throw.
if (a0.a0 == 42 || a0.a0 == 84) {
print("throwing!");
throw Exception(
"PassStruct19BytesHomogeneousUint8x10 throwing on purpose!");
}
passStruct19BytesHomogeneousUint8x10_a0 = a0;
passStruct19BytesHomogeneousUint8x10_a1 = a1;
passStruct19BytesHomogeneousUint8x10_a2 = a2;
passStruct19BytesHomogeneousUint8x10_a3 = a3;
passStruct19BytesHomogeneousUint8x10_a4 = a4;
passStruct19BytesHomogeneousUint8x10_a5 = a5;
passStruct19BytesHomogeneousUint8x10_a6 = a6;
passStruct19BytesHomogeneousUint8x10_a7 = a7;
passStruct19BytesHomogeneousUint8x10_a8 = a8;
passStruct19BytesHomogeneousUint8x10_a9 = a9;
final result = passStruct19BytesHomogeneousUint8x10CalculateResult();
print("result = $result");
return result;
}
void passStruct19BytesHomogeneousUint8x10AfterCallback() {
final result = passStruct19BytesHomogeneousUint8x10CalculateResult();
print("after callback result = $result");
Expect.equals(18145, result);
}
typedef PassStruct20BytesHomogeneousInt32x10Type = Int32 Function(
Struct20BytesHomogeneousInt32,
Struct20BytesHomogeneousInt32,
Struct20BytesHomogeneousInt32,
Struct20BytesHomogeneousInt32,
Struct20BytesHomogeneousInt32,
Struct20BytesHomogeneousInt32,
Struct20BytesHomogeneousInt32,
Struct20BytesHomogeneousInt32,
Struct20BytesHomogeneousInt32,
Struct20BytesHomogeneousInt32);
// Global variables to be able to test inputs after callback returned.
Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a0 =
Pointer<Struct20BytesHomogeneousInt32>.fromAddress(0).ref;
Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a1 =
Pointer<Struct20BytesHomogeneousInt32>.fromAddress(0).ref;
Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a2 =
Pointer<Struct20BytesHomogeneousInt32>.fromAddress(0).ref;
Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a3 =
Pointer<Struct20BytesHomogeneousInt32>.fromAddress(0).ref;
Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a4 =
Pointer<Struct20BytesHomogeneousInt32>.fromAddress(0).ref;
Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a5 =
Pointer<Struct20BytesHomogeneousInt32>.fromAddress(0).ref;
Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a6 =
Pointer<Struct20BytesHomogeneousInt32>.fromAddress(0).ref;
Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a7 =
Pointer<Struct20BytesHomogeneousInt32>.fromAddress(0).ref;
Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a8 =
Pointer<Struct20BytesHomogeneousInt32>.fromAddress(0).ref;
Struct20BytesHomogeneousInt32 passStruct20BytesHomogeneousInt32x10_a9 =
Pointer<Struct20BytesHomogeneousInt32>.fromAddress(0).ref;
// Result variable also global, so we can delete it after the callback.
int passStruct20BytesHomogeneousInt32x10Result = 0;
int passStruct20BytesHomogeneousInt32x10CalculateResult() {
int result = 0;
result += passStruct20BytesHomogeneousInt32x10_a0.a0;
result += passStruct20BytesHomogeneousInt32x10_a0.a1;
result += passStruct20BytesHomogeneousInt32x10_a0.a2;
result += passStruct20BytesHomogeneousInt32x10_a0.a3;
result += passStruct20BytesHomogeneousInt32x10_a0.a4;
result += passStruct20BytesHomogeneousInt32x10_a1.a0;
result += passStruct20BytesHomogeneousInt32x10_a1.a1;
result += passStruct20BytesHomogeneousInt32x10_a1.a2;
result += passStruct20BytesHomogeneousInt32x10_a1.a3;
result += passStruct20BytesHomogeneousInt32x10_a1.a4;
result += passStruct20BytesHomogeneousInt32x10_a2.a0;
result += passStruct20BytesHomogeneousInt32x10_a2.a1;
result += passStruct20BytesHomogeneousInt32x10_a2.a2;
result += passStruct20BytesHomogeneousInt32x10_a2.a3;
result += passStruct20BytesHomogeneousInt32x10_a2.a4;
result += passStruct20BytesHomogeneousInt32x10_a3.a0;
result += passStruct20BytesHomogeneousInt32x10_a3.a1;
result += passStruct20BytesHomogeneousInt32x10_a3.a2;
result += passStruct20BytesHomogeneousInt32x10_a3.a3;
result += passStruct20BytesHomogeneousInt32x10_a3.a4;
result += passStruct20BytesHomogeneousInt32x10_a4.a0;
result += passStruct20BytesHomogeneousInt32x10_a4.a1;
result += passStruct20BytesHomogeneousInt32x10_a4.a2;
result += passStruct20BytesHomogeneousInt32x10_a4.a3;
result += passStruct20BytesHomogeneousInt32x10_a4.a4;
result += passStruct20BytesHomogeneousInt32x10_a5.a0;
result += passStruct20BytesHomogeneousInt32x10_a5.a1;
result += passStruct20BytesHomogeneousInt32x10_a5.a2;
result += passStruct20BytesHomogeneousInt32x10_a5.a3;
result += passStruct20BytesHomogeneousInt32x10_a5.a4;
result += passStruct20BytesHomogeneousInt32x10_a6.a0;
result += passStruct20BytesHomogeneousInt32x10_a6.a1;
result += passStruct20BytesHomogeneousInt32x10_a6.a2;
result += passStruct20BytesHomogeneousInt32x10_a6.a3;
result += passStruct20BytesHomogeneousInt32x10_a6.a4;
result += passStruct20BytesHomogeneousInt32x10_a7.a0;
result += passStruct20BytesHomogeneousInt32x10_a7.a1;
result += passStruct20BytesHomogeneousInt32x10_a7.a2;
result += passStruct20BytesHomogeneousInt32x10_a7.a3;
result += passStruct20BytesHomogeneousInt32x10_a7.a4;
result += passStruct20BytesHomogeneousInt32x10_a8.a0;
result += passStruct20BytesHomogeneousInt32x10_a8.a1;
result += passStruct20BytesHomogeneousInt32x10_a8.a2;
result += passStruct20BytesHomogeneousInt32x10_a8.a3;
result += passStruct20BytesHomogeneousInt32x10_a8.a4;
result += passStruct20BytesHomogeneousInt32x10_a9.a0;
result += passStruct20BytesHomogeneousInt32x10_a9.a1;
result += passStruct20BytesHomogeneousInt32x10_a9.a2;
result += passStruct20BytesHomogeneousInt32x10_a9.a3;
result += passStruct20BytesHomogeneousInt32x10_a9.a4;
passStruct20BytesHomogeneousInt32x10Result = result;
return result;
}
/// Argument too big to go into integer registers on arm64.
/// The arguments are passed as pointers to copies.
/// The amount of arguments exhausts the number of integer registers, such that
/// pointers to copies are also passed on the stack.
int passStruct20BytesHomogeneousInt32x10(
Struct20BytesHomogeneousInt32 a0,
Struct20BytesHomogeneousInt32 a1,
Struct20BytesHomogeneousInt32 a2,
Struct20BytesHomogeneousInt32 a3,
Struct20BytesHomogeneousInt32 a4,
Struct20BytesHomogeneousInt32 a5,
Struct20BytesHomogeneousInt32 a6,
Struct20BytesHomogeneousInt32 a7,
Struct20BytesHomogeneousInt32 a8,
Struct20BytesHomogeneousInt32 a9) {
print(
"passStruct20BytesHomogeneousInt32x10(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})");
// Possibly throw.
if (a0.a0 == 42 || a0.a0 == 84) {
print("throwing!");
throw Exception(
"PassStruct20BytesHomogeneousInt32x10 throwing on purpose!");
}
passStruct20BytesHomogeneousInt32x10_a0 = a0;
passStruct20BytesHomogeneousInt32x10_a1 = a1;
passStruct20BytesHomogeneousInt32x10_a2 = a2;
passStruct20BytesHomogeneousInt32x10_a3 = a3;
passStruct20BytesHomogeneousInt32x10_a4 = a4;
passStruct20BytesHomogeneousInt32x10_a5 = a5;
passStruct20BytesHomogeneousInt32x10_a6 = a6;
passStruct20BytesHomogeneousInt32x10_a7 = a7;
passStruct20BytesHomogeneousInt32x10_a8 = a8;
passStruct20BytesHomogeneousInt32x10_a9 = a9;
final result = passStruct20BytesHomogeneousInt32x10CalculateResult();
print("result = $result");
return result;
}
void passStruct20BytesHomogeneousInt32x10AfterCallback() {
final result = passStruct20BytesHomogeneousInt32x10CalculateResult();
print("after callback result = $result");
Expect.equals(25, result);
}
typedef PassStruct20BytesHomogeneousFloatType = Float Function(
Struct20BytesHomogeneousFloat);
// Global variables to be able to test inputs after callback returned.
Struct20BytesHomogeneousFloat passStruct20BytesHomogeneousFloat_a0 =
Pointer<Struct20BytesHomogeneousFloat>.fromAddress(0).ref;
// Result variable also global, so we can delete it after the callback.
double passStruct20BytesHomogeneousFloatResult = 0.0;
double passStruct20BytesHomogeneousFloatCalculateResult() {
double result = 0;
result += passStruct20BytesHomogeneousFloat_a0.a0;
result += passStruct20BytesHomogeneousFloat_a0.a1;
result += passStruct20BytesHomogeneousFloat_a0.a2;
result += passStruct20BytesHomogeneousFloat_a0.a3;
result += passStruct20BytesHomogeneousFloat_a0.a4;
passStruct20BytesHomogeneousFloatResult = result;
return result;
}
/// Argument too big to go into FPU registers in hardfp and arm64.
double passStruct20BytesHomogeneousFloat(Struct20BytesHomogeneousFloat a0) {
print("passStruct20BytesHomogeneousFloat(${a0})");
// Possibly throw.
if (a0.a0 == 42 || a0.a0 == 84) {
print("throwing!");
throw Exception("PassStruct20BytesHomogeneousFloat throwing on purpose!");
}
passStruct20BytesHomogeneousFloat_a0 = a0;
final result = passStruct20BytesHomogeneousFloatCalculateResult();
print("result = $result");
return result;
}
void passStruct20BytesHomogeneousFloatAfterCallback() {
final result = passStruct20BytesHomogeneousFloatCalculateResult();
print("after callback result = $result");
Expect.approxEquals(-3.0, result);
}
typedef PassStruct32BytesHomogeneousDoublex5Type = Double Function(
Struct32BytesHomogeneousDouble,
Struct32BytesHomogeneousDouble,
Struct32BytesHomogeneousDouble,
Struct32BytesHomogeneousDouble,
Struct32BytesHomogeneousDouble);
// Global variables to be able to test inputs after callback returned.
Struct32BytesHomogeneousDouble passStruct32BytesHomogeneousDoublex5_a0 =
Pointer<Struct32BytesHomogeneousDouble>.fromAddress(0).ref;
Struct32BytesHomogeneousDouble passStruct32BytesHomogeneousDoublex5_a1 =
Pointer<Struct32BytesHomogeneousDouble>.fromAddress(0).ref;
Struct32BytesHomogeneousDouble passStruct32BytesHomogeneousDoublex5_a2 =
Pointer<Struct32BytesHomogeneousDouble>.fromAddress(0).ref;
Struct32BytesHomogeneousDouble passStruct32BytesHomogeneousDoublex5_a3 =
Pointer<Struct32BytesHomogeneousDouble>.fromAddress(0).ref;
Struct32BytesHomogeneousDouble passStruct32BytesHomogeneousDoublex5_a4 =
Pointer<Struct32BytesHomogeneousDouble>.fromAddress(0).ref;
// Result variable also global, so we can delete it after the callback.
double passStruct32BytesHomogeneousDoublex5Result = 0.0;
double passStruct32BytesHomogeneousDoublex5CalculateResult() {
double result = 0;
result += passStruct32BytesHomogeneousDoublex5_a0.a0;
result += passStruct32BytesHomogeneousDoublex5_a0.a1;
result += passStruct32BytesHomogeneousDoublex5_a0.a2;
result += passStruct32BytesHomogeneousDoublex5_a0.a3;
result += passStruct32BytesHomogeneousDoublex5_a1.a0;
result += passStruct32BytesHomogeneousDoublex5_a1.a1;
result += passStruct32BytesHomogeneousDoublex5_a1.a2;
result += passStruct32BytesHomogeneousDoublex5_a1.a3;
result += passStruct32BytesHomogeneousDoublex5_a2.a0;
result += passStruct32BytesHomogeneousDoublex5_a2.a1;
result += passStruct32BytesHomogeneousDoublex5_a2.a2;
result += passStruct32BytesHomogeneousDoublex5_a2.a3;
result += passStruct32BytesHomogeneousDoublex5_a3.a0;
result += passStruct32BytesHomogeneousDoublex5_a3.a1;
result += passStruct32BytesHomogeneousDoublex5_a3.a2;
result += passStruct32BytesHomogeneousDoublex5_a3.a3;
result += passStruct32BytesHomogeneousDoublex5_a4.a0;
result += passStruct32BytesHomogeneousDoublex5_a4.a1;
result += passStruct32BytesHomogeneousDoublex5_a4.a2;
result += passStruct32BytesHomogeneousDoublex5_a4.a3;
passStruct32BytesHomogeneousDoublex5Result = result;
return result;
}
/// Arguments in FPU registers on arm64.
/// 5 struct arguments will exhaust available registers.