blob: 3c58f72786a6ce9e74a656fee93203b0698ff415 [file] [log] [blame] [edit]
// 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.
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
#include <cmath>
#include <iostream>
#include <limits>
#if defined(_WIN32)
#define DART_EXPORT extern "C" __declspec(dllexport)
#else
#define DART_EXPORT \
extern "C" __attribute__((visibility("default"))) __attribute((used))
#endif
namespace dart {
#define CHECK(X) \
if (!(X)) { \
fprintf(stderr, "%s\n", "Check failed: " #X); \
return 1; \
}
#define CHECK_EQ(X, Y) CHECK((X) == (Y))
// Works for positive, negative and zero.
#define CHECK_APPROX(EXPECTED, ACTUAL) \
CHECK(((EXPECTED * 0.99) <= (ACTUAL) && (EXPECTED * 1.01) >= (ACTUAL)) || \
((EXPECTED * 0.99) >= (ACTUAL) && (EXPECTED * 1.01) <= (ACTUAL)))
struct Struct1ByteBool {
bool a0;
};
struct Struct1ByteInt {
int8_t a0;
};
struct Struct3BytesHomogeneousUint8 {
uint8_t a0;
uint8_t a1;
uint8_t a2;
};
struct Struct3BytesInt2ByteAligned {
int16_t a0;
int8_t a1;
};
struct Struct4BytesHomogeneousInt16 {
int16_t a0;
int16_t a1;
};
struct Struct4BytesFloat {
float a0;
};
struct Struct7BytesHomogeneousUint8 {
uint8_t a0;
uint8_t a1;
uint8_t a2;
uint8_t a3;
uint8_t a4;
uint8_t a5;
uint8_t a6;
};
struct Struct7BytesInt4ByteAligned {
int32_t a0;
int16_t a1;
int8_t a2;
};
struct Struct8BytesInt {
int16_t a0;
int16_t a1;
int32_t a2;
};
struct Struct8BytesHomogeneousFloat {
float a0;
float a1;
};
struct Struct8BytesFloat {
double a0;
};
struct Struct8BytesMixed {
float a0;
int16_t a1;
int16_t a2;
};
struct Struct9BytesHomogeneousUint8 {
uint8_t a0;
uint8_t a1;
uint8_t a2;
uint8_t a3;
uint8_t a4;
uint8_t a5;
uint8_t a6;
uint8_t a7;
uint8_t a8;
};
struct Struct9BytesInt4Or8ByteAligned {
int64_t a0;
int8_t a1;
};
struct Struct10BytesHomogeneousBool {
bool a0;
bool a1;
bool a2;
bool a3;
bool a4;
bool a5;
bool a6;
bool a7;
bool a8;
bool a9;
};
struct Struct12BytesHomogeneousFloat {
float a0;
float a1;
float a2;
};
struct Struct12BytesHomogeneousInt32 {
int32_t a0;
int32_t a1;
int32_t a2;
};
struct Struct16BytesHomogeneousFloat {
float a0;
float a1;
float a2;
float a3;
};
struct Struct16BytesMixed {
double a0;
int64_t a1;
};
struct Struct16BytesMixed2 {
float a0;
float a1;
float a2;
int32_t a3;
};
struct Struct17BytesInt {
int64_t a0;
int64_t a1;
int8_t a2;
};
struct Struct19BytesHomogeneousUint8 {
uint8_t a0;
uint8_t a1;
uint8_t a2;
uint8_t a3;
uint8_t a4;
uint8_t a5;
uint8_t a6;
uint8_t a7;
uint8_t a8;
uint8_t a9;
uint8_t a10;
uint8_t a11;
uint8_t a12;
uint8_t a13;
uint8_t a14;
uint8_t a15;
uint8_t a16;
uint8_t a17;
uint8_t a18;
};
struct Struct20BytesHomogeneousInt32 {
int32_t a0;
int32_t a1;
int32_t a2;
int32_t a3;
int32_t a4;
};
struct Struct20BytesHomogeneousFloat {
float a0;
float a1;
float a2;
float a3;
float a4;
};
struct Struct32BytesHomogeneousDouble {
double a0;
double a1;
double a2;
double a3;
};
struct Struct40BytesHomogeneousDouble {
double a0;
double a1;
double a2;
double a3;
double a4;
};
struct Struct1024BytesHomogeneousUint64 {
uint64_t a0;
uint64_t a1;
uint64_t a2;
uint64_t a3;
uint64_t a4;
uint64_t a5;
uint64_t a6;
uint64_t a7;
uint64_t a8;
uint64_t a9;
uint64_t a10;
uint64_t a11;
uint64_t a12;
uint64_t a13;
uint64_t a14;
uint64_t a15;
uint64_t a16;
uint64_t a17;
uint64_t a18;
uint64_t a19;
uint64_t a20;
uint64_t a21;
uint64_t a22;
uint64_t a23;
uint64_t a24;
uint64_t a25;
uint64_t a26;
uint64_t a27;
uint64_t a28;
uint64_t a29;
uint64_t a30;
uint64_t a31;
uint64_t a32;
uint64_t a33;
uint64_t a34;
uint64_t a35;
uint64_t a36;
uint64_t a37;
uint64_t a38;
uint64_t a39;
uint64_t a40;
uint64_t a41;
uint64_t a42;
uint64_t a43;
uint64_t a44;
uint64_t a45;
uint64_t a46;
uint64_t a47;
uint64_t a48;
uint64_t a49;
uint64_t a50;
uint64_t a51;
uint64_t a52;
uint64_t a53;
uint64_t a54;
uint64_t a55;
uint64_t a56;
uint64_t a57;
uint64_t a58;
uint64_t a59;
uint64_t a60;
uint64_t a61;
uint64_t a62;
uint64_t a63;
uint64_t a64;
uint64_t a65;
uint64_t a66;
uint64_t a67;
uint64_t a68;
uint64_t a69;
uint64_t a70;
uint64_t a71;
uint64_t a72;
uint64_t a73;
uint64_t a74;
uint64_t a75;
uint64_t a76;
uint64_t a77;
uint64_t a78;
uint64_t a79;
uint64_t a80;
uint64_t a81;
uint64_t a82;
uint64_t a83;
uint64_t a84;
uint64_t a85;
uint64_t a86;
uint64_t a87;
uint64_t a88;
uint64_t a89;
uint64_t a90;
uint64_t a91;
uint64_t a92;
uint64_t a93;
uint64_t a94;
uint64_t a95;
uint64_t a96;
uint64_t a97;
uint64_t a98;
uint64_t a99;
uint64_t a100;
uint64_t a101;
uint64_t a102;
uint64_t a103;
uint64_t a104;
uint64_t a105;
uint64_t a106;
uint64_t a107;
uint64_t a108;
uint64_t a109;
uint64_t a110;
uint64_t a111;
uint64_t a112;
uint64_t a113;
uint64_t a114;
uint64_t a115;
uint64_t a116;
uint64_t a117;
uint64_t a118;
uint64_t a119;
uint64_t a120;
uint64_t a121;
uint64_t a122;
uint64_t a123;
uint64_t a124;
uint64_t a125;
uint64_t a126;
uint64_t a127;
};
struct StructAlignmentInt16 {
int8_t a0;
int16_t a1;
int8_t a2;
};
struct StructAlignmentInt32 {
int8_t a0;
int32_t a1;
int8_t a2;
};
struct StructAlignmentInt64 {
int8_t a0;
int64_t a1;
int8_t a2;
};
struct Struct8BytesNestedInt {
Struct4BytesHomogeneousInt16 a0;
Struct4BytesHomogeneousInt16 a1;
};
struct Struct8BytesNestedFloat {
Struct4BytesFloat a0;
Struct4BytesFloat a1;
};
struct Struct8BytesNestedFloat2 {
Struct4BytesFloat a0;
float a1;
};
struct Struct8BytesNestedMixed {
Struct4BytesHomogeneousInt16 a0;
Struct4BytesFloat a1;
};
struct Struct16BytesNestedInt {
Struct8BytesNestedInt a0;
Struct8BytesNestedInt a1;
};
struct Struct32BytesNestedInt {
Struct16BytesNestedInt a0;
Struct16BytesNestedInt a1;
};
struct StructNestedIntStructAlignmentInt16 {
StructAlignmentInt16 a0;
StructAlignmentInt16 a1;
};
struct StructNestedIntStructAlignmentInt32 {
StructAlignmentInt32 a0;
StructAlignmentInt32 a1;
};
struct StructNestedIntStructAlignmentInt64 {
StructAlignmentInt64 a0;
StructAlignmentInt64 a1;
};
struct StructNestedIrregularBig {
uint16_t a0;
Struct8BytesNestedMixed a1;
uint16_t a2;
Struct8BytesNestedFloat2 a3;
uint16_t a4;
Struct8BytesNestedFloat a5;
uint16_t a6;
};
struct StructNestedIrregularBigger {
StructNestedIrregularBig a0;
Struct8BytesNestedMixed a1;
float a2;
double a3;
};
struct StructNestedIrregularEvenBigger {
uint64_t a0;
StructNestedIrregularBigger a1;
StructNestedIrregularBigger a2;
double a3;
};
struct Struct8BytesInlineArrayInt {
uint8_t a0[8];
};
struct Struct10BytesInlineArrayBool {
bool a0[10];
};
struct StructInlineArrayIrregular {
Struct3BytesInt2ByteAligned a0[2];
uint8_t a1;
};
struct StructInlineArray100Bytes {
uint8_t a0[100];
};
struct StructInlineArrayBig {
uint32_t a0;
uint32_t a1;
uint8_t a2[4000];
};
struct StructStruct16BytesHomogeneousFloat2 {
Struct4BytesFloat a0;
Struct4BytesFloat a1[2];
float a2;
};
struct StructStruct32BytesHomogeneousDouble2 {
Struct8BytesFloat a0;
Struct8BytesFloat a1[2];
double a2;
};
struct StructStruct16BytesMixed3 {
Struct4BytesFloat a0;
Struct8BytesMixed a1[1];
int16_t a2[2];
};
struct Struct8BytesInlineArrayMultiDimensionalInt {
uint8_t a0[2][2][2];
};
struct Struct32BytesInlineArrayMultiDimensionalInt {
uint8_t a0[2][2][2][2][2];
};
struct Struct64BytesInlineArrayMultiDimensionalInt {
uint8_t a0[2][2][2][2][2][2];
};
struct Struct4BytesInlineArrayMultiDimensionalInt {
Struct1ByteInt a0[2][2];
};
#pragma pack(push, 1)
struct Struct3BytesPackedInt {
int8_t a0;
int16_t a1;
};
#pragma pack(pop)
#pragma pack(push, 1)
struct Struct3BytesPackedIntMembersAligned {
int8_t a0;
int16_t a1;
};
#pragma pack(pop)
#pragma pack(push, 1)
struct Struct5BytesPackedMixed {
float a0;
uint8_t a1;
};
#pragma pack(pop)
struct StructNestedAlignmentStruct5BytesPackedMixed {
uint8_t a0;
Struct5BytesPackedMixed a1;
};
struct Struct6BytesInlineArrayInt {
Struct3BytesPackedIntMembersAligned a0[2];
};
#pragma pack(push, 1)
struct Struct8BytesPackedInt {
uint8_t a0;
uint32_t a1;
uint8_t a2;
uint8_t a3;
uint8_t a4;
};
#pragma pack(pop)
#pragma pack(push, 1)
struct Struct9BytesPackedMixed {
uint8_t a0;
double a1;
};
#pragma pack(pop)
struct Struct15BytesInlineArrayMixed {
Struct5BytesPackedMixed a0[3];
};
union Union4BytesMixed {
uint32_t a0;
float a1;
};
union Union8BytesNestedFloat {
double a0;
Struct8BytesHomogeneousFloat a1;
};
union Union9BytesNestedInt {
Struct8BytesInt a0;
Struct9BytesHomogeneousUint8 a1;
};
union Union16BytesNestedInlineArrayFloat {
float a0[4];
Struct16BytesHomogeneousFloat a1;
};
union Union16BytesNestedFloat {
Struct8BytesHomogeneousFloat a0;
Struct12BytesHomogeneousFloat a1;
Struct16BytesHomogeneousFloat a2;
};
struct StructInlineArrayInt {
wchar_t a0[10];
};
struct StructInlineArrayVariable {
uint32_t a0;
uint8_t a1[];
};
struct StructInlineArrayVariableNested {
uint32_t a0;
uint8_t a1[][2][2];
};
struct StructInlineArrayVariableNestedDeep {
uint32_t a0;
uint8_t a1[][2][2][2][2][2][2];
};
struct StructInlineArrayVariableAlign {
uint8_t a0;
uint32_t a1[];
};
struct StructInlineArrayVariable2 {
uint32_t a0;
uint8_t a1[1];
};
struct StructInlineArrayVariableNested2 {
uint32_t a0;
uint8_t a1[1][2][2];
};
struct StructInlineArrayVariableNestedDeep2 {
uint32_t a0;
uint8_t a1[1][2][2][2][2][2][2];
};
// Used for testing the size of Struct1ByteBool.
DART_EXPORT uint64_t SizeOfStruct1ByteBool() {
std::cout << "SizeOfStruct1ByteBool"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct1ByteBool);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct1ByteInt.
DART_EXPORT uint64_t SizeOfStruct1ByteInt() {
std::cout << "SizeOfStruct1ByteInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct1ByteInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct3BytesHomogeneousUint8.
DART_EXPORT uint64_t SizeOfStruct3BytesHomogeneousUint8() {
std::cout << "SizeOfStruct3BytesHomogeneousUint8"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct3BytesHomogeneousUint8);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct3BytesInt2ByteAligned.
DART_EXPORT uint64_t SizeOfStruct3BytesInt2ByteAligned() {
std::cout << "SizeOfStruct3BytesInt2ByteAligned"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct3BytesInt2ByteAligned);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct4BytesHomogeneousInt16.
DART_EXPORT uint64_t SizeOfStruct4BytesHomogeneousInt16() {
std::cout << "SizeOfStruct4BytesHomogeneousInt16"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct4BytesHomogeneousInt16);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct4BytesFloat.
DART_EXPORT uint64_t SizeOfStruct4BytesFloat() {
std::cout << "SizeOfStruct4BytesFloat"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct4BytesFloat);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct7BytesHomogeneousUint8.
DART_EXPORT uint64_t SizeOfStruct7BytesHomogeneousUint8() {
std::cout << "SizeOfStruct7BytesHomogeneousUint8"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct7BytesHomogeneousUint8);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct7BytesInt4ByteAligned.
DART_EXPORT uint64_t SizeOfStruct7BytesInt4ByteAligned() {
std::cout << "SizeOfStruct7BytesInt4ByteAligned"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct7BytesInt4ByteAligned);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesInt.
DART_EXPORT uint64_t SizeOfStruct8BytesInt() {
std::cout << "SizeOfStruct8BytesInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesHomogeneousFloat.
DART_EXPORT uint64_t SizeOfStruct8BytesHomogeneousFloat() {
std::cout << "SizeOfStruct8BytesHomogeneousFloat"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesHomogeneousFloat);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesFloat.
DART_EXPORT uint64_t SizeOfStruct8BytesFloat() {
std::cout << "SizeOfStruct8BytesFloat"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesFloat);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesMixed.
DART_EXPORT uint64_t SizeOfStruct8BytesMixed() {
std::cout << "SizeOfStruct8BytesMixed"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesMixed);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct9BytesHomogeneousUint8.
DART_EXPORT uint64_t SizeOfStruct9BytesHomogeneousUint8() {
std::cout << "SizeOfStruct9BytesHomogeneousUint8"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct9BytesHomogeneousUint8);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct9BytesInt4Or8ByteAligned.
DART_EXPORT uint64_t SizeOfStruct9BytesInt4Or8ByteAligned() {
std::cout << "SizeOfStruct9BytesInt4Or8ByteAligned"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct9BytesInt4Or8ByteAligned);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct10BytesHomogeneousBool.
DART_EXPORT uint64_t SizeOfStruct10BytesHomogeneousBool() {
std::cout << "SizeOfStruct10BytesHomogeneousBool"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct10BytesHomogeneousBool);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct12BytesHomogeneousFloat.
DART_EXPORT uint64_t SizeOfStruct12BytesHomogeneousFloat() {
std::cout << "SizeOfStruct12BytesHomogeneousFloat"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct12BytesHomogeneousFloat);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct12BytesHomogeneousInt32.
DART_EXPORT uint64_t SizeOfStruct12BytesHomogeneousInt32() {
std::cout << "SizeOfStruct12BytesHomogeneousInt32"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct12BytesHomogeneousInt32);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct16BytesHomogeneousFloat.
DART_EXPORT uint64_t SizeOfStruct16BytesHomogeneousFloat() {
std::cout << "SizeOfStruct16BytesHomogeneousFloat"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct16BytesHomogeneousFloat);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct16BytesMixed.
DART_EXPORT uint64_t SizeOfStruct16BytesMixed() {
std::cout << "SizeOfStruct16BytesMixed"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct16BytesMixed);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct16BytesMixed2.
DART_EXPORT uint64_t SizeOfStruct16BytesMixed2() {
std::cout << "SizeOfStruct16BytesMixed2"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct16BytesMixed2);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct17BytesInt.
DART_EXPORT uint64_t SizeOfStruct17BytesInt() {
std::cout << "SizeOfStruct17BytesInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct17BytesInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct19BytesHomogeneousUint8.
DART_EXPORT uint64_t SizeOfStruct19BytesHomogeneousUint8() {
std::cout << "SizeOfStruct19BytesHomogeneousUint8"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct19BytesHomogeneousUint8);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct20BytesHomogeneousInt32.
DART_EXPORT uint64_t SizeOfStruct20BytesHomogeneousInt32() {
std::cout << "SizeOfStruct20BytesHomogeneousInt32"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct20BytesHomogeneousInt32);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct20BytesHomogeneousFloat.
DART_EXPORT uint64_t SizeOfStruct20BytesHomogeneousFloat() {
std::cout << "SizeOfStruct20BytesHomogeneousFloat"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct20BytesHomogeneousFloat);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct32BytesHomogeneousDouble.
DART_EXPORT uint64_t SizeOfStruct32BytesHomogeneousDouble() {
std::cout << "SizeOfStruct32BytesHomogeneousDouble"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct32BytesHomogeneousDouble);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct40BytesHomogeneousDouble.
DART_EXPORT uint64_t SizeOfStruct40BytesHomogeneousDouble() {
std::cout << "SizeOfStruct40BytesHomogeneousDouble"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct40BytesHomogeneousDouble);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct1024BytesHomogeneousUint64.
DART_EXPORT uint64_t SizeOfStruct1024BytesHomogeneousUint64() {
std::cout << "SizeOfStruct1024BytesHomogeneousUint64"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct1024BytesHomogeneousUint64);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructAlignmentInt16.
DART_EXPORT uint64_t SizeOfStructAlignmentInt16() {
std::cout << "SizeOfStructAlignmentInt16"
<< "()"
<< "\n";
uint64_t result = sizeof(StructAlignmentInt16);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructAlignmentInt32.
DART_EXPORT uint64_t SizeOfStructAlignmentInt32() {
std::cout << "SizeOfStructAlignmentInt32"
<< "()"
<< "\n";
uint64_t result = sizeof(StructAlignmentInt32);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructAlignmentInt64.
DART_EXPORT uint64_t SizeOfStructAlignmentInt64() {
std::cout << "SizeOfStructAlignmentInt64"
<< "()"
<< "\n";
uint64_t result = sizeof(StructAlignmentInt64);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesNestedInt.
DART_EXPORT uint64_t SizeOfStruct8BytesNestedInt() {
std::cout << "SizeOfStruct8BytesNestedInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesNestedInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesNestedFloat.
DART_EXPORT uint64_t SizeOfStruct8BytesNestedFloat() {
std::cout << "SizeOfStruct8BytesNestedFloat"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesNestedFloat);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesNestedFloat2.
DART_EXPORT uint64_t SizeOfStruct8BytesNestedFloat2() {
std::cout << "SizeOfStruct8BytesNestedFloat2"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesNestedFloat2);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesNestedMixed.
DART_EXPORT uint64_t SizeOfStruct8BytesNestedMixed() {
std::cout << "SizeOfStruct8BytesNestedMixed"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesNestedMixed);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct16BytesNestedInt.
DART_EXPORT uint64_t SizeOfStruct16BytesNestedInt() {
std::cout << "SizeOfStruct16BytesNestedInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct16BytesNestedInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct32BytesNestedInt.
DART_EXPORT uint64_t SizeOfStruct32BytesNestedInt() {
std::cout << "SizeOfStruct32BytesNestedInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct32BytesNestedInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructNestedIntStructAlignmentInt16.
DART_EXPORT uint64_t SizeOfStructNestedIntStructAlignmentInt16() {
std::cout << "SizeOfStructNestedIntStructAlignmentInt16"
<< "()"
<< "\n";
uint64_t result = sizeof(StructNestedIntStructAlignmentInt16);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructNestedIntStructAlignmentInt32.
DART_EXPORT uint64_t SizeOfStructNestedIntStructAlignmentInt32() {
std::cout << "SizeOfStructNestedIntStructAlignmentInt32"
<< "()"
<< "\n";
uint64_t result = sizeof(StructNestedIntStructAlignmentInt32);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructNestedIntStructAlignmentInt64.
DART_EXPORT uint64_t SizeOfStructNestedIntStructAlignmentInt64() {
std::cout << "SizeOfStructNestedIntStructAlignmentInt64"
<< "()"
<< "\n";
uint64_t result = sizeof(StructNestedIntStructAlignmentInt64);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructNestedIrregularBig.
DART_EXPORT uint64_t SizeOfStructNestedIrregularBig() {
std::cout << "SizeOfStructNestedIrregularBig"
<< "()"
<< "\n";
uint64_t result = sizeof(StructNestedIrregularBig);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructNestedIrregularBigger.
DART_EXPORT uint64_t SizeOfStructNestedIrregularBigger() {
std::cout << "SizeOfStructNestedIrregularBigger"
<< "()"
<< "\n";
uint64_t result = sizeof(StructNestedIrregularBigger);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructNestedIrregularEvenBigger.
DART_EXPORT uint64_t SizeOfStructNestedIrregularEvenBigger() {
std::cout << "SizeOfStructNestedIrregularEvenBigger"
<< "()"
<< "\n";
uint64_t result = sizeof(StructNestedIrregularEvenBigger);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesInlineArrayInt.
DART_EXPORT uint64_t SizeOfStruct8BytesInlineArrayInt() {
std::cout << "SizeOfStruct8BytesInlineArrayInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesInlineArrayInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct10BytesInlineArrayBool.
DART_EXPORT uint64_t SizeOfStruct10BytesInlineArrayBool() {
std::cout << "SizeOfStruct10BytesInlineArrayBool"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct10BytesInlineArrayBool);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArrayIrregular.
DART_EXPORT uint64_t SizeOfStructInlineArrayIrregular() {
std::cout << "SizeOfStructInlineArrayIrregular"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArrayIrregular);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArray100Bytes.
DART_EXPORT uint64_t SizeOfStructInlineArray100Bytes() {
std::cout << "SizeOfStructInlineArray100Bytes"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArray100Bytes);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArrayBig.
DART_EXPORT uint64_t SizeOfStructInlineArrayBig() {
std::cout << "SizeOfStructInlineArrayBig"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArrayBig);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructStruct16BytesHomogeneousFloat2.
DART_EXPORT uint64_t SizeOfStructStruct16BytesHomogeneousFloat2() {
std::cout << "SizeOfStructStruct16BytesHomogeneousFloat2"
<< "()"
<< "\n";
uint64_t result = sizeof(StructStruct16BytesHomogeneousFloat2);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructStruct32BytesHomogeneousDouble2.
DART_EXPORT uint64_t SizeOfStructStruct32BytesHomogeneousDouble2() {
std::cout << "SizeOfStructStruct32BytesHomogeneousDouble2"
<< "()"
<< "\n";
uint64_t result = sizeof(StructStruct32BytesHomogeneousDouble2);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructStruct16BytesMixed3.
DART_EXPORT uint64_t SizeOfStructStruct16BytesMixed3() {
std::cout << "SizeOfStructStruct16BytesMixed3"
<< "()"
<< "\n";
uint64_t result = sizeof(StructStruct16BytesMixed3);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesInlineArrayMultiDimensionalInt.
DART_EXPORT uint64_t SizeOfStruct8BytesInlineArrayMultiDimensionalInt() {
std::cout << "SizeOfStruct8BytesInlineArrayMultiDimensionalInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesInlineArrayMultiDimensionalInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct32BytesInlineArrayMultiDimensionalInt.
DART_EXPORT uint64_t SizeOfStruct32BytesInlineArrayMultiDimensionalInt() {
std::cout << "SizeOfStruct32BytesInlineArrayMultiDimensionalInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct32BytesInlineArrayMultiDimensionalInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct64BytesInlineArrayMultiDimensionalInt.
DART_EXPORT uint64_t SizeOfStruct64BytesInlineArrayMultiDimensionalInt() {
std::cout << "SizeOfStruct64BytesInlineArrayMultiDimensionalInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct64BytesInlineArrayMultiDimensionalInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct4BytesInlineArrayMultiDimensionalInt.
DART_EXPORT uint64_t SizeOfStruct4BytesInlineArrayMultiDimensionalInt() {
std::cout << "SizeOfStruct4BytesInlineArrayMultiDimensionalInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct4BytesInlineArrayMultiDimensionalInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct3BytesPackedInt.
DART_EXPORT uint64_t SizeOfStruct3BytesPackedInt() {
std::cout << "SizeOfStruct3BytesPackedInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct3BytesPackedInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct3BytesPackedIntMembersAligned.
DART_EXPORT uint64_t SizeOfStruct3BytesPackedIntMembersAligned() {
std::cout << "SizeOfStruct3BytesPackedIntMembersAligned"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct3BytesPackedIntMembersAligned);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct5BytesPackedMixed.
DART_EXPORT uint64_t SizeOfStruct5BytesPackedMixed() {
std::cout << "SizeOfStruct5BytesPackedMixed"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct5BytesPackedMixed);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructNestedAlignmentStruct5BytesPackedMixed.
DART_EXPORT uint64_t SizeOfStructNestedAlignmentStruct5BytesPackedMixed() {
std::cout << "SizeOfStructNestedAlignmentStruct5BytesPackedMixed"
<< "()"
<< "\n";
uint64_t result = sizeof(StructNestedAlignmentStruct5BytesPackedMixed);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct6BytesInlineArrayInt.
DART_EXPORT uint64_t SizeOfStruct6BytesInlineArrayInt() {
std::cout << "SizeOfStruct6BytesInlineArrayInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct6BytesInlineArrayInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct8BytesPackedInt.
DART_EXPORT uint64_t SizeOfStruct8BytesPackedInt() {
std::cout << "SizeOfStruct8BytesPackedInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct8BytesPackedInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct9BytesPackedMixed.
DART_EXPORT uint64_t SizeOfStruct9BytesPackedMixed() {
std::cout << "SizeOfStruct9BytesPackedMixed"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct9BytesPackedMixed);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Struct15BytesInlineArrayMixed.
DART_EXPORT uint64_t SizeOfStruct15BytesInlineArrayMixed() {
std::cout << "SizeOfStruct15BytesInlineArrayMixed"
<< "()"
<< "\n";
uint64_t result = sizeof(Struct15BytesInlineArrayMixed);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Union4BytesMixed.
DART_EXPORT uint64_t SizeOfUnion4BytesMixed() {
std::cout << "SizeOfUnion4BytesMixed"
<< "()"
<< "\n";
uint64_t result = sizeof(Union4BytesMixed);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Union8BytesNestedFloat.
DART_EXPORT uint64_t SizeOfUnion8BytesNestedFloat() {
std::cout << "SizeOfUnion8BytesNestedFloat"
<< "()"
<< "\n";
uint64_t result = sizeof(Union8BytesNestedFloat);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Union9BytesNestedInt.
DART_EXPORT uint64_t SizeOfUnion9BytesNestedInt() {
std::cout << "SizeOfUnion9BytesNestedInt"
<< "()"
<< "\n";
uint64_t result = sizeof(Union9BytesNestedInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Union16BytesNestedInlineArrayFloat.
DART_EXPORT uint64_t SizeOfUnion16BytesNestedInlineArrayFloat() {
std::cout << "SizeOfUnion16BytesNestedInlineArrayFloat"
<< "()"
<< "\n";
uint64_t result = sizeof(Union16BytesNestedInlineArrayFloat);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of Union16BytesNestedFloat.
DART_EXPORT uint64_t SizeOfUnion16BytesNestedFloat() {
std::cout << "SizeOfUnion16BytesNestedFloat"
<< "()"
<< "\n";
uint64_t result = sizeof(Union16BytesNestedFloat);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArrayInt.
DART_EXPORT uint64_t SizeOfStructInlineArrayInt() {
std::cout << "SizeOfStructInlineArrayInt"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArrayInt);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArrayVariable.
DART_EXPORT uint64_t SizeOfStructInlineArrayVariable() {
std::cout << "SizeOfStructInlineArrayVariable"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArrayVariable);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArrayVariableNested.
DART_EXPORT uint64_t SizeOfStructInlineArrayVariableNested() {
std::cout << "SizeOfStructInlineArrayVariableNested"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArrayVariableNested);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArrayVariableNestedDeep.
DART_EXPORT uint64_t SizeOfStructInlineArrayVariableNestedDeep() {
std::cout << "SizeOfStructInlineArrayVariableNestedDeep"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArrayVariableNestedDeep);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArrayVariableAlign.
DART_EXPORT uint64_t SizeOfStructInlineArrayVariableAlign() {
std::cout << "SizeOfStructInlineArrayVariableAlign"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArrayVariableAlign);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArrayVariable2.
DART_EXPORT uint64_t SizeOfStructInlineArrayVariable2() {
std::cout << "SizeOfStructInlineArrayVariable2"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArrayVariable2);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArrayVariableNested2.
DART_EXPORT uint64_t SizeOfStructInlineArrayVariableNested2() {
std::cout << "SizeOfStructInlineArrayVariableNested2"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArrayVariableNested2);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing the size of StructInlineArrayVariableNestedDeep2.
DART_EXPORT uint64_t SizeOfStructInlineArrayVariableNestedDeep2() {
std::cout << "SizeOfStructInlineArrayVariableNestedDeep2"
<< "()"
<< "\n";
uint64_t result = sizeof(StructInlineArrayVariableNestedDeep2);
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// Smallest struct with data.
// 10 struct arguments will exhaust available registers.
DART_EXPORT int64_t PassStruct1ByteIntx10(Struct1ByteInt a0,
Struct1ByteInt a1,
Struct1ByteInt a2,
Struct1ByteInt a3,
Struct1ByteInt a4,
Struct1ByteInt a5,
Struct1ByteInt a6,
Struct1ByteInt a7,
Struct1ByteInt a8,
Struct1ByteInt a9) {
std::cout << "PassStruct1ByteIntx10" << "((" << static_cast<int>(a0.a0)
<< "), (" << static_cast<int>(a1.a0) << "), ("
<< static_cast<int>(a2.a0) << "), (" << static_cast<int>(a3.a0)
<< "), (" << static_cast<int>(a4.a0) << "), ("
<< static_cast<int>(a5.a0) << "), (" << static_cast<int>(a6.a0)
<< "), (" << static_cast<int>(a7.a0) << "), ("
<< static_cast<int>(a8.a0) << "), (" << static_cast<int>(a9.a0)
<< "))" << "\n";
int64_t result = 0;
result += a0.a0;
result += a1.a0;
result += a2.a0;
result += a3.a0;
result += a4.a0;
result += a5.a0;
result += a6.a0;
result += a7.a0;
result += a8.a0;
result += a9.a0;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// Not a multiple of word size, not a power of two.
// 10 struct arguments will exhaust available registers.
DART_EXPORT int64_t
PassStruct3BytesHomogeneousUint8x10(Struct3BytesHomogeneousUint8 a0,
Struct3BytesHomogeneousUint8 a1,
Struct3BytesHomogeneousUint8 a2,
Struct3BytesHomogeneousUint8 a3,
Struct3BytesHomogeneousUint8 a4,
Struct3BytesHomogeneousUint8 a5,
Struct3BytesHomogeneousUint8 a6,
Struct3BytesHomogeneousUint8 a7,
Struct3BytesHomogeneousUint8 a8,
Struct3BytesHomogeneousUint8 a9) {
std::cout << "PassStruct3BytesHomogeneousUint8x10" << "(("
<< static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1)
<< ", " << static_cast<int>(a0.a2) << "), ("
<< static_cast<int>(a1.a0) << ", " << static_cast<int>(a1.a1)
<< ", " << static_cast<int>(a1.a2) << "), ("
<< static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1)
<< ", " << static_cast<int>(a2.a2) << "), ("
<< static_cast<int>(a3.a0) << ", " << static_cast<int>(a3.a1)
<< ", " << static_cast<int>(a3.a2) << "), ("
<< static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1)
<< ", " << static_cast<int>(a4.a2) << "), ("
<< static_cast<int>(a5.a0) << ", " << static_cast<int>(a5.a1)
<< ", " << static_cast<int>(a5.a2) << "), ("
<< static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1)
<< ", " << static_cast<int>(a6.a2) << "), ("
<< static_cast<int>(a7.a0) << ", " << static_cast<int>(a7.a1)
<< ", " << static_cast<int>(a7.a2) << "), ("
<< static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1)
<< ", " << static_cast<int>(a8.a2) << "), ("
<< static_cast<int>(a9.a0) << ", " << static_cast<int>(a9.a1)
<< ", " << static_cast<int>(a9.a2) << "))" << "\n";
int64_t result = 0;
result += a0.a0;
result += a0.a1;
result += a0.a2;
result += a1.a0;
result += a1.a1;
result += a1.a2;
result += a2.a0;
result += a2.a1;
result += a2.a2;
result += a3.a0;
result += a3.a1;
result += a3.a2;
result += a4.a0;
result += a4.a1;
result += a4.a2;
result += a5.a0;
result += a5.a1;
result += a5.a2;
result += a6.a0;
result += a6.a1;
result += a6.a2;
result += a7.a0;
result += a7.a1;
result += a7.a2;
result += a8.a0;
result += a8.a1;
result += a8.a2;
result += a9.a0;
result += a9.a1;
result += a9.a2;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// 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.
DART_EXPORT int64_t
PassStruct3BytesInt2ByteAlignedx10(Struct3BytesInt2ByteAligned a0,
Struct3BytesInt2ByteAligned a1,
Struct3BytesInt2ByteAligned a2,
Struct3BytesInt2ByteAligned a3,
Struct3BytesInt2ByteAligned a4,
Struct3BytesInt2ByteAligned a5,
Struct3BytesInt2ByteAligned a6,
Struct3BytesInt2ByteAligned a7,
Struct3BytesInt2ByteAligned a8,
Struct3BytesInt2ByteAligned a9) {
std::cout << "PassStruct3BytesInt2ByteAlignedx10" << "((" << a0.a0 << ", "
<< static_cast<int>(a0.a1) << "), (" << a1.a0 << ", "
<< static_cast<int>(a1.a1) << "), (" << a2.a0 << ", "
<< static_cast<int>(a2.a1) << "), (" << a3.a0 << ", "
<< static_cast<int>(a3.a1) << "), (" << a4.a0 << ", "
<< static_cast<int>(a4.a1) << "), (" << a5.a0 << ", "
<< static_cast<int>(a5.a1) << "), (" << a6.a0 << ", "
<< static_cast<int>(a6.a1) << "), (" << a7.a0 << ", "
<< static_cast<int>(a7.a1) << "), (" << a8.a0 << ", "
<< static_cast<int>(a8.a1) << "), (" << a9.a0 << ", "
<< static_cast<int>(a9.a1) << "))" << "\n";
int64_t result = 0;
result += a0.a0;
result += a0.a1;
result += a1.a0;
result += a1.a1;
result += a2.a0;
result += a2.a1;
result += a3.a0;
result += a3.a1;
result += a4.a0;
result += a4.a1;
result += a5.a0;
result += a5.a1;
result += a6.a0;
result += a6.a1;
result += a7.a0;
result += a7.a1;
result += a8.a0;
result += a8.a1;
result += a9.a0;
result += a9.a1;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// Exactly word size on 32-bit architectures.
// 10 struct arguments will exhaust available registers.
DART_EXPORT int64_t
PassStruct4BytesHomogeneousInt16x10(Struct4BytesHomogeneousInt16 a0,
Struct4BytesHomogeneousInt16 a1,
Struct4BytesHomogeneousInt16 a2,
Struct4BytesHomogeneousInt16 a3,
Struct4BytesHomogeneousInt16 a4,
Struct4BytesHomogeneousInt16 a5,
Struct4BytesHomogeneousInt16 a6,
Struct4BytesHomogeneousInt16 a7,
Struct4BytesHomogeneousInt16 a8,
Struct4BytesHomogeneousInt16 a9) {
std::cout << "PassStruct4BytesHomogeneousInt16x10" << "((" << a0.a0 << ", "
<< a0.a1 << "), (" << a1.a0 << ", " << a1.a1 << "), (" << a2.a0
<< ", " << a2.a1 << "), (" << a3.a0 << ", " << a3.a1 << "), ("
<< a4.a0 << ", " << a4.a1 << "), (" << a5.a0 << ", " << a5.a1
<< "), (" << a6.a0 << ", " << a6.a1 << "), (" << a7.a0 << ", "
<< a7.a1 << "), (" << a8.a0 << ", " << a8.a1 << "), (" << a9.a0
<< ", " << a9.a1 << "))" << "\n";
int64_t result = 0;
result += a0.a0;
result += a0.a1;
result += a1.a0;
result += a1.a1;
result += a2.a0;
result += a2.a1;
result += a3.a0;
result += a3.a1;
result += a4.a0;
result += a4.a1;
result += a5.a0;
result += a5.a1;
result += a6.a0;
result += a6.a1;
result += a7.a0;
result += a7.a1;
result += a8.a0;
result += a8.a1;
result += a9.a0;
result += a9.a1;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// Sub word size on 64 bit architectures.
// 10 struct arguments will exhaust available registers.
DART_EXPORT int64_t
PassStruct7BytesHomogeneousUint8x10(Struct7BytesHomogeneousUint8 a0,
Struct7BytesHomogeneousUint8 a1,
Struct7BytesHomogeneousUint8 a2,
Struct7BytesHomogeneousUint8 a3,
Struct7BytesHomogeneousUint8 a4,
Struct7BytesHomogeneousUint8 a5,
Struct7BytesHomogeneousUint8 a6,
Struct7BytesHomogeneousUint8 a7,
Struct7BytesHomogeneousUint8 a8,
Struct7BytesHomogeneousUint8 a9) {
std::cout
<< "PassStruct7BytesHomogeneousUint8x10" << "(("
<< static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
<< static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
<< static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
<< static_cast<int>(a0.a6) << "), (" << static_cast<int>(a1.a0) << ", "
<< static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
<< static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
<< static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << "), ("
<< static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
<< static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
<< static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
<< static_cast<int>(a2.a6) << "), (" << static_cast<int>(a3.a0) << ", "
<< static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
<< static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
<< static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << "), ("
<< static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
<< static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
<< static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
<< static_cast<int>(a4.a6) << "), (" << static_cast<int>(a5.a0) << ", "
<< static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
<< static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
<< static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << "), ("
<< static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
<< static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
<< static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
<< static_cast<int>(a6.a6) << "), (" << static_cast<int>(a7.a0) << ", "
<< static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
<< static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
<< static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << "), ("
<< static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
<< static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
<< static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
<< static_cast<int>(a8.a6) << "), (" << static_cast<int>(a9.a0) << ", "
<< static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
<< static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
<< static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << "))"
<< "\n";
int64_t result = 0;
result += a0.a0;
result += a0.a1;
result += a0.a2;
result += a0.a3;
result += a0.a4;
result += a0.a5;
result += a0.a6;
result += a1.a0;
result += a1.a1;
result += a1.a2;
result += a1.a3;
result += a1.a4;
result += a1.a5;
result += a1.a6;
result += a2.a0;
result += a2.a1;
result += a2.a2;
result += a2.a3;
result += a2.a4;
result += a2.a5;
result += a2.a6;
result += a3.a0;
result += a3.a1;
result += a3.a2;
result += a3.a3;
result += a3.a4;
result += a3.a5;
result += a3.a6;
result += a4.a0;
result += a4.a1;
result += a4.a2;
result += a4.a3;
result += a4.a4;
result += a4.a5;
result += a4.a6;
result += a5.a0;
result += a5.a1;
result += a5.a2;
result += a5.a3;
result += a5.a4;
result += a5.a5;
result += a5.a6;
result += a6.a0;
result += a6.a1;
result += a6.a2;
result += a6.a3;
result += a6.a4;
result += a6.a5;
result += a6.a6;
result += a7.a0;
result += a7.a1;
result += a7.a2;
result += a7.a3;
result += a7.a4;
result += a7.a5;
result += a7.a6;
result += a8.a0;
result += a8.a1;
result += a8.a2;
result += a8.a3;
result += a8.a4;
result += a8.a5;
result += a8.a6;
result += a9.a0;
result += a9.a1;
result += a9.a2;
result += a9.a3;
result += a9.a4;
result += a9.a5;
result += a9.a6;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// Sub word size on 64 bit architectures.
// With alignment rules taken into account size is 8 bytes.
// 10 struct arguments will exhaust available registers.
DART_EXPORT int64_t
PassStruct7BytesInt4ByteAlignedx10(Struct7BytesInt4ByteAligned a0,
Struct7BytesInt4ByteAligned a1,
Struct7BytesInt4ByteAligned a2,
Struct7BytesInt4ByteAligned a3,
Struct7BytesInt4ByteAligned a4,
Struct7BytesInt4ByteAligned a5,
Struct7BytesInt4ByteAligned a6,
Struct7BytesInt4ByteAligned a7,
Struct7BytesInt4ByteAligned a8,
Struct7BytesInt4ByteAligned a9) {
std::cout << "PassStruct7BytesInt4ByteAlignedx10" << "((" << a0.a0 << ", "
<< a0.a1 << ", " << static_cast<int>(a0.a2) << "), (" << a1.a0
<< ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "), ("
<< a2.a0 << ", " << a2.a1 << ", " << static_cast<int>(a2.a2)
<< "), (" << a3.a0 << ", " << a3.a1 << ", "
<< static_cast<int>(a3.a2) << "), (" << a4.a0 << ", " << a4.a1
<< ", " << static_cast<int>(a4.a2) << "), (" << a5.a0 << ", "
<< a5.a1 << ", " << static_cast<int>(a5.a2) << "), (" << a6.a0
<< ", " << a6.a1 << ", " << static_cast<int>(a6.a2) << "), ("
<< a7.a0 << ", " << a7.a1 << ", " << static_cast<int>(a7.a2)
<< "), (" << a8.a0 << ", " << a8.a1 << ", "
<< static_cast<int>(a8.a2) << "), (" << a9.a0 << ", " << a9.a1
<< ", " << static_cast<int>(a9.a2) << "))" << "\n";
int64_t result = 0;
result += a0.a0;
result += a0.a1;
result += a0.a2;
result += a1.a0;
result += a1.a1;
result += a1.a2;
result += a2.a0;
result += a2.a1;
result += a2.a2;
result += a3.a0;
result += a3.a1;
result += a3.a2;
result += a4.a0;
result += a4.a1;
result += a4.a2;
result += a5.a0;
result += a5.a1;
result += a5.a2;
result += a6.a0;
result += a6.a1;
result += a6.a2;
result += a7.a0;
result += a7.a1;
result += a7.a2;
result += a8.a0;
result += a8.a1;
result += a8.a2;
result += a9.a0;
result += a9.a1;
result += a9.a2;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// Exactly word size struct on 64bit architectures.
// 10 struct arguments will exhaust available registers.
DART_EXPORT int64_t PassStruct8BytesIntx10(Struct8BytesInt a0,
Struct8BytesInt a1,
Struct8BytesInt a2,
Struct8BytesInt a3,
Struct8BytesInt a4,
Struct8BytesInt a5,
Struct8BytesInt a6,
Struct8BytesInt a7,
Struct8BytesInt a8,
Struct8BytesInt a9) {
std::cout << "PassStruct8BytesIntx10" << "((" << a0.a0 << ", " << a0.a1
<< ", " << a0.a2 << "), (" << a1.a0 << ", " << a1.a1 << ", "
<< a1.a2 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2
<< "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << "), ("
<< a4.a0 << ", " << a4.a1 << ", " << a4.a2 << "), (" << a5.a0
<< ", " << a5.a1 << ", " << a5.a2 << "), (" << a6.a0 << ", "
<< a6.a1 << ", " << a6.a2 << "), (" << a7.a0 << ", " << a7.a1
<< ", " << a7.a2 << "), (" << a8.a0 << ", " << a8.a1 << ", "
<< a8.a2 << "), (" << a9.a0 << ", " << a9.a1 << ", " << a9.a2
<< "))" << "\n";
int64_t result = 0;
result += a0.a0;
result += a0.a1;
result += a0.a2;
result += a1.a0;
result += a1.a1;
result += a1.a2;
result += a2.a0;
result += a2.a1;
result += a2.a2;
result += a3.a0;
result += a3.a1;
result += a3.a2;
result += a4.a0;
result += a4.a1;
result += a4.a2;
result += a5.a0;
result += a5.a1;
result += a5.a2;
result += a6.a0;
result += a6.a1;
result += a6.a2;
result += a7.a0;
result += a7.a1;
result += a7.a2;
result += a8.a0;
result += a8.a1;
result += a8.a2;
result += a9.a0;
result += a9.a1;
result += a9.a2;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// Arguments passed in FP registers as long as they fit.
// 10 struct arguments will exhaust available registers.
DART_EXPORT float PassStruct8BytesHomogeneousFloatx10(
Struct8BytesHomogeneousFloat a0,
Struct8BytesHomogeneousFloat a1,
Struct8BytesHomogeneousFloat a2,
Struct8BytesHomogeneousFloat a3,
Struct8BytesHomogeneousFloat a4,
Struct8BytesHomogeneousFloat a5,
Struct8BytesHomogeneousFloat a6,
Struct8BytesHomogeneousFloat a7,
Struct8BytesHomogeneousFloat a8,
Struct8BytesHomogeneousFloat a9) {
std::cout << "PassStruct8BytesHomogeneousFloatx10" << "((" << a0.a0 << ", "
<< a0.a1 << "), (" << a1.a0 << ", " << a1.a1 << "), (" << a2.a0
<< ", " << a2.a1 << "), (" << a3.a0 << ", " << a3.a1 << "), ("
<< a4.a0 << ", " << a4.a1 << "), (" << a5.a0 << ", " << a5.a1
<< "), (" << a6.a0 << ", " << a6.a1 << "), (" << a7.a0 << ", "
<< a7.a1 << "), (" << a8.a0 << ", " << a8.a1 << "), (" << a9.a0
<< ", " << a9.a1 << "))" << "\n";
float result = 0;
result += a0.a0;
result += a0.a1;
result += a1.a0;
result += a1.a1;
result += a2.a0;
result += a2.a1;
result += a3.a0;
result += a3.a1;
result += a4.a0;
result += a4.a1;
result += a5.a0;
result += a5.a1;
result += a6.a0;
result += a6.a1;
result += a7.a0;
result += a7.a1;
result += a8.a0;
result += a8.a1;
result += a9.a0;
result += a9.a1;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// On x64, arguments go in int registers because it is not only float.
// 10 struct arguments will exhaust available registers.
DART_EXPORT float PassStruct8BytesMixedx10(Struct8BytesMixed a0,
Struct8BytesMixed a1,
Struct8BytesMixed a2,
Struct8BytesMixed a3,
Struct8BytesMixed a4,
Struct8BytesMixed a5,
Struct8BytesMixed a6,
Struct8BytesMixed a7,
Struct8BytesMixed a8,
Struct8BytesMixed a9) {
std::cout << "PassStruct8BytesMixedx10" << "((" << a0.a0 << ", " << a0.a1
<< ", " << a0.a2 << "), (" << a1.a0 << ", " << a1.a1 << ", "
<< a1.a2 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2
<< "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << "), ("
<< a4.a0 << ", " << a4.a1 << ", " << a4.a2 << "), (" << a5.a0
<< ", " << a5.a1 << ", " << a5.a2 << "), (" << a6.a0 << ", "
<< a6.a1 << ", " << a6.a2 << "), (" << a7.a0 << ", " << a7.a1
<< ", " << a7.a2 << "), (" << a8.a0 << ", " << a8.a1 << ", "
<< a8.a2 << "), (" << a9.a0 << ", " << a9.a1 << ", " << a9.a2
<< "))" << "\n";
float result = 0;
result += a0.a0;
result += a0.a1;
result += a0.a2;
result += a1.a0;
result += a1.a1;
result += a1.a2;
result += a2.a0;
result += a2.a1;
result += a2.a2;
result += a3.a0;
result += a3.a1;
result += a3.a2;
result += a4.a0;
result += a4.a1;
result += a4.a2;
result += a5.a0;
result += a5.a1;
result += a5.a2;
result += a6.a0;
result += a6.a1;
result += a6.a2;
result += a7.a0;
result += a7.a1;
result += a7.a2;
result += a8.a0;
result += a8.a1;
result += a8.a2;
result += a9.a0;
result += a9.a1;
result += a9.a2;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// 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.
DART_EXPORT int64_t
PassStruct9BytesHomogeneousUint8x10(Struct9BytesHomogeneousUint8 a0,
Struct9BytesHomogeneousUint8 a1,
Struct9BytesHomogeneousUint8 a2,
Struct9BytesHomogeneousUint8 a3,
Struct9BytesHomogeneousUint8 a4,
Struct9BytesHomogeneousUint8 a5,
Struct9BytesHomogeneousUint8 a6,
Struct9BytesHomogeneousUint8 a7,
Struct9BytesHomogeneousUint8 a8,
Struct9BytesHomogeneousUint8 a9) {
std::cout
<< "PassStruct9BytesHomogeneousUint8x10" << "(("
<< static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
<< static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
<< static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
<< static_cast<int>(a0.a6) << ", " << static_cast<int>(a0.a7) << ", "
<< static_cast<int>(a0.a8) << "), (" << static_cast<int>(a1.a0) << ", "
<< static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
<< static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
<< static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << ", "
<< static_cast<int>(a1.a7) << ", " << static_cast<int>(a1.a8) << "), ("
<< static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
<< static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
<< static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
<< static_cast<int>(a2.a6) << ", " << static_cast<int>(a2.a7) << ", "
<< static_cast<int>(a2.a8) << "), (" << static_cast<int>(a3.a0) << ", "
<< static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
<< static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
<< static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << ", "
<< static_cast<int>(a3.a7) << ", " << static_cast<int>(a3.a8) << "), ("
<< static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
<< static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
<< static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
<< static_cast<int>(a4.a6) << ", " << static_cast<int>(a4.a7) << ", "
<< static_cast<int>(a4.a8) << "), (" << static_cast<int>(a5.a0) << ", "
<< static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
<< static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
<< static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << ", "
<< static_cast<int>(a5.a7) << ", " << static_cast<int>(a5.a8) << "), ("
<< static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
<< static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
<< static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
<< static_cast<int>(a6.a6) << ", " << static_cast<int>(a6.a7) << ", "
<< static_cast<int>(a6.a8) << "), (" << static_cast<int>(a7.a0) << ", "
<< static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
<< static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
<< static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << ", "
<< static_cast<int>(a7.a7) << ", " << static_cast<int>(a7.a8) << "), ("
<< static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
<< static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
<< static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
<< static_cast<int>(a8.a6) << ", " << static_cast<int>(a8.a7) << ", "
<< static_cast<int>(a8.a8) << "), (" << static_cast<int>(a9.a0) << ", "
<< static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
<< static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
<< static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << ", "
<< static_cast<int>(a9.a7) << ", " << static_cast<int>(a9.a8) << "))"
<< "\n";
int64_t result = 0;
result += a0.a0;
result += a0.a1;
result += a0.a2;
result += a0.a3;
result += a0.a4;
result += a0.a5;
result += a0.a6;
result += a0.a7;
result += a0.a8;
result += a1.a0;
result += a1.a1;
result += a1.a2;
result += a1.a3;
result += a1.a4;
result += a1.a5;
result += a1.a6;
result += a1.a7;
result += a1.a8;
result += a2.a0;
result += a2.a1;
result += a2.a2;
result += a2.a3;
result += a2.a4;
result += a2.a5;
result += a2.a6;
result += a2.a7;
result += a2.a8;
result += a3.a0;
result += a3.a1;
result += a3.a2;
result += a3.a3;
result += a3.a4;
result += a3.a5;
result += a3.a6;
result += a3.a7;
result += a3.a8;
result += a4.a0;
result += a4.a1;
result += a4.a2;
result += a4.a3;
result += a4.a4;
result += a4.a5;
result += a4.a6;
result += a4.a7;
result += a4.a8;
result += a5.a0;
result += a5.a1;
result += a5.a2;
result += a5.a3;
result += a5.a4;
result += a5.a5;
result += a5.a6;
result += a5.a7;
result += a5.a8;
result += a6.a0;
result += a6.a1;
result += a6.a2;
result += a6.a3;
result += a6.a4;
result += a6.a5;
result += a6.a6;
result += a6.a7;
result += a6.a8;
result += a7.a0;
result += a7.a1;
result += a7.a2;
result += a7.a3;
result += a7.a4;
result += a7.a5;
result += a7.a6;
result += a7.a7;
result += a7.a8;
result += a8.a0;
result += a8.a1;
result += a8.a2;
result += a8.a3;
result += a8.a4;
result += a8.a5;
result += a8.a6;
result += a8.a7;
result += a8.a8;
result += a9.a0;
result += a9.a1;
result += a9.a2;
result += a9.a3;
result += a9.a4;
result += a9.a5;
result += a9.a6;
result += a9.a7;
result += a9.a8;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// 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.
//
DART_EXPORT int64_t
PassStruct9BytesInt4Or8ByteAlignedx10(Struct9BytesInt4Or8ByteAligned a0,
Struct9BytesInt4Or8ByteAligned a1,
Struct9BytesInt4Or8ByteAligned a2,
Struct9BytesInt4Or8ByteAligned a3,
Struct9BytesInt4Or8ByteAligned a4,
Struct9BytesInt4Or8ByteAligned a5,
Struct9BytesInt4Or8ByteAligned a6,
Struct9BytesInt4Or8ByteAligned a7,
Struct9BytesInt4Or8ByteAligned a8,
Struct9BytesInt4Or8ByteAligned a9) {
std::cout << "PassStruct9BytesInt4Or8ByteAlignedx10" << "((" << a0.a0 << ", "
<< static_cast<int>(a0.a1) << "), (" << a1.a0 << ", "
<< static_cast<int>(a1.a1) << "), (" << a2.a0 << ", "
<< static_cast<int>(a2.a1) << "), (" << a3.a0 << ", "
<< static_cast<int>(a3.a1) << "), (" << a4.a0 << ", "
<< static_cast<int>(a4.a1) << "), (" << a5.a0 << ", "
<< static_cast<int>(a5.a1) << "), (" << a6.a0 << ", "
<< static_cast<int>(a6.a1) << "), (" << a7.a0 << ", "
<< static_cast<int>(a7.a1) << "), (" << a8.a0 << ", "
<< static_cast<int>(a8.a1) << "), (" << a9.a0 << ", "
<< static_cast<int>(a9.a1) << "))" << "\n";
int64_t result = 0;
result += a0.a0;
result += a0.a1;
result += a1.a0;
result += a1.a1;
result += a2.a0;
result += a2.a1;
result += a3.a0;
result += a3.a1;
result += a4.a0;
result += a4.a1;
result += a5.a0;
result += a5.a1;
result += a6.a0;
result += a6.a1;
result += a7.a0;
result += a7.a1;
result += a8.a0;
result += a8.a1;
result += a9.a0;
result += a9.a1;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// 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.
DART_EXPORT float PassStruct12BytesHomogeneousFloatx6(
Struct12BytesHomogeneousFloat a0,
Struct12BytesHomogeneousFloat a1,
Struct12BytesHomogeneousFloat a2,
Struct12BytesHomogeneousFloat a3,
Struct12BytesHomogeneousFloat a4,
Struct12BytesHomogeneousFloat a5) {
std::cout << "PassStruct12BytesHomogeneousFloatx6" << "((" << a0.a0 << ", "
<< a0.a1 << ", " << a0.a2 << "), (" << a1.a0 << ", " << a1.a1
<< ", " << a1.a2 << "), (" << a2.a0 << ", " << a2.a1 << ", "
<< a2.a2 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2
<< "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2 << "), ("
<< a5.a0 << ", " << a5.a1 << ", " << a5.a2 << "))" << "\n";
float result = 0;
result += a0.a0;
result += a0.a1;
result += a0.a2;
result += a1.a0;
result += a1.a1;
result += a1.a2;
result += a2.a0;
result += a2.a1;
result += a2.a2;
result += a3.a0;
result += a3.a1;
result += a3.a2;
result += a4.a0;
result += a4.a1;
result += a4.a2;
result += a5.a0;
result += a5.a1;
result += a5.a2;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// 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.
DART_EXPORT float PassStruct16BytesHomogeneousFloatx5(
Struct16BytesHomogeneousFloat a0,
Struct16BytesHomogeneousFloat a1,
Struct16BytesHomogeneousFloat a2,
Struct16BytesHomogeneousFloat a3,
Struct16BytesHomogeneousFloat a4) {
std::cout << "PassStruct16BytesHomogeneousFloatx5" << "((" << a0.a0 << ", "
<< a0.a1 << ", " << a0.a2 << ", " << a0.a3 << "), (" << a1.a0
<< ", " << a1.a1 << ", " << a1.a2 << ", " << a1.a3 << "), ("
<< a2.a0 << ", " << a2.a1 << ", " << a2.a2 << ", " << a2.a3
<< "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << ", "
<< a3.a3 << "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2
<< ", " << a4.a3 << "))" << "\n";
float result = 0;
result += a0.a0;
result += a0.a1;
result += a0.a2;
result += a0.a3;
result += a1.a0;
result += a1.a1;
result += a1.a2;
result += a1.a3;
result += a2.a0;
result += a2.a1;
result += a2.a2;
result += a2.a3;
result += a3.a0;
result += a3.a1;
result += a3.a2;
result += a3.a3;
result += a4.a0;
result += a4.a1;
result += a4.a2;
result += a4.a3;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// 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.
DART_EXPORT double PassStruct16BytesMixedx10(Struct16BytesMixed a0,
Struct16BytesMixed a1,
Struct16BytesMixed a2,
Struct16BytesMixed a3,
Struct16BytesMixed a4,
Struct16BytesMixed a5,
Struct16BytesMixed a6,
Struct16BytesMixed a7,
Struct16BytesMixed a8,
Struct16BytesMixed a9) {
std::cout << "PassStruct16BytesMixedx10" << "((" << a0.a0 << ", " << a0.a1
<< "), (" << a1.a0 << ", " << a1.a1 << "), (" << a2.a0 << ", "
<< a2.a1 << "), (" << a3.a0 << ", " << a3.a1 << "), (" << a4.a0
<< ", " << a4.a1 << "), (" << a5.a0 << ", " << a5.a1 << "), ("
<< a6.a0 << ", " << a6.a1 << "), (" << a7.a0 << ", " << a7.a1
<< "), (" << a8.a0 << ", " << a8.a1 << "), (" << a9.a0 << ", "
<< a9.a1 << "))" << "\n";
double result = 0;
result += a0.a0;
result += a0.a1;
result += a1.a0;
result += a1.a1;
result += a2.a0;
result += a2.a1;
result += a3.a0;
result += a3.a1;
result += a4.a0;
result += a4.a1;
result += a5.a0;
result += a5.a1;
result += a6.a0;
result += a6.a1;
result += a7.a0;
result += a7.a1;
result += a8.a0;
result += a8.a1;
result += a9.a0;
result += a9.a1;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// 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.
DART_EXPORT float PassStruct16BytesMixed2x10(Struct16BytesMixed2 a0,
Struct16BytesMixed2 a1,
Struct16BytesMixed2 a2,
Struct16BytesMixed2 a3,
Struct16BytesMixed2 a4,
Struct16BytesMixed2 a5,
Struct16BytesMixed2 a6,
Struct16BytesMixed2 a7,
Struct16BytesMixed2 a8,
Struct16BytesMixed2 a9) {
std::cout << "PassStruct16BytesMixed2x10" << "((" << a0.a0 << ", " << a0.a1
<< ", " << a0.a2 << ", " << a0.a3 << "), (" << a1.a0 << ", "
<< a1.a1 << ", " << a1.a2 << ", " << a1.a3 << "), (" << a2.a0
<< ", " << a2.a1 << ", " << a2.a2 << ", " << a2.a3 << "), ("
<< a3.a0 << ", " << a3.a1 << ", " << a3.a2 << ", " << a3.a3
<< "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2 << ", "
<< a4.a3 << "), (" << a5.a0 << ", " << a5.a1 << ", " << a5.a2
<< ", " << a5.a3 << "), (" << a6.a0 << ", " << a6.a1 << ", "
<< a6.a2 << ", " << a6.a3 << "), (" << a7.a0 << ", " << a7.a1
<< ", " << a7.a2 << ", " << a7.a3 << "), (" << a8.a0 << ", "
<< a8.a1 << ", " << a8.a2 << ", " << a8.a3 << "), (" << a9.a0
<< ", " << a9.a1 << ", " << a9.a2 << ", " << a9.a3 << "))" << "\n";
float result = 0;
result += a0.a0;
result += a0.a1;
result += a0.a2;
result += a0.a3;
result += a1.a0;
result += a1.a1;
result += a1.a2;
result += a1.a3;
result += a2.a0;
result += a2.a1;
result += a2.a2;
result += a2.a3;
result += a3.a0;
result += a3.a1;
result += a3.a2;
result += a3.a3;
result += a4.a0;
result += a4.a1;
result += a4.a2;
result += a4.a3;
result += a5.a0;
result += a5.a1;
result += a5.a2;
result += a5.a3;
result += a6.a0;
result += a6.a1;
result += a6.a2;
result += a6.a3;
result += a7.a0;
result += a7.a1;
result += a7.a2;
result += a7.a3;
result += a8.a0;
result += a8.a1;
result += a8.a2;
result += a8.a3;
result += a9.a0;
result += a9.a1;
result += a9.a2;
result += a9.a3;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// Arguments are passed as pointer to copy on arm64.
// Tests that the memory allocated for copies are rounded up to word size.
DART_EXPORT int64_t PassStruct17BytesIntx10(Struct17BytesInt a0,
Struct17BytesInt a1,
Struct17BytesInt a2,
Struct17BytesInt a3,
Struct17BytesInt a4,
Struct17BytesInt a5,
Struct17BytesInt a6,
Struct17BytesInt a7,
Struct17BytesInt a8,
Struct17BytesInt a9) {
std::cout << "PassStruct17BytesIntx10" << "((" << a0.a0 << ", " << a0.a1
<< ", " << static_cast<int>(a0.a2) << "), (" << a1.a0 << ", "
<< a1.a1 << ", " << static_cast<int>(a1.a2) << "), (" << a2.a0
<< ", " << a2.a1 << ", " << static_cast<int>(a2.a2) << "), ("
<< a3.a0 << ", " << a3.a1 << ", " << static_cast<int>(a3.a2)
<< "), (" << a4.a0 << ", " << a4.a1 << ", "
<< static_cast<int>(a4.a2) << "), (" << a5.a0 << ", " << a5.a1
<< ", " << static_cast<int>(a5.a2) << "), (" << a6.a0 << ", "
<< a6.a1 << ", " << static_cast<int>(a6.a2) << "), (" << a7.a0
<< ", " << a7.a1 << ", " << static_cast<int>(a7.a2) << "), ("
<< a8.a0 << ", " << a8.a1 << ", " << static_cast<int>(a8.a2)
<< "), (" << a9.a0 << ", " << a9.a1 << ", "
<< static_cast<int>(a9.a2) << "))" << "\n";
int64_t result = 0;
result += a0.a0;
result += a0.a1;
result += a0.a2;
result += a1.a0;
result += a1.a1;
result += a1.a2;
result += a2.a0;
result += a2.a1;
result += a2.a2;
result += a3.a0;
result += a3.a1;
result += a3.a2;
result += a4.a0;
result += a4.a1;
result += a4.a2;
result += a5.a0;
result += a5.a1;
result += a5.a2;
result += a6.a0;
result += a6.a1;
result += a6.a2;
result += a7.a0;
result += a7.a1;
result += a7.a2;
result += a8.a0;
result += a8.a1;
result += a8.a2;
result += a9.a0;
result += a9.a1;
result += a9.a2;
std::cout << "result = " << result << "\n";
return result;
}
// Used for testing structs and unions by value.
// 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.
//
DART_EXPORT int64_t
PassStruct19BytesHomogeneousUint8x10(Struct19BytesHomogeneousUint8 a0,
Struct19BytesHomogeneousUint8 a1,
Struct19BytesHomogeneousUint8 a2,
Struct19BytesHomogeneousUint8 a3,
Struct19BytesHomogeneousUint8 a4,
Struct19BytesHomogeneousUint8 a5,
Struct19BytesHomogeneousUint8 a6,
Struct19BytesHomogeneousUint8 a7,
Struct19BytesHomogeneousUint8 a8,
Struct19BytesHomogeneousUint8 a9) {
std::cout
<< "PassStruct19BytesHomogeneousUint8x10" << "(("
<< static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
<< static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
<< static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
<< static_cast<int>(a0.a6) << ", " << static_cast<int>(a0.a7) << ", "
<< static_cast<int>(a0.a8) << ", " << static_cast<int>(a0.a9) << ", "
<< static_cast<int>(a0.a10) << ", " << static_cast<int>(a0.a11) << ", "
<< static_cast<int>(a0.a12) << ", " << static_cast<int>(a0.a13) << ", "
<< static_cast<int>(a0.a14) << ", " << static_cast<int>(a0.a15) << ", "
<< static_cast<int>(a0.a16) << ", " << static_cast<int>(a0.a17) << ", "
<< static_cast<int>(a0.a18) << "), (" << static_cast<int>(a1.a0) << ", "
<< static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
<< static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
<< static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << ", "
<< static_cast<int>(a1.a7) << ", " << static_cast<int>(a1.a8) << ", "
<< static_cast<int>(a1.a9) << ", " << static_cast<int>(a1.a10) << ", "
<< static_cast<int>(a1.a11) << ", " << static_cast<int>(a1.a12) << ", "
<< static_cast<int>(a1.a13) << ", " << static_cast<int>(a1.a14) << ", "
<< static_cast<int>(a1.a15) << ", " << static_cast<int>(a1.a16) << ", "
<< static_cast<int>(a1.a17) << ", " << static_cast<int>(a1.a18) << "), ("
<< static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
<< static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
<< static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
<< static_cast<int>(a2.a6) << ", " << static_cast<int>(a2.a7) << ", "
<< static_cast<int>(a2.a8) << ", " << static_cast<int>(a2.a9) << ", "
<< static_cast<int>(a2.a10) << ", " << static_cast<int>(a2.a11) << ", "
<< static_cast<int>(a2.a12) << ", " << static_cast<int>(a2.a13) << ", "
<< static_cast<int>(a2.a14) << ", " << static_cast<int>(a2.a15) << ", "
<< static_cast<int>(a2.a16) << ", " << static_cast<int>(a2.a17) << ", "
<< static_cast<int>(a2.a18) << "), (" << static_cast<int>(a3.a0) << ", "
<< static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
<< static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
<< static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << ", "
<< static_cast<int>(a3.a7) << ", " << static_cast<int>(a3.a8) << ", "
<< static_cast<int>(a3.a9) << ", " << static_cast<int>(a3.a10) << ", "
<< static_cast<int>(a3.a11) << ", " << static_cast<int>(a3.a12) << ", "
<< static_cast<int>(a3.a13) << ", " << static_cast<int>(a3.a14) << ", "
<< static_cast<int>(a3.a15) << ", " << static_cast<int>(a3.a16) << ", "
<< static_cast<int>(a3.a17) << ", " << static_cast<int>(a3.a18) << "), ("
<< static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
<< static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
<< static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
<< static_cast<int>(a4.a6) << ", " << static_cast<int>(a4.a7) << ", "
<< static_cast<int>(a4.a8) << ", " << static_cast<int>(a4.a9) << ", "
<< static_cast<int>(a4.a10) << ", " << static_cast<int>(a4.a11) << ", "
<< static_cast<int>(a4.a12) << ", " << static_cast<int>(a4.a13) << ", "
<< static_cast<int>(a4.a14) << ", " << static_cast<int>(a4.a15) << ", "
<< static_cast<int>(a4.a16) << ", " << static_cast<int>(a4.a17) << ", "
<<