blob: 88e6a533cad74482e04ffc70e91e23b15392d2f7 [file] [log] [blame] [edit]
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// This file has been automatically generated. Please do not edit it manually.
// Generated by tests/ffi/generator/structs_by_value_tests_generator.dart.
//
// SharedObjects=ffi_test_functions
// VMOptions=
// VMOptions=--deterministic --optimization-counter-threshold=90
// 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 'dylib_utils.dart';
// Reuse the compound classes.
import 'function_structs_by_value_generated_compounds.dart';
final ffiTestFunctions = dlopenPlatformSpecific("ffi_test_functions");
void main() {
// Force dlopen so @Native lookups in DynamicLibrary.process() succeed.
dlopenGlobalPlatformSpecific('ffi_test_functions');
for (int i = 0; i < 100; ++i) {
testReturnStruct1ByteIntNative();
testReturnStruct3BytesHomogeneousUint8Native();
testReturnStruct3BytesInt2ByteAlignedNative();
testReturnStruct4BytesHomogeneousInt16Native();
testReturnStruct7BytesHomogeneousUint8Native();
testReturnStruct7BytesInt4ByteAlignedNative();
testReturnStruct8BytesIntNative();
testReturnStruct8BytesHomogeneousFloatNative();
testReturnStruct8BytesMixedNative();
testReturnStruct9BytesHomogeneousUint8Native();
testReturnStruct9BytesInt4Or8ByteAlignedNative();
testReturnStruct12BytesHomogeneousFloatNative();
testReturnStruct16BytesHomogeneousFloatNative();
testReturnStruct16BytesMixedNative();
testReturnStruct16BytesMixed2Native();
testReturnStruct17BytesIntNative();
testReturnStruct19BytesHomogeneousUint8Native();
testReturnStruct20BytesHomogeneousInt32Native();
testReturnStruct20BytesHomogeneousFloatNative();
testReturnStruct32BytesHomogeneousDoubleNative();
testReturnStruct40BytesHomogeneousDoubleNative();
testReturnStruct1024BytesHomogeneousUint64Native();
testReturnStruct3BytesPackedIntNative();
testReturnStruct8BytesPackedIntNative();
testReturnStruct9BytesPackedMixedNative();
testReturnUnion4BytesMixedNative();
testReturnUnion8BytesNestedFloatNative();
testReturnUnion9BytesNestedIntNative();
testReturnUnion16BytesNestedFloatNative();
}
}
@Native<Struct1ByteInt Function(Int8)>(symbol: 'ReturnStruct1ByteInt')
external Struct1ByteInt returnStruct1ByteIntNative(int a0);
/// Smallest struct with data.
void testReturnStruct1ByteIntNative() {
int a0;
a0 = -1;
final result = returnStruct1ByteIntNative(a0);
print("result = $result");
Expect.equals(a0, result.a0);
}
@Native<Struct3BytesHomogeneousUint8 Function(Uint8, Uint8, Uint8)>(
symbol: 'ReturnStruct3BytesHomogeneousUint8',
)
external Struct3BytesHomogeneousUint8 returnStruct3BytesHomogeneousUint8Native(
int a0,
int a1,
int a2,
);
/// Smaller than word size return value on all architectures.
void testReturnStruct3BytesHomogeneousUint8Native() {
int a0;
int a1;
int a2;
a0 = 1;
a1 = 2;
a2 = 3;
final result = returnStruct3BytesHomogeneousUint8Native(a0, a1, a2);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
}
@Native<Struct3BytesInt2ByteAligned Function(Int16, Int8)>(
symbol: 'ReturnStruct3BytesInt2ByteAligned',
)
external Struct3BytesInt2ByteAligned returnStruct3BytesInt2ByteAlignedNative(
int a0,
int a1,
);
/// Smaller than word size return value on all architectures.
/// With alignment rules taken into account size is 4 bytes.
void testReturnStruct3BytesInt2ByteAlignedNative() {
int a0;
int a1;
a0 = -1;
a1 = 2;
final result = returnStruct3BytesInt2ByteAlignedNative(a0, a1);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
}
@Native<Struct4BytesHomogeneousInt16 Function(Int16, Int16)>(
symbol: 'ReturnStruct4BytesHomogeneousInt16',
)
external Struct4BytesHomogeneousInt16 returnStruct4BytesHomogeneousInt16Native(
int a0,
int a1,
);
/// Word size return value on 32 bit architectures..
void testReturnStruct4BytesHomogeneousInt16Native() {
int a0;
int a1;
a0 = -1;
a1 = 2;
final result = returnStruct4BytesHomogeneousInt16Native(a0, a1);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
}
@Native<
Struct7BytesHomogeneousUint8 Function(
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
)
>(symbol: 'ReturnStruct7BytesHomogeneousUint8')
external Struct7BytesHomogeneousUint8 returnStruct7BytesHomogeneousUint8Native(
int a0,
int a1,
int a2,
int a3,
int a4,
int a5,
int a6,
);
/// Non-wordsize return value.
void testReturnStruct7BytesHomogeneousUint8Native() {
int a0;
int a1;
int a2;
int a3;
int a4;
int a5;
int a6;
a0 = 1;
a1 = 2;
a2 = 3;
a3 = 4;
a4 = 5;
a5 = 6;
a6 = 7;
final result = returnStruct7BytesHomogeneousUint8Native(
a0,
a1,
a2,
a3,
a4,
a5,
a6,
);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
Expect.equals(a3, result.a3);
Expect.equals(a4, result.a4);
Expect.equals(a5, result.a5);
Expect.equals(a6, result.a6);
}
@Native<Struct7BytesInt4ByteAligned Function(Int32, Int16, Int8)>(
symbol: 'ReturnStruct7BytesInt4ByteAligned',
)
external Struct7BytesInt4ByteAligned returnStruct7BytesInt4ByteAlignedNative(
int a0,
int a1,
int a2,
);
/// Non-wordsize return value.
/// With alignment rules taken into account size is 8 bytes.
void testReturnStruct7BytesInt4ByteAlignedNative() {
int a0;
int a1;
int a2;
a0 = -1;
a1 = 2;
a2 = -3;
final result = returnStruct7BytesInt4ByteAlignedNative(a0, a1, a2);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
}
@Native<Struct8BytesInt Function(Int16, Int16, Int32)>(
symbol: 'ReturnStruct8BytesInt',
)
external Struct8BytesInt returnStruct8BytesIntNative(int a0, int a1, int a2);
/// Return value in integer registers on many architectures.
void testReturnStruct8BytesIntNative() {
int a0;
int a1;
int a2;
a0 = -1;
a1 = 2;
a2 = -3;
final result = returnStruct8BytesIntNative(a0, a1, a2);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
}
@Native<Struct8BytesHomogeneousFloat Function(Float, Float)>(
symbol: 'ReturnStruct8BytesHomogeneousFloat',
)
external Struct8BytesHomogeneousFloat returnStruct8BytesHomogeneousFloatNative(
double a0,
double a1,
);
/// Return value in FP registers on many architectures.
void testReturnStruct8BytesHomogeneousFloatNative() {
double a0;
double a1;
a0 = -1.0;
a1 = 2.0;
final result = returnStruct8BytesHomogeneousFloatNative(a0, a1);
print("result = $result");
Expect.approxEquals(a0, result.a0);
Expect.approxEquals(a1, result.a1);
}
@Native<Struct8BytesMixed Function(Float, Int16, Int16)>(
symbol: 'ReturnStruct8BytesMixed',
)
external Struct8BytesMixed returnStruct8BytesMixedNative(
double a0,
int a1,
int a2,
);
/// Return value split over FP and integer register in x64.
void testReturnStruct8BytesMixedNative() {
double a0;
int a1;
int a2;
a0 = -1.0;
a1 = 2;
a2 = -3;
final result = returnStruct8BytesMixedNative(a0, a1, a2);
print("result = $result");
Expect.approxEquals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
}
@Native<
Struct9BytesHomogeneousUint8 Function(
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
)
>(symbol: 'ReturnStruct9BytesHomogeneousUint8')
external Struct9BytesHomogeneousUint8 returnStruct9BytesHomogeneousUint8Native(
int a0,
int a1,
int a2,
int a3,
int a4,
int a5,
int a6,
int a7,
int a8,
);
/// The minimum alignment of this struct is only 1 byte based on its fields.
/// Test that the memory backing these structs is the right size and that
/// dart:ffi trampolines do not write outside this size.
void testReturnStruct9BytesHomogeneousUint8Native() {
int a0;
int a1;
int a2;
int a3;
int a4;
int a5;
int a6;
int a7;
int a8;
a0 = 1;
a1 = 2;
a2 = 3;
a3 = 4;
a4 = 5;
a5 = 6;
a6 = 7;
a7 = 8;
a8 = 9;
final result = returnStruct9BytesHomogeneousUint8Native(
a0,
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
Expect.equals(a3, result.a3);
Expect.equals(a4, result.a4);
Expect.equals(a5, result.a5);
Expect.equals(a6, result.a6);
Expect.equals(a7, result.a7);
Expect.equals(a8, result.a8);
}
@Native<Struct9BytesInt4Or8ByteAligned Function(Int64, Int8)>(
symbol: 'ReturnStruct9BytesInt4Or8ByteAligned',
)
external Struct9BytesInt4Or8ByteAligned
returnStruct9BytesInt4Or8ByteAlignedNative(int a0, int a1);
/// Return value in two integer registers on x64.
/// With alignment rules taken into account size is 12 or 16 bytes.
void testReturnStruct9BytesInt4Or8ByteAlignedNative() {
int a0;
int a1;
a0 = -1;
a1 = 2;
final result = returnStruct9BytesInt4Or8ByteAlignedNative(a0, a1);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
}
@Native<Struct12BytesHomogeneousFloat Function(Float, Float, Float)>(
symbol: 'ReturnStruct12BytesHomogeneousFloat',
)
external Struct12BytesHomogeneousFloat
returnStruct12BytesHomogeneousFloatNative(double a0, double a1, double a2);
/// Return value in FPU registers, but does not use all registers on arm hardfp
/// and arm64.
void testReturnStruct12BytesHomogeneousFloatNative() {
double a0;
double a1;
double a2;
a0 = -1.0;
a1 = 2.0;
a2 = -3.0;
final result = returnStruct12BytesHomogeneousFloatNative(a0, a1, a2);
print("result = $result");
Expect.approxEquals(a0, result.a0);
Expect.approxEquals(a1, result.a1);
Expect.approxEquals(a2, result.a2);
}
@Native<Struct16BytesHomogeneousFloat Function(Float, Float, Float, Float)>(
symbol: 'ReturnStruct16BytesHomogeneousFloat',
)
external Struct16BytesHomogeneousFloat
returnStruct16BytesHomogeneousFloatNative(
double a0,
double a1,
double a2,
double a3,
);
/// Return value in FPU registers on arm hardfp and arm64.
void testReturnStruct16BytesHomogeneousFloatNative() {
double a0;
double a1;
double a2;
double a3;
a0 = -1.0;
a1 = 2.0;
a2 = -3.0;
a3 = 4.0;
final result = returnStruct16BytesHomogeneousFloatNative(a0, a1, a2, a3);
print("result = $result");
Expect.approxEquals(a0, result.a0);
Expect.approxEquals(a1, result.a1);
Expect.approxEquals(a2, result.a2);
Expect.approxEquals(a3, result.a3);
}
@Native<Struct16BytesMixed Function(Double, Int64)>(
symbol: 'ReturnStruct16BytesMixed',
)
external Struct16BytesMixed returnStruct16BytesMixedNative(double a0, int a1);
/// Return value split over FP and integer register in x64.
void testReturnStruct16BytesMixedNative() {
double a0;
int a1;
a0 = -1.0;
a1 = 2;
final result = returnStruct16BytesMixedNative(a0, a1);
print("result = $result");
Expect.approxEquals(a0, result.a0);
Expect.equals(a1, result.a1);
}
@Native<Struct16BytesMixed2 Function(Float, Float, Float, Int32)>(
symbol: 'ReturnStruct16BytesMixed2',
)
external Struct16BytesMixed2 returnStruct16BytesMixed2Native(
double a0,
double a1,
double a2,
int a3,
);
/// Return value split over FP and integer register in x64.
/// The integer register contains half float half int.
void testReturnStruct16BytesMixed2Native() {
double a0;
double a1;
double a2;
int a3;
a0 = -1.0;
a1 = 2.0;
a2 = -3.0;
a3 = 4;
final result = returnStruct16BytesMixed2Native(a0, a1, a2, a3);
print("result = $result");
Expect.approxEquals(a0, result.a0);
Expect.approxEquals(a1, result.a1);
Expect.approxEquals(a2, result.a2);
Expect.equals(a3, result.a3);
}
@Native<Struct17BytesInt Function(Int64, Int64, Int8)>(
symbol: 'ReturnStruct17BytesInt',
)
external Struct17BytesInt returnStruct17BytesIntNative(int a0, int a1, int a2);
/// Return value returned in preallocated space passed by pointer on most ABIs.
/// Is non word size on purpose, to test that structs are rounded up to word size
/// on all ABIs.
void testReturnStruct17BytesIntNative() {
int a0;
int a1;
int a2;
a0 = -1;
a1 = 2;
a2 = -3;
final result = returnStruct17BytesIntNative(a0, a1, a2);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
}
@Native<
Struct19BytesHomogeneousUint8 Function(
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
Uint8,
)
>(symbol: 'ReturnStruct19BytesHomogeneousUint8')
external Struct19BytesHomogeneousUint8
returnStruct19BytesHomogeneousUint8Native(
int a0,
int a1,
int a2,
int a3,
int a4,
int a5,
int a6,
int a7,
int a8,
int a9,
int a10,
int a11,
int a12,
int a13,
int a14,
int a15,
int a16,
int a17,
int a18,
);
/// The minimum alignment of this struct is only 1 byte based on its fields.
/// Test that the memory backing these structs is the right size and that
/// dart:ffi trampolines do not write outside this size.
void testReturnStruct19BytesHomogeneousUint8Native() {
int a0;
int a1;
int a2;
int a3;
int a4;
int a5;
int a6;
int a7;
int a8;
int a9;
int a10;
int a11;
int a12;
int a13;
int a14;
int a15;
int a16;
int a17;
int a18;
a0 = 1;
a1 = 2;
a2 = 3;
a3 = 4;
a4 = 5;
a5 = 6;
a6 = 7;
a7 = 8;
a8 = 9;
a9 = 10;
a10 = 11;
a11 = 12;
a12 = 13;
a13 = 14;
a14 = 15;
a15 = 16;
a16 = 17;
a17 = 18;
a18 = 19;
final result = returnStruct19BytesHomogeneousUint8Native(
a0,
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
a14,
a15,
a16,
a17,
a18,
);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
Expect.equals(a3, result.a3);
Expect.equals(a4, result.a4);
Expect.equals(a5, result.a5);
Expect.equals(a6, result.a6);
Expect.equals(a7, result.a7);
Expect.equals(a8, result.a8);
Expect.equals(a9, result.a9);
Expect.equals(a10, result.a10);
Expect.equals(a11, result.a11);
Expect.equals(a12, result.a12);
Expect.equals(a13, result.a13);
Expect.equals(a14, result.a14);
Expect.equals(a15, result.a15);
Expect.equals(a16, result.a16);
Expect.equals(a17, result.a17);
Expect.equals(a18, result.a18);
}
@Native<
Struct20BytesHomogeneousInt32 Function(Int32, Int32, Int32, Int32, Int32)
>(symbol: 'ReturnStruct20BytesHomogeneousInt32')
external Struct20BytesHomogeneousInt32
returnStruct20BytesHomogeneousInt32Native(
int a0,
int a1,
int a2,
int a3,
int a4,
);
/// Return value too big to go in cpu registers on arm64.
void testReturnStruct20BytesHomogeneousInt32Native() {
int a0;
int a1;
int a2;
int a3;
int a4;
a0 = -1;
a1 = 2;
a2 = -3;
a3 = 4;
a4 = -5;
final result = returnStruct20BytesHomogeneousInt32Native(a0, a1, a2, a3, a4);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
Expect.equals(a3, result.a3);
Expect.equals(a4, result.a4);
}
@Native<
Struct20BytesHomogeneousFloat Function(Float, Float, Float, Float, Float)
>(symbol: 'ReturnStruct20BytesHomogeneousFloat')
external Struct20BytesHomogeneousFloat
returnStruct20BytesHomogeneousFloatNative(
double a0,
double a1,
double a2,
double a3,
double a4,
);
/// Return value too big to go in FPU registers on x64, arm hardfp and arm64.
void testReturnStruct20BytesHomogeneousFloatNative() {
double a0;
double a1;
double a2;
double a3;
double a4;
a0 = -1.0;
a1 = 2.0;
a2 = -3.0;
a3 = 4.0;
a4 = -5.0;
final result = returnStruct20BytesHomogeneousFloatNative(a0, a1, a2, a3, a4);
print("result = $result");
Expect.approxEquals(a0, result.a0);
Expect.approxEquals(a1, result.a1);
Expect.approxEquals(a2, result.a2);
Expect.approxEquals(a3, result.a3);
Expect.approxEquals(a4, result.a4);
}
@Native<
Struct32BytesHomogeneousDouble Function(Double, Double, Double, Double)
>(symbol: 'ReturnStruct32BytesHomogeneousDouble')
external Struct32BytesHomogeneousDouble
returnStruct32BytesHomogeneousDoubleNative(
double a0,
double a1,
double a2,
double a3,
);
/// Return value in FPU registers on arm64.
void testReturnStruct32BytesHomogeneousDoubleNative() {
double a0;
double a1;
double a2;
double a3;
a0 = -1.0;
a1 = 2.0;
a2 = -3.0;
a3 = 4.0;
final result = returnStruct32BytesHomogeneousDoubleNative(a0, a1, a2, a3);
print("result = $result");
Expect.approxEquals(a0, result.a0);
Expect.approxEquals(a1, result.a1);
Expect.approxEquals(a2, result.a2);
Expect.approxEquals(a3, result.a3);
}
@Native<
Struct40BytesHomogeneousDouble Function(
Double,
Double,
Double,
Double,
Double,
)
>(symbol: 'ReturnStruct40BytesHomogeneousDouble')
external Struct40BytesHomogeneousDouble
returnStruct40BytesHomogeneousDoubleNative(
double a0,
double a1,
double a2,
double a3,
double a4,
);
/// Return value too big to go in FPU registers on arm64.
void testReturnStruct40BytesHomogeneousDoubleNative() {
double a0;
double a1;
double a2;
double a3;
double a4;
a0 = -1.0;
a1 = 2.0;
a2 = -3.0;
a3 = 4.0;
a4 = -5.0;
final result = returnStruct40BytesHomogeneousDoubleNative(a0, a1, a2, a3, a4);
print("result = $result");
Expect.approxEquals(a0, result.a0);
Expect.approxEquals(a1, result.a1);
Expect.approxEquals(a2, result.a2);
Expect.approxEquals(a3, result.a3);
Expect.approxEquals(a4, result.a4);
}
@Native<
Struct1024BytesHomogeneousUint64 Function(
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
Uint64,
)
>(symbol: 'ReturnStruct1024BytesHomogeneousUint64')
external Struct1024BytesHomogeneousUint64
returnStruct1024BytesHomogeneousUint64Native(
int a0,
int a1,
int a2,
int a3,
int a4,
int a5,
int a6,
int a7,
int a8,
int a9,
int a10,
int a11,
int a12,
int a13,
int a14,
int a15,
int a16,
int a17,
int a18,
int a19,
int a20,
int a21,
int a22,
int a23,
int a24,
int a25,
int a26,
int a27,
int a28,
int a29,
int a30,
int a31,
int a32,
int a33,
int a34,
int a35,
int a36,
int a37,
int a38,
int a39,
int a40,
int a41,
int a42,
int a43,
int a44,
int a45,
int a46,
int a47,
int a48,
int a49,
int a50,
int a51,
int a52,
int a53,
int a54,
int a55,
int a56,
int a57,
int a58,
int a59,
int a60,
int a61,
int a62,
int a63,
int a64,
int a65,
int a66,
int a67,
int a68,
int a69,
int a70,
int a71,
int a72,
int a73,
int a74,
int a75,
int a76,
int a77,
int a78,
int a79,
int a80,
int a81,
int a82,
int a83,
int a84,
int a85,
int a86,
int a87,
int a88,
int a89,
int a90,
int a91,
int a92,
int a93,
int a94,
int a95,
int a96,
int a97,
int a98,
int a99,
int a100,
int a101,
int a102,
int a103,
int a104,
int a105,
int a106,
int a107,
int a108,
int a109,
int a110,
int a111,
int a112,
int a113,
int a114,
int a115,
int a116,
int a117,
int a118,
int a119,
int a120,
int a121,
int a122,
int a123,
int a124,
int a125,
int a126,
int a127,
);
/// Test 1kb struct.
void testReturnStruct1024BytesHomogeneousUint64Native() {
int a0;
int a1;
int a2;
int a3;
int a4;
int a5;
int a6;
int a7;
int a8;
int a9;
int a10;
int a11;
int a12;
int a13;
int a14;
int a15;
int a16;
int a17;
int a18;
int a19;
int a20;
int a21;
int a22;
int a23;
int a24;
int a25;
int a26;
int a27;
int a28;
int a29;
int a30;
int a31;
int a32;
int a33;
int a34;
int a35;
int a36;
int a37;
int a38;
int a39;
int a40;
int a41;
int a42;
int a43;
int a44;
int a45;
int a46;
int a47;
int a48;
int a49;
int a50;
int a51;
int a52;
int a53;
int a54;
int a55;
int a56;
int a57;
int a58;
int a59;
int a60;
int a61;
int a62;
int a63;
int a64;
int a65;
int a66;
int a67;
int a68;
int a69;
int a70;
int a71;
int a72;
int a73;
int a74;
int a75;
int a76;
int a77;
int a78;
int a79;
int a80;
int a81;
int a82;
int a83;
int a84;
int a85;
int a86;
int a87;
int a88;
int a89;
int a90;
int a91;
int a92;
int a93;
int a94;
int a95;
int a96;
int a97;
int a98;
int a99;
int a100;
int a101;
int a102;
int a103;
int a104;
int a105;
int a106;
int a107;
int a108;
int a109;
int a110;
int a111;
int a112;
int a113;
int a114;
int a115;
int a116;
int a117;
int a118;
int a119;
int a120;
int a121;
int a122;
int a123;
int a124;
int a125;
int a126;
int a127;
a0 = 1;
a1 = 2;
a2 = 3;
a3 = 4;
a4 = 5;
a5 = 6;
a6 = 7;
a7 = 8;
a8 = 9;
a9 = 10;
a10 = 11;
a11 = 12;
a12 = 13;
a13 = 14;
a14 = 15;
a15 = 16;
a16 = 17;
a17 = 18;
a18 = 19;
a19 = 20;
a20 = 21;
a21 = 22;
a22 = 23;
a23 = 24;
a24 = 25;
a25 = 26;
a26 = 27;
a27 = 28;
a28 = 29;
a29 = 30;
a30 = 31;
a31 = 32;
a32 = 33;
a33 = 34;
a34 = 35;
a35 = 36;
a36 = 37;
a37 = 38;
a38 = 39;
a39 = 40;
a40 = 41;
a41 = 42;
a42 = 43;
a43 = 44;
a44 = 45;
a45 = 46;
a46 = 47;
a47 = 48;
a48 = 49;
a49 = 50;
a50 = 51;
a51 = 52;
a52 = 53;
a53 = 54;
a54 = 55;
a55 = 56;
a56 = 57;
a57 = 58;
a58 = 59;
a59 = 60;
a60 = 61;
a61 = 62;
a62 = 63;
a63 = 64;
a64 = 65;
a65 = 66;
a66 = 67;
a67 = 68;
a68 = 69;
a69 = 70;
a70 = 71;
a71 = 72;
a72 = 73;
a73 = 74;
a74 = 75;
a75 = 76;
a76 = 77;
a77 = 78;
a78 = 79;
a79 = 80;
a80 = 81;
a81 = 82;
a82 = 83;
a83 = 84;
a84 = 85;
a85 = 86;
a86 = 87;
a87 = 88;
a88 = 89;
a89 = 90;
a90 = 91;
a91 = 92;
a92 = 93;
a93 = 94;
a94 = 95;
a95 = 96;
a96 = 97;
a97 = 98;
a98 = 99;
a99 = 100;
a100 = 101;
a101 = 102;
a102 = 103;
a103 = 104;
a104 = 105;
a105 = 106;
a106 = 107;
a107 = 108;
a108 = 109;
a109 = 110;
a110 = 111;
a111 = 112;
a112 = 113;
a113 = 114;
a114 = 115;
a115 = 116;
a116 = 117;
a117 = 118;
a118 = 119;
a119 = 120;
a120 = 121;
a121 = 122;
a122 = 123;
a123 = 124;
a124 = 125;
a125 = 126;
a126 = 127;
a127 = 128;
final result = returnStruct1024BytesHomogeneousUint64Native(
a0,
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
a14,
a15,
a16,
a17,
a18,
a19,
a20,
a21,
a22,
a23,
a24,
a25,
a26,
a27,
a28,
a29,
a30,
a31,
a32,
a33,
a34,
a35,
a36,
a37,
a38,
a39,
a40,
a41,
a42,
a43,
a44,
a45,
a46,
a47,
a48,
a49,
a50,
a51,
a52,
a53,
a54,
a55,
a56,
a57,
a58,
a59,
a60,
a61,
a62,
a63,
a64,
a65,
a66,
a67,
a68,
a69,
a70,
a71,
a72,
a73,
a74,
a75,
a76,
a77,
a78,
a79,
a80,
a81,
a82,
a83,
a84,
a85,
a86,
a87,
a88,
a89,
a90,
a91,
a92,
a93,
a94,
a95,
a96,
a97,
a98,
a99,
a100,
a101,
a102,
a103,
a104,
a105,
a106,
a107,
a108,
a109,
a110,
a111,
a112,
a113,
a114,
a115,
a116,
a117,
a118,
a119,
a120,
a121,
a122,
a123,
a124,
a125,
a126,
a127,
);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
Expect.equals(a3, result.a3);
Expect.equals(a4, result.a4);
Expect.equals(a5, result.a5);
Expect.equals(a6, result.a6);
Expect.equals(a7, result.a7);
Expect.equals(a8, result.a8);
Expect.equals(a9, result.a9);
Expect.equals(a10, result.a10);
Expect.equals(a11, result.a11);
Expect.equals(a12, result.a12);
Expect.equals(a13, result.a13);
Expect.equals(a14, result.a14);
Expect.equals(a15, result.a15);
Expect.equals(a16, result.a16);
Expect.equals(a17, result.a17);
Expect.equals(a18, result.a18);
Expect.equals(a19, result.a19);
Expect.equals(a20, result.a20);
Expect.equals(a21, result.a21);
Expect.equals(a22, result.a22);
Expect.equals(a23, result.a23);
Expect.equals(a24, result.a24);
Expect.equals(a25, result.a25);
Expect.equals(a26, result.a26);
Expect.equals(a27, result.a27);
Expect.equals(a28, result.a28);
Expect.equals(a29, result.a29);
Expect.equals(a30, result.a30);
Expect.equals(a31, result.a31);
Expect.equals(a32, result.a32);
Expect.equals(a33, result.a33);
Expect.equals(a34, result.a34);
Expect.equals(a35, result.a35);
Expect.equals(a36, result.a36);
Expect.equals(a37, result.a37);
Expect.equals(a38, result.a38);
Expect.equals(a39, result.a39);
Expect.equals(a40, result.a40);
Expect.equals(a41, result.a41);
Expect.equals(a42, result.a42);
Expect.equals(a43, result.a43);
Expect.equals(a44, result.a44);
Expect.equals(a45, result.a45);
Expect.equals(a46, result.a46);
Expect.equals(a47, result.a47);
Expect.equals(a48, result.a48);
Expect.equals(a49, result.a49);
Expect.equals(a50, result.a50);
Expect.equals(a51, result.a51);
Expect.equals(a52, result.a52);
Expect.equals(a53, result.a53);
Expect.equals(a54, result.a54);
Expect.equals(a55, result.a55);
Expect.equals(a56, result.a56);
Expect.equals(a57, result.a57);
Expect.equals(a58, result.a58);
Expect.equals(a59, result.a59);
Expect.equals(a60, result.a60);
Expect.equals(a61, result.a61);
Expect.equals(a62, result.a62);
Expect.equals(a63, result.a63);
Expect.equals(a64, result.a64);
Expect.equals(a65, result.a65);
Expect.equals(a66, result.a66);
Expect.equals(a67, result.a67);
Expect.equals(a68, result.a68);
Expect.equals(a69, result.a69);
Expect.equals(a70, result.a70);
Expect.equals(a71, result.a71);
Expect.equals(a72, result.a72);
Expect.equals(a73, result.a73);
Expect.equals(a74, result.a74);
Expect.equals(a75, result.a75);
Expect.equals(a76, result.a76);
Expect.equals(a77, result.a77);
Expect.equals(a78, result.a78);
Expect.equals(a79, result.a79);
Expect.equals(a80, result.a80);
Expect.equals(a81, result.a81);
Expect.equals(a82, result.a82);
Expect.equals(a83, result.a83);
Expect.equals(a84, result.a84);
Expect.equals(a85, result.a85);
Expect.equals(a86, result.a86);
Expect.equals(a87, result.a87);
Expect.equals(a88, result.a88);
Expect.equals(a89, result.a89);
Expect.equals(a90, result.a90);
Expect.equals(a91, result.a91);
Expect.equals(a92, result.a92);
Expect.equals(a93, result.a93);
Expect.equals(a94, result.a94);
Expect.equals(a95, result.a95);
Expect.equals(a96, result.a96);
Expect.equals(a97, result.a97);
Expect.equals(a98, result.a98);
Expect.equals(a99, result.a99);
Expect.equals(a100, result.a100);
Expect.equals(a101, result.a101);
Expect.equals(a102, result.a102);
Expect.equals(a103, result.a103);
Expect.equals(a104, result.a104);
Expect.equals(a105, result.a105);
Expect.equals(a106, result.a106);
Expect.equals(a107, result.a107);
Expect.equals(a108, result.a108);
Expect.equals(a109, result.a109);
Expect.equals(a110, result.a110);
Expect.equals(a111, result.a111);
Expect.equals(a112, result.a112);
Expect.equals(a113, result.a113);
Expect.equals(a114, result.a114);
Expect.equals(a115, result.a115);
Expect.equals(a116, result.a116);
Expect.equals(a117, result.a117);
Expect.equals(a118, result.a118);
Expect.equals(a119, result.a119);
Expect.equals(a120, result.a120);
Expect.equals(a121, result.a121);
Expect.equals(a122, result.a122);
Expect.equals(a123, result.a123);
Expect.equals(a124, result.a124);
Expect.equals(a125, result.a125);
Expect.equals(a126, result.a126);
Expect.equals(a127, result.a127);
}
@Native<Struct3BytesPackedInt Function(Int8, Int16)>(
symbol: 'ReturnStruct3BytesPackedInt',
)
external Struct3BytesPackedInt returnStruct3BytesPackedIntNative(
int a0,
int a1,
);
/// Small struct with mis-aligned member.
void testReturnStruct3BytesPackedIntNative() {
int a0;
int a1;
a0 = -1;
a1 = 2;
final result = returnStruct3BytesPackedIntNative(a0, a1);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
}
@Native<Struct8BytesPackedInt Function(Uint8, Uint32, Uint8, Uint8, Uint8)>(
symbol: 'ReturnStruct8BytesPackedInt',
)
external Struct8BytesPackedInt returnStruct8BytesPackedIntNative(
int a0,
int a1,
int a2,
int a3,
int a4,
);
/// Struct with mis-aligned member.
void testReturnStruct8BytesPackedIntNative() {
int a0;
int a1;
int a2;
int a3;
int a4;
a0 = 1;
a1 = 2;
a2 = 3;
a3 = 4;
a4 = 5;
final result = returnStruct8BytesPackedIntNative(a0, a1, a2, a3, a4);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.equals(a1, result.a1);
Expect.equals(a2, result.a2);
Expect.equals(a3, result.a3);
Expect.equals(a4, result.a4);
}
@Native<Struct9BytesPackedMixed Function(Uint8, Double)>(
symbol: 'ReturnStruct9BytesPackedMixed',
)
external Struct9BytesPackedMixed returnStruct9BytesPackedMixedNative(
int a0,
double a1,
);
/// Struct with mis-aligned member.
/// Tests backfilling of CPU and FPU registers.
void testReturnStruct9BytesPackedMixedNative() {
int a0;
double a1;
a0 = 1;
a1 = 2.0;
final result = returnStruct9BytesPackedMixedNative(a0, a1);
print("result = $result");
Expect.equals(a0, result.a0);
Expect.approxEquals(a1, result.a1);
}
@Native<Union4BytesMixed Function(Uint32)>(symbol: 'ReturnUnion4BytesMixed')
external Union4BytesMixed returnUnion4BytesMixedNative(int a0);
/// Returning a mixed integer/float union.
void testReturnUnion4BytesMixedNative() {
int a0;
a0 = 1;
final result = returnUnion4BytesMixedNative(a0);
print("result = $result");
Expect.equals(a0, result.a0);
}
@Native<Union8BytesNestedFloat Function(Double)>(
symbol: 'ReturnUnion8BytesNestedFloat',
)
external Union8BytesNestedFloat returnUnion8BytesNestedFloatNative(double a0);
/// Returning a floating point only union.
void testReturnUnion8BytesNestedFloatNative() {
double a0;
a0 = -1.0;
final result = returnUnion8BytesNestedFloatNative(a0);
print("result = $result");
Expect.approxEquals(a0, result.a0);
}
@Native<Union9BytesNestedInt Function(Struct8BytesInt)>(
symbol: 'ReturnUnion9BytesNestedInt',
)
external Union9BytesNestedInt returnUnion9BytesNestedIntNative(
Struct8BytesInt a0,
);
/// Returning a mixed-size union.
void testReturnUnion9BytesNestedIntNative() {
final a0Pointer = calloc<Struct8BytesInt>();
final Struct8BytesInt a0 = a0Pointer.ref;
a0.a0 = -1;
a0.a1 = 2;
a0.a2 = -3;
final result = returnUnion9BytesNestedIntNative(a0);
print("result = $result");
Expect.equals(a0.a0, result.a0.a0);
Expect.equals(a0.a1, result.a0.a1);
Expect.equals(a0.a2, result.a0.a2);
calloc.free(a0Pointer);
}
@Native<Union16BytesNestedFloat Function(Struct8BytesHomogeneousFloat)>(
symbol: 'ReturnUnion16BytesNestedFloat',
)
external Union16BytesNestedFloat returnUnion16BytesNestedFloatNative(
Struct8BytesHomogeneousFloat a0,
);
/// Returning union with homogenous floats.
void testReturnUnion16BytesNestedFloatNative() {
final a0Pointer = calloc<Struct8BytesHomogeneousFloat>();
final Struct8BytesHomogeneousFloat a0 = a0Pointer.ref;
a0.a0 = -1.0;
a0.a1 = 2.0;
final result = returnUnion16BytesNestedFloatNative(a0);
print("result = $result");
Expect.approxEquals(a0.a0, result.a0.a0);
Expect.approxEquals(a0.a1, result.a0.a1);
calloc.free(a0Pointer);
}