From e29a5fe5a14821e6bda9c187f19e9cb6fb43b4e06666c799e50c0bb1fdab245a Mon Sep 17 00:00:00 2001 From: Dinar Valeev Date: Thu, 10 Dec 2015 16:15:47 +0000 Subject: [PATCH 1/2] Accepting request 348252 from home:michel_mno:branches:Mono:Factory - new basic_changes_powerpc_be.patch to build ppc64 archi and disable ppc build that still segfault. OBS-URL: https://build.opensuse.org/request/show/348252 OBS-URL: https://build.opensuse.org/package/show/Mono:Factory/mono-core?expand=0&rev=161 --- basic_changes_powerpc_be.patch | 94 ++++++++++++++++++++++++++++++++++ mono-core.changes | 6 +++ mono-core.spec | 4 ++ 3 files changed, 104 insertions(+) create mode 100644 basic_changes_powerpc_be.patch diff --git a/basic_changes_powerpc_be.patch b/basic_changes_powerpc_be.patch new file mode 100644 index 0000000..7afae8f --- /dev/null +++ b/basic_changes_powerpc_be.patch @@ -0,0 +1,94 @@ +commit 8332185abf23e2f27a536e6b7a08310aba8564fb +Author: Bill Seurer +Date: Tue Aug 18 09:36:23 2015 -0500 + +[ppc] Basic changes to allow mono to build and run on power BE +patch adapted to current mono 4.2.1.102 + +The patch of tramp-ppc.c was not from above commit +but is also required to avoid ppc64 build segfault. + +Signed-off-by: Michel Normand +--- + mono/mini/mini-ppc.c | 10 ++++++++-- + mono/mini/mini-trampolines.c | 5 ++++- + mono/mini/tramp-ppc.c | 4 ++++ + mono/sgen/sgen-archdep.h | 4 ++-- + 4 files changed, 18 insertions(+), 5 deletions(-) + +Index: mono-4.2.1/mono/mini/mini-ppc.c +=================================================================== +--- mono-4.2.1.orig/mono/mini/mini-ppc.c ++++ mono-4.2.1/mono/mini/mini-ppc.c +@@ -1086,7 +1086,10 @@ get_call_info (MonoGenericSharingContext + cinfo->args [n].size = size; + + /* It was 7, now it is 8 in LinuxPPC */ +- if (fr <= PPC_LAST_FPARG_REG) { ++ if (fr <= PPC_LAST_FPARG_REG ++ // For non-native vararg calls the parms must go in storage ++ && !(!sig->pinvoke && (sig->call_convention == MONO_CALL_VARARG)) ++ ) { + cinfo->args [n].regtype = RegTypeFP; + cinfo->args [n].reg = fr; + fr ++; +@@ -1177,7 +1180,10 @@ get_call_info (MonoGenericSharingContext + case MONO_TYPE_R8: + cinfo->args [n].size = 8; + /* It was 7, now it is 8 in LinuxPPC */ +- if (fr <= PPC_LAST_FPARG_REG) { ++ if (fr <= PPC_LAST_FPARG_REG ++ // For non-native vararg calls the parms must go in storage ++ && !(!sig->pinvoke && (sig->call_convention == MONO_CALL_VARARG)) ++ ) { + cinfo->args [n].regtype = RegTypeFP; + cinfo->args [n].reg = fr; + fr ++; +Index: mono-4.2.1/mono/mini/mini-trampolines.c +=================================================================== +--- mono-4.2.1.orig/mono/mini/mini-trampolines.c ++++ mono-4.2.1/mono/mini/mini-trampolines.c +@@ -1066,7 +1066,10 @@ mono_delegate_trampoline (mgreg_t *regs, + } + } + } +- } else { ++ // If "delegate->method_ptr" is null mono_get_addr_from_ftnptr will fail if ++ // ftnptrs are being used. "method" would end up null on archtitectures without ++ // ftnptrs so we can just skip this. ++ } else if (delegate->method_ptr) { + ji = mono_jit_info_table_find (domain, mono_get_addr_from_ftnptr (delegate->method_ptr)); + if (ji) + method = jinfo_get_method (ji); +Index: mono-4.2.1/mono/sgen/sgen-archdep.h +=================================================================== +--- mono-4.2.1.orig/mono/sgen/sgen-archdep.h ++++ mono-4.2.1/mono/sgen/sgen-archdep.h +@@ -88,8 +88,8 @@ + } while (0) + + /* MS_BLOCK_SIZE must be a multiple of the system pagesize, which for some +- archs is 64k. */ +-#if defined(TARGET_POWERPC64) && _CALL_ELF == 2 ++ architectures is 64k. */ ++#if defined(TARGET_POWERPC64) + #define ARCH_MIN_MS_BLOCK_SIZE (64*1024) + #define ARCH_MIN_MS_BLOCK_SIZE_SHIFT 16 + #endif +Index: mono-4.2.1/mono/mini/tramp-ppc.c +=================================================================== +--- mono-4.2.1.orig/mono/mini/tramp-ppc.c ++++ mono-4.2.1/mono/mini/tramp-ppc.c +@@ -625,8 +625,12 @@ mono_arch_get_nullified_class_init_tramp + + g_assert (code - buf <= tramp_size); + ++ if (info) + *info = mono_tramp_info_create ("nullified_class_init_trampoline", buf, code - buf, NULL, NULL); + ++ /* It is expected to be a function descriptor on power pre-v2 ABI */ ++ buf = mono_create_ftnptr (mono_domain_get (), buf); ++ + return buf; + } + diff --git a/mono-core.changes b/mono-core.changes index 75dde3b..40aed35 100644 --- a/mono-core.changes +++ b/mono-core.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Dec 10 15:08:07 UTC 2015 - normand@linux.vnet.ibm.com + +- new basic_changes_powerpc_be.patch to build ppc64 archi + and disable ppc build that still segfault. + ------------------------------------------------------------------- Tue Nov 17 00:00:00 UTC 2015 - fwdsbs.to.11df@xoxy.net, martin.liska@suse.com diff --git a/mono-core.spec b/mono-core.spec index 8a015e7..406dfd2 100644 --- a/mono-core.spec +++ b/mono-core.spec @@ -30,6 +30,8 @@ Url: http://www.mono-project.com Source0: http://download.mono-project.com/sources/mono/mono-%{version}.102.tar.bz2 Source1: mono-core.rpmlintrc Source2: gmcs +# ppc build segfault so exclude it +ExcludeArch: ppc # PATCH-FIX-OPENSUSE Use runtime 4.5 as default for nunit Patch0: mono-nunit-default-runtime-4.5.patch # PATCH-FIX-OPENSUSE authors file is missing @@ -37,6 +39,7 @@ Patch2: authors.patch # PATCH-FIX-OPENSUSE fix insecure use of strncat at process.c:383 to fix build process Patch3: strncat-process-c.patch Patch4: mono-un-revoke-fix-in-BNC-144655.patch +Patch5: basic_changes_powerpc_be.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bison @@ -113,6 +116,7 @@ technologies that have been submitted to the ECMA for standardization. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %build NOCONFIGURE="yes" ./autogen.sh From a22a803e726de04a6f15ee759dfde6e08f32a795213e953a5e318e8dc1176584 Mon Sep 17 00:00:00 2001 From: Dinar Valeev Date: Fri, 11 Dec 2015 11:36:07 +0000 Subject: [PATCH 2/2] Accepting request 348353 from home:michel_mno:branches:Mono:Factory - retrieve from upstream all ppc patches not yet in 4.2.1 tarball ppc_instruction_length_of_atomic_add_i4_is_28.patch fix_atomic_add_i4_support_for_32bit_ppc.patch basic_changes_powerpc_be.patch (already done yesterday) ppc_add_monocontext_and_async_callback.patch fix_passing_struct_parms_per_elf_abiv2.patch update_elf_abiv2_testcases.patch partial_sharing_false_4_powerpc.patch fix_exception_when_reading_from_timezone_file.patch OBS-URL: https://build.opensuse.org/request/show/348353 OBS-URL: https://build.opensuse.org/package/show/Mono:Factory/mono-core?expand=0&rev=162 --- fix_atomic_add_i4_support_for_32bit_ppc.patch | 59 + ...tion_when_reading_from_timezone_file.patch | 24 + fix_passing_struct_parms_per_elf_abiv2.patch | 3352 +++++++++++++ mono-core.changes | 13 + mono-core.spec | 19 +- partial_sharing_false_4_powerpc.patch | 24 + ppc_add_monocontext_and_async_callback.patch | 168 + ...uction_length_of_atomic_add_i4_is_28.patch | 21 + update_elf_abiv2_testcases.patch | 4409 +++++++++++++++++ 9 files changed, 8088 insertions(+), 1 deletion(-) create mode 100644 fix_atomic_add_i4_support_for_32bit_ppc.patch create mode 100644 fix_exception_when_reading_from_timezone_file.patch create mode 100644 fix_passing_struct_parms_per_elf_abiv2.patch create mode 100644 partial_sharing_false_4_powerpc.patch create mode 100644 ppc_add_monocontext_and_async_callback.patch create mode 100644 ppc_instruction_length_of_atomic_add_i4_is_28.patch create mode 100644 update_elf_abiv2_testcases.patch diff --git a/fix_atomic_add_i4_support_for_32bit_ppc.patch b/fix_atomic_add_i4_support_for_32bit_ppc.patch new file mode 100644 index 0000000..eb29bc4 --- /dev/null +++ b/fix_atomic_add_i4_support_for_32bit_ppc.patch @@ -0,0 +1,59 @@ +From 8f379f0c8f98493180b508b9e68b9aa76c0c5bdf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= +Date: Mon, 3 Aug 2015 17:32:31 +0200 +Subject: [PATCH] [ppc] Fix atomic_add_i4 support for 32-bit PPC. + + +--- + mono/mini/mini-ppc.c | 31 ++++++++++++++++--------------- + 1 file changed, 16 insertions(+), 15 deletions(-) + +Index: mono-4.2.1/mono/mini/mini-ppc.c +=================================================================== +--- mono-4.2.1.orig/mono/mini/mini-ppc.c ++++ mono-4.2.1/mono/mini/mini-ppc.c +@@ -4417,6 +4417,22 @@ mono_arch_output_basic_block (MonoCompil + else + ppc_mr (code, ins->dreg, ins->sreg1); + break; ++#else ++ case OP_ICONV_TO_R4: ++ case OP_ICONV_TO_R8: { ++ if (cpu_hw_caps & PPC_ISA_64) { ++ ppc_srawi(code, ppc_r0, ins->sreg1, 31); ++ ppc_stw (code, ppc_r0, -8, ppc_r1); ++ ppc_stw (code, ins->sreg1, -4, ppc_r1); ++ ppc_lfd (code, ins->dreg, -8, ppc_r1); ++ ppc_fcfid (code, ins->dreg, ins->dreg); ++ if (ins->opcode == OP_ICONV_TO_R4) ++ ppc_frsp (code, ins->dreg, ins->dreg); ++ } ++ break; ++ } ++#endif ++ + case OP_ATOMIC_ADD_I4: + CASE_PPC64 (OP_ATOMIC_ADD_I8) { + int location = ins->inst_basereg; +@@ -4450,21 +4466,6 @@ mono_arch_output_basic_block (MonoCompil + ppc_mr (code, ins->dreg, ppc_r0); + break; + } +-#else +- case OP_ICONV_TO_R4: +- case OP_ICONV_TO_R8: { +- if (cpu_hw_caps & PPC_ISA_64) { +- ppc_srawi(code, ppc_r0, ins->sreg1, 31); +- ppc_stw (code, ppc_r0, -8, ppc_r1); +- ppc_stw (code, ins->sreg1, -4, ppc_r1); +- ppc_lfd (code, ins->dreg, -8, ppc_r1); +- ppc_fcfid (code, ins->dreg, ins->dreg); +- if (ins->opcode == OP_ICONV_TO_R4) +- ppc_frsp (code, ins->dreg, ins->dreg); +- } +- break; +- } +-#endif + case OP_ATOMIC_CAS_I4: + CASE_PPC64 (OP_ATOMIC_CAS_I8) { + int location = ins->sreg1; diff --git a/fix_exception_when_reading_from_timezone_file.patch b/fix_exception_when_reading_from_timezone_file.patch new file mode 100644 index 0000000..b45568f --- /dev/null +++ b/fix_exception_when_reading_from_timezone_file.patch @@ -0,0 +1,24 @@ +From 45c3685e3b360ecc8c5a78ee10c298d6b584a302 Mon Sep 17 00:00:00 2001 +From: Bill Seurer +Date: Thu, 10 Sep 2015 13:34:27 -0500 +Subject: [PATCH] [ppc] Fix exception when reading from timezone file. See + https://bugzilla.xamarin.com/show_bug.cgi?id=30360 + + +--- + mcs/class/corlib/System/TimeZoneInfo.cs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: mono-4.2.1/mcs/class/corlib/System/TimeZoneInfo.cs +=================================================================== +--- mono-4.2.1.orig/mcs/class/corlib/System/TimeZoneInfo.cs ++++ mono-4.2.1/mcs/class/corlib/System/TimeZoneInfo.cs +@@ -1175,7 +1175,7 @@ namespace System + return (((i >> 24) & 0xff) + | ((i >> 8) & 0xff00) + | ((i << 8) & 0xff0000) +- | ((i << 24))); ++ | (((i & 0xff) << 24))); + } + + static int ReadBigEndianInt32 (byte [] buffer, int start) diff --git a/fix_passing_struct_parms_per_elf_abiv2.patch b/fix_passing_struct_parms_per_elf_abiv2.patch new file mode 100644 index 0000000..02c9013 --- /dev/null +++ b/fix_passing_struct_parms_per_elf_abiv2.patch @@ -0,0 +1,3352 @@ +From 0d464be2b3ae6f7ddb9a3f3c97622a988be8ae33 Mon Sep 17 00:00:00 2001 +From: Bill Seurer +Date: Mon, 31 Aug 2015 16:07:02 -0500 +Subject: [PATCH] [ppc] Fix passing of structure parameters as per the ELF ABI + v2. Add 5 new test cases to test the new ABI changes. + + +--- + mono/mini/mini-ppc.c | 174 +++- + mono/mini/mini-ppc.h | 47 + + mono/tests/Makefile.am | 15 + mono/tests/libtest.c | 1672 +++++++++++++++++++++++++++++++++++++++++++++ + mono/tests/pinvoke_ppcc.cs | 426 +++++++++++ + mono/tests/pinvoke_ppcd.cs | 215 +++++ + mono/tests/pinvoke_ppcf.cs | 216 +++++ + mono/tests/pinvoke_ppci.cs | 132 +++ + mono/tests/pinvoke_ppcs.cs | 214 +++++ + 9 files changed, 3079 insertions(+), 32 deletions(-) + +Index: mono-4.2.1/mono/mini/mini-ppc.c +=================================================================== +--- mono-4.2.1.orig/mono/mini/mini-ppc.c ++++ mono-4.2.1/mono/mini/mini-ppc.c +@@ -206,7 +206,7 @@ emit_memcpy (guint8 *code, int size, int + } + #ifdef __mono_ppc64__ + /* the hardware has multiple load/store units and the move is long +- enough to use more then one regiester, then use load/load/store/store ++ enough to use more then one register, then use load/load/store/store + to execute 2 instructions per cycle. */ + if ((cpu_hw_caps & PPC_MULTIPLE_LS_UNITS) && (dreg != ppc_r11) && (sreg != ppc_r11)) { + while (size >= 16) { +@@ -867,18 +867,19 @@ enum { + RegTypeBase, + RegTypeFP, + RegTypeStructByVal, +- RegTypeStructByAddr ++ RegTypeStructByAddr, ++ RegTypeFPStructByVal, // For the v2 ABI, floats should be passed in FRs instead of GRs. Only valid for ABI v2! + }; + + typedef struct { + gint32 offset; + guint32 vtsize; /* in param area */ + guint8 reg; +- guint8 vtregs; /* number of registers used to pass a RegTypeStructByVal */ ++ guint8 vtregs; /* number of registers used to pass a RegTypeStructByVal/RegTypeFPStructByVal */ + guint8 regtype : 4; /* 0 general, 1 basereg, 2 floating point register, see RegType* */ +- guint8 size : 4; /* 1, 2, 4, 8, or regs used by RegTypeStructByVal */ ++ guint8 size : 4; /* 1, 2, 4, 8, or regs used by RegTypeStructByVal/RegTypeFPStructByVal */ + guint8 bytes : 4; /* size in bytes - only valid for +- RegTypeStructByVal if the struct fits ++ RegTypeStructByVal/RegTypeFPStructByVal if the struct fits + in one word, otherwise it's 0*/ + } ArgInfo; + +@@ -934,7 +935,7 @@ add_general (guint *gr, guint *stack_siz + (*gr) ++; + } + +-#if defined(__APPLE__) || defined(__mono_ppc64__) ++#if defined(__APPLE__) || (defined(__mono_ppc64__) && !PPC_PASS_SMALL_FLOAT_STRUCTS_IN_FR_REGS) + static gboolean + has_only_a_r48_field (MonoClass *klass) + { +@@ -1071,9 +1072,7 @@ get_call_info (MonoGenericSharingContext + case MONO_TYPE_VALUETYPE: + case MONO_TYPE_TYPEDBYREF: { + gint size; +- MonoClass *klass; +- +- klass = mono_class_from_mono_type (sig->params [i]); ++ MonoClass *klass = mono_class_from_mono_type (sig->params [i]); + if (simpletype->type == MONO_TYPE_TYPEDBYREF) + size = sizeof (MonoTypedRef); + else if (is_pinvoke) +@@ -1081,7 +1080,7 @@ get_call_info (MonoGenericSharingContext + else + size = mono_class_value_size (klass, NULL); + +-#if defined(__APPLE__) || defined(__mono_ppc64__) ++#if defined(__APPLE__) || (defined(__mono_ppc64__) && !PPC_PASS_SMALL_FLOAT_STRUCTS_IN_FR_REGS) + if ((size == 4 || size == 8) && has_only_a_r48_field (klass)) { + cinfo->args [n].size = size; + +@@ -1115,24 +1114,57 @@ get_call_info (MonoGenericSharingContext + int align_size = size; + int nregs = 0; + int rest = PPC_LAST_ARG_REG - gr + 1; +- int n_in_regs; ++ int n_in_regs = 0; + +- align_size += (sizeof (gpointer) - 1); +- align_size &= ~(sizeof (gpointer) - 1); +- nregs = (align_size + sizeof (gpointer) -1 ) / sizeof (gpointer); +- n_in_regs = MIN (rest, nregs); +- if (n_in_regs < 0) +- n_in_regs = 0; ++#if PPC_PASS_SMALL_FLOAT_STRUCTS_IN_FR_REGS ++ int mbr_cnt = 0; ++ int mbr_size = 0; ++ gboolean is_all_floats = mini_type_is_hfa (sig->params [i], &mbr_cnt, &mbr_size); ++ ++ if (is_all_floats && (mbr_cnt <= 8)) { ++ rest = PPC_LAST_FPARG_REG - fr + 1; ++ } ++ // Pass small (<= 8 member) structures entirely made up of either float or double members ++ // in FR registers. There have to be at least mbr_cnt registers left. ++ if (is_all_floats && ++ (rest >= mbr_cnt) && ++ (mbr_cnt <= 8)) { ++ nregs = mbr_cnt; ++ n_in_regs = MIN (rest, nregs); ++ cinfo->args [n].regtype = RegTypeFPStructByVal; ++ cinfo->args [n].vtregs = n_in_regs; ++ cinfo->args [n].size = mbr_size; ++ cinfo->args [n].vtsize = nregs - n_in_regs; ++ cinfo->args [n].reg = fr; ++ fr += n_in_regs; ++ if (mbr_size == 4) { ++ // floats ++ FP_ALSO_IN_REG (gr += (n_in_regs+1)/2); ++ } else { ++ // doubles ++ FP_ALSO_IN_REG (gr += (n_in_regs)); ++ } ++ } else ++#endif ++ { ++ align_size += (sizeof (gpointer) - 1); ++ align_size &= ~(sizeof (gpointer) - 1); ++ nregs = (align_size + sizeof (gpointer) -1 ) / sizeof (gpointer); ++ n_in_regs = MIN (rest, nregs); ++ if (n_in_regs < 0) ++ n_in_regs = 0; + #ifdef __APPLE__ +- /* FIXME: check this */ +- if (size >= 3 && size % 4 != 0) +- n_in_regs = 0; +-#endif +- cinfo->args [n].regtype = RegTypeStructByVal; +- cinfo->args [n].vtregs = n_in_regs; +- cinfo->args [n].size = n_in_regs; +- cinfo->args [n].vtsize = nregs - n_in_regs; +- cinfo->args [n].reg = gr; ++ /* FIXME: check this */ ++ if (size >= 3 && size % 4 != 0) ++ n_in_regs = 0; ++#endif ++ cinfo->args [n].regtype = RegTypeStructByVal; ++ cinfo->args [n].vtregs = n_in_regs; ++ cinfo->args [n].size = n_in_regs; ++ cinfo->args [n].vtsize = nregs - n_in_regs; ++ cinfo->args [n].reg = gr; ++ gr += n_in_regs; ++ } + + #ifdef __mono_ppc64__ + if (nregs == 1 && is_pinvoke) +@@ -1140,7 +1172,6 @@ get_call_info (MonoGenericSharingContext + else + #endif + cinfo->args [n].bytes = 0; +- gr += n_in_regs; + cinfo->args [n].offset = PPC_STACK_PARAM_OFFSET + stack_size; + /*g_print ("offset for arg %d at %d\n", n, PPC_STACK_PARAM_OFFSET + stack_size);*/ + stack_size += nregs * sizeof (gpointer); +@@ -1598,6 +1629,17 @@ mono_arch_emit_call (MonoCompile *cfg, M + ins->inst_p1 = mono_mempool_alloc (cfg->mempool, sizeof (ArgInfo)); + memcpy (ins->inst_p1, ainfo, sizeof (ArgInfo)); + MONO_ADD_INS (cfg->cbb, ins); ++ } else if (ainfo->regtype == RegTypeFPStructByVal) { ++ /* this is further handled in mono_arch_emit_outarg_vt () */ ++ MONO_INST_NEW (cfg, ins, OP_OUTARG_VT); ++ ins->opcode = OP_OUTARG_VT; ++ ins->sreg1 = in->dreg; ++ ins->klass = in->klass; ++ ins->inst_p0 = call; ++ ins->inst_p1 = mono_mempool_alloc (cfg->mempool, sizeof (ArgInfo)); ++ memcpy (ins->inst_p1, ainfo, sizeof (ArgInfo)); ++ MONO_ADD_INS (cfg->cbb, ins); ++ cfg->flags |= MONO_CFG_HAS_FPOUT; + } else if (ainfo->regtype == RegTypeBase) { + if (!t->byref && ((t->type == MONO_TYPE_I8) || (t->type == MONO_TYPE_U8))) { + MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREI8_MEMBASE_REG, ppc_r1, ainfo->offset, in->dreg); +@@ -1701,20 +1743,39 @@ mono_arch_emit_outarg_vt (MonoCompile *c + } else + #endif + for (i = 0; i < ainfo->vtregs; ++i) { ++ dreg = mono_alloc_ireg (cfg); ++#if G_BYTE_ORDER == G_BIG_ENDIAN + int antipadding = 0; + if (ainfo->bytes) { + g_assert (i == 0); + antipadding = sizeof (gpointer) - ainfo->bytes; + } +- dreg = mono_alloc_ireg (cfg); + MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, src->dreg, soffset); + if (antipadding) + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SHR_UN_IMM, dreg, dreg, antipadding * 8); ++#else ++ MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, src->dreg, soffset); ++#endif + mono_call_inst_add_outarg_reg (cfg, call, dreg, ainfo->reg + i, FALSE); + soffset += sizeof (gpointer); + } + if (ovf_size != 0) + mini_emit_memcpy (cfg, ppc_r1, doffset + soffset, src->dreg, soffset, ovf_size * sizeof (gpointer), 0); ++ } else if (ainfo->regtype == RegTypeFPStructByVal) { ++ soffset = 0; ++ for (i = 0; i < ainfo->vtregs; ++i) { ++ int tmpr = mono_alloc_freg (cfg); ++ if (ainfo->size == 4) ++ MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADR4_MEMBASE, tmpr, src->dreg, soffset); ++ else // ==8 ++ MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADR8_MEMBASE, tmpr, src->dreg, soffset); ++ dreg = mono_alloc_freg (cfg); ++ MONO_EMIT_NEW_UNALU (cfg, OP_FMOVE, dreg, tmpr); ++ mono_call_inst_add_outarg_reg (cfg, call, dreg, ainfo->reg+i, TRUE); ++ soffset += ainfo->size; ++ } ++ if (ovf_size != 0) ++ mini_emit_memcpy (cfg, ppc_r1, doffset + soffset, src->dreg, soffset, ovf_size * sizeof (gpointer), 0); + } else if (ainfo->regtype == RegTypeFP) { + int tmpr = mono_alloc_freg (cfg); + if (ainfo->size == 4) +@@ -1885,6 +1946,7 @@ mono_arch_instrument_epilog_full (MonoCo + if (enable_arguments) { + /* FIXME: get the actual address */ + ppc_mr (code, ppc_r4, ppc_r3); ++ // FIXME: Support the new v2 ABI! + } + break; + case SAVE_NONE: +@@ -3869,6 +3931,16 @@ mono_arch_output_basic_block (MonoCompil + ppc_ldptr (code, ppc_r2, 8, ins->sreg1); + ppc_mtlr (code, ppc_r0); + #else ++#if (_CALL_ELF == 2) ++ if (ins->flags & MONO_INST_HAS_METHOD) { ++ // Not a global entry point ++ } else { ++ // Need to set up r12 with function entry address for global entry point ++ if (ppc_r12 != ins->sreg1) { ++ ppc_mr(code,ppc_r12,ins->sreg1); ++ } ++ } ++#endif + ppc_mtlr (code, ins->sreg1); + #endif + ppc_blrl (code); +@@ -5018,6 +5090,25 @@ mono_arch_emit_prolog (MonoCompile *cfg) + ppc_stfs (code, ainfo->reg, inst->inst_offset, inst->inst_basereg); + else + g_assert_not_reached (); ++ } else if (ainfo->regtype == RegTypeFPStructByVal) { ++ int doffset = inst->inst_offset; ++ int soffset = 0; ++ int cur_reg; ++ int size = 0; ++ g_assert (ppc_is_imm16 (inst->inst_offset)); ++ g_assert (ppc_is_imm16 (inst->inst_offset + ainfo->vtregs * sizeof (gpointer))); ++ /* FIXME: what if there is no class? */ ++ if (sig->pinvoke && mono_class_from_mono_type (inst->inst_vtype)) ++ size = mono_class_native_size (mono_class_from_mono_type (inst->inst_vtype), NULL); ++ for (cur_reg = 0; cur_reg < ainfo->vtregs; ++cur_reg) { ++ if (ainfo->size == 4) { ++ ppc_stfs (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); ++ } else { ++ ppc_stfd (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); ++ } ++ soffset += ainfo->size; ++ doffset += ainfo->size; ++ } + } else if (ainfo->regtype == RegTypeStructByVal) { + int doffset = inst->inst_offset; + int soffset = 0; +@@ -5047,9 +5138,21 @@ mono_arch_emit_prolog (MonoCompile *cfg) + #ifdef __mono_ppc64__ + if (ainfo->bytes) { + g_assert (cur_reg == 0); ++#if G_BYTE_ORDER == G_BIG_ENDIAN + ppc_sldi (code, ppc_r0, ainfo->reg, +- (sizeof (gpointer) - ainfo->bytes) * 8); ++ (sizeof (gpointer) - ainfo->bytes) * 8); + ppc_stptr (code, ppc_r0, doffset, inst->inst_basereg); ++#else ++ if (mono_class_native_size (inst->klass, NULL) == 1) { ++ ppc_stb (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); ++ } else if (mono_class_native_size (inst->klass, NULL) == 2) { ++ ppc_sth (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); ++ } else if (mono_class_native_size (inst->klass, NULL) == 4) { // WDS -- maybe <=4? ++ ppc_stw (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); ++ } else { ++ ppc_stptr (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); // WDS -- Better way? ++ } ++#endif + } else + #endif + { +@@ -6024,3 +6127,16 @@ mono_arch_opcode_supported (int opcode) + return FALSE; + } + } ++ ++ ++#if 0 ++// FIXME: To get the test case finally_block_ending_in_dead_bb to work properly we need to define the following ++// (in mini-ppc.h) and then implement the fuction mono_arch_create_handler_block_trampoline. ++// #define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1 ++ ++gpointer ++mono_arch_create_handler_block_trampoline (void) ++{ ++ . . . ++} ++#endif +Index: mono-4.2.1/mono/mini/mini-ppc.h +=================================================================== +--- mono-4.2.1.orig/mono/mini/mini-ppc.h ++++ mono-4.2.1/mono/mini/mini-ppc.h +@@ -135,6 +135,8 @@ typedef struct MonoCompileArch { + #define PPC_FIRST_FPARG_REG ppc_f1 + #define PPC_LAST_FPARG_REG ppc_f13 + #define PPC_PASS_STRUCTS_BY_VALUE 1 ++#define PPC_PASS_SMALL_FLOAT_STRUCTS_IN_FR_REGS 0 ++#define MONO_ARCH_HAVE_DECOMPOSE_VTYPE_OPTS 0 + #else + /* Linux */ + #ifdef __mono_ppc64__ +@@ -143,9 +145,19 @@ typedef struct MonoCompileArch { + #if (_CALL_ELF == 2) + #define PPC_STACK_PARAM_OFFSET 32 + #define PPC_MINIMAL_STACK_SIZE 32 ++ #define PPC_PASS_SMALL_FLOAT_STRUCTS_IN_FR_REGS 1 ++ #define MONO_ARCH_HAVE_DECOMPOSE_VTYPE_OPTS 1 ++// FIXME: To get the test case finally_block_ending_in_dead_bb to work properly we need to define the following ++// and then implement the fuction mono_arch_create_handler_block_trampoline. ++// #define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1 ++ ++// #define DEBUG_ELFABIV2 ++ + #else + #define PPC_STACK_PARAM_OFFSET 48 + #define PPC_MINIMAL_STACK_SIZE 48 ++ #define PPC_PASS_SMALL_FLOAT_STRUCTS_IN_FR_REGS 0 ++ #define MONO_ARCH_HAVE_DECOMPOSE_VTYPE_OPTS 0 + #endif + #define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1 + #define PPC_MINIMAL_PARAM_AREA_SIZE 64 +@@ -160,6 +172,13 @@ typedef struct MonoCompileArch { + #define PPC_MINIMAL_PARAM_AREA_SIZE 0 + #define PPC_LAST_FPARG_REG ppc_f8 + #define PPC_PASS_STRUCTS_BY_VALUE 0 ++#define PPC_LARGEST_STRUCT_SIZE_TO_RETURN_VIA_REGISTERS 0 ++#define PPC_MOST_FLOAT_STRUCT_MEMBERS_TO_RETURN_VIA_REGISTERS 0 ++#define PPC_PASS_SMALL_FLOAT_STRUCTS_IN_FR_REGS 0 ++#define PPC_RETURN_SMALL_FLOAT_STRUCTS_IN_FR_REGS 0 ++#define PPC_RETURN_SMALL_STRUCTS_IN_REGS 0 ++#define MONO_ARCH_HAVE_DECOMPOSE_VTYPE_OPTS 0 ++#define MONO_ARCH_RETURN_CAN_USE_MULTIPLE_REGISTERS 0 + #define PPC_THREAD_PTR_REG ppc_r2 + #endif + #define PPC_FIRST_ARG_REG ppc_r3 +@@ -198,6 +217,7 @@ typedef struct MonoCompileArch { + #define MONO_ARCH_HAVE_OP_TAIL_CALL 1 + + #define PPC_NUM_REG_ARGS (PPC_LAST_ARG_REG-PPC_FIRST_ARG_REG+1) ++#define PPC_NUM_REG_FPARGS (PPC_LAST_FPARG_REG-PPC_FIRST_FPARG_REG+1) + + #ifdef MONO_CROSS_COMPILE + +@@ -323,4 +343,31 @@ void mono_ppc_patch_plt_entry (guint8 *c + + void mono_ppc_set_func_into_sigctx (void *sigctx, void *func); + ++ ++// Debugging macros for ELF ABI v2 ++#ifdef DEBUG_ELFABIV2 ++ ++#define DEBUG_ELFABIV2_printf(a, ...) \ ++{if (getenv("DEBUG_ELFABIV2")) { printf(a, ##__VA_ARGS__); fflush(stdout); } } ++ ++#define DEBUG_ELFABIV2_mono_print_ins(a) \ ++{if (getenv("DEBUG_ELFABIV2")) { if (!a) {printf("null\n");} else {mono_print_ins(a);} fflush(stdout); } } ++ ++extern char* mono_type_full_name (MonoType *type); ++ ++#define DEBUG_ELFABIV2_mono_print_type(a) \ ++{if (getenv("DEBUG_ELFABIV2")) { printf("%s, size: %d\n", mono_type_get_name(&a->klass->byval_arg), mini_type_stack_size (NULL, a, 0)); fflush(stdout); } } ++ ++#define DEBUG_ELFABIV2_mono_print_class(a) \ ++{if (getenv("DEBUG_ELFABIV2")) { printf("%s\n", mono_type_get_name(&a->byval_arg)); fflush(stdout); } } ++ ++#else ++ ++#define DEBUG_ELFABIV2_printf(a, ...) ++#define DEBUG_ELFABIV2_mono_print_ins(a) ++#define DEBUG_ELFABIV2_mono_print_type(a) ++#define DEBUG_ELFABIV2_mono_print_class(a) ++ ++#endif ++ + #endif /* __MONO_MINI_PPC_H__ */ +Index: mono-4.2.1/mono/tests/Makefile.am +=================================================================== +--- mono-4.2.1.orig/mono/tests/Makefile.am ++++ mono-4.2.1/mono/tests/Makefile.am +@@ -413,7 +413,12 @@ BASE_TEST_CS_SRC= \ + sleep.cs \ + bug-27147.cs \ + bug-30085.cs \ +- bug-17537.cs ++ bug-17537.cs \ ++ pinvoke_ppcc.cs \ ++ pinvoke_ppcs.cs \ ++ pinvoke_ppci.cs \ ++ pinvoke_ppcf.cs \ ++ pinvoke_ppcd.cs + + TEST_CS_SRC_DIST= \ + $(BASE_TEST_CS_SRC) \ +@@ -460,8 +465,8 @@ PLATFORM_DISABLED_TESTS=finalizer-abort. + endif + + if POWERPC64 +-# These tests hang +-PLATFORM_DISABLED_TESTS=monitor.exe finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe ++# FIXME: These tests hang/fail for unknown reasons ++PLATFORM_DISABLED_TESTS=monitor.exe threadpool-exceptions5.exe + endif + + if ARM +@@ -853,6 +858,10 @@ runtest-managed: test-runner.exe $(TESTS + @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \ + $(RUNTIME) ./test-runner.exe -j a --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL) + ++runtest-managed-serial: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS) ++ @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \ ++ $(RUNTIME) ./test-runner.exe -j 1 --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL) ++ + testjit: + @if test x$(M) != x0; then $(MAKE) runtest-managed; else $(MAKE) runtest; fi + +Index: mono-4.2.1/mono/tests/libtest.c +=================================================================== +--- mono-4.2.1.orig/mono/tests/libtest.c ++++ mono-4.2.1/mono/tests/libtest.c +@@ -5445,3 +5445,1675 @@ mono_test_has_thiscall (void) + + #endif + ++ ++typedef struct { ++ char f1; ++} sbyte1; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte1 (sbyte1 s1, int addend) { ++ if (s1.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte1 s1.f1: got %d but expected %d\n", s1.f1, 1); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2; ++} sbyte2; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte2 (sbyte2 s2, int addend) { ++ if (s2.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte2 s2.f1: got %d but expected %d\n", s2.f1, 1); ++ return 1; ++ } ++ if (s2.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte2 s2.f2: got %d but expected %d\n", s2.f2, 2); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3; ++} sbyte3; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte3 (sbyte3 s3, int addend) { ++ if (s3.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte3 s3.f1: got %d but expected %d\n", s3.f1, 1); ++ return 1; ++ } ++ if (s3.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte3 s3.f2: got %d but expected %d\n", s3.f2, 2); ++ return 1; ++ } ++ if (s3.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte3 s3.f3: got %d but expected %d\n", s3.f3, 3); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4; ++} sbyte4; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte4 (sbyte4 s4, int addend) { ++ if (s4.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte4 s4.f1: got %d but expected %d\n", s4.f1, 1); ++ return 1; ++ } ++ if (s4.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte4 s4.f2: got %d but expected %d\n", s4.f2, 2); ++ return 1; ++ } ++ if (s4.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte4 s4.f3: got %d but expected %d\n", s4.f3, 3); ++ return 1; ++ } ++ if (s4.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte4 s4.f4: got %d but expected %d\n", s4.f4, 4); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5; ++} sbyte5; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte5 (sbyte5 s5, int addend) { ++ if (s5.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte5 s5.f1: got %d but expected %d\n", s5.f1, 1); ++ return 1; ++ } ++ if (s5.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte5 s5.f2: got %d but expected %d\n", s5.f2, 2); ++ return 1; ++ } ++ if (s5.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte5 s5.f3: got %d but expected %d\n", s5.f3, 3); ++ return 1; ++ } ++ if (s5.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte5 s5.f4: got %d but expected %d\n", s5.f4, 4); ++ return 1; ++ } ++ if (s5.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte5 s5.f5: got %d but expected %d\n", s5.f5, 5); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6; ++} sbyte6; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte6 (sbyte6 s6, int addend) { ++ if (s6.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte6 s6.f1: got %d but expected %d\n", s6.f1, 1); ++ return 1; ++ } ++ if (s6.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte6 s6.f2: got %d but expected %d\n", s6.f2, 2); ++ return 1; ++ } ++ if (s6.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte6 s6.f3: got %d but expected %d\n", s6.f3, 3); ++ return 1; ++ } ++ if (s6.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte6 s6.f4: got %d but expected %d\n", s6.f4, 4); ++ return 1; ++ } ++ if (s6.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte6 s6.f5: got %d but expected %d\n", s6.f5, 5); ++ return 1; ++ } ++ if (s6.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte6 s6.f6: got %d but expected %d\n", s6.f6, 6); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7; ++} sbyte7; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte7 (sbyte7 s7, int addend) { ++ if (s7.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte7 s7.f1: got %d but expected %d\n", s7.f1, 1); ++ return 1; ++ } ++ if (s7.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte7 s7.f2: got %d but expected %d\n", s7.f2, 2); ++ return 1; ++ } ++ if (s7.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte7 s7.f3: got %d but expected %d\n", s7.f3, 3); ++ return 1; ++ } ++ if (s7.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte7 s7.f4: got %d but expected %d\n", s7.f4, 4); ++ return 1; ++ } ++ if (s7.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte7 s7.f5: got %d but expected %d\n", s7.f5, 5); ++ return 1; ++ } ++ if (s7.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte7 s7.f6: got %d but expected %d\n", s7.f6, 6); ++ return 1; ++ } ++ if (s7.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte7 s7.f7: got %d but expected %d\n", s7.f7, 7); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7,f8; ++} sbyte8; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte8 (sbyte8 s8, int addend) { ++ if (s8.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte8 s8.f1: got %d but expected %d\n", s8.f1, 1); ++ return 1; ++ } ++ if (s8.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte8 s8.f2: got %d but expected %d\n", s8.f2, 2); ++ return 1; ++ } ++ if (s8.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte8 s8.f3: got %d but expected %d\n", s8.f3, 3); ++ return 1; ++ } ++ if (s8.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte8 s8.f4: got %d but expected %d\n", s8.f4, 4); ++ return 1; ++ } ++ if (s8.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte8 s8.f5: got %d but expected %d\n", s8.f5, 5); ++ return 1; ++ } ++ if (s8.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte8 s8.f6: got %d but expected %d\n", s8.f6, 6); ++ return 1; ++ } ++ if (s8.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte8 s8.f7: got %d but expected %d\n", s8.f7, 7); ++ return 1; ++ } ++ if (s8.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte8 s8.f8: got %d but expected %d\n", s8.f8, 8); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7,f8,f9; ++} sbyte9; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte9 (sbyte9 s9, int addend) { ++ if (s9.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte9 s9.f1: got %d but expected %d\n", s9.f1, 1); ++ return 1; ++ } ++ if (s9.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte9 s9.f2: got %d but expected %d\n", s9.f2, 2); ++ return 1; ++ } ++ if (s9.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte9 s9.f3: got %d but expected %d\n", s9.f3, 3); ++ return 1; ++ } ++ if (s9.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte9 s9.f4: got %d but expected %d\n", s9.f4, 4); ++ return 1; ++ } ++ if (s9.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte9 s9.f5: got %d but expected %d\n", s9.f5, 5); ++ return 1; ++ } ++ if (s9.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte9 s9.f6: got %d but expected %d\n", s9.f6, 6); ++ return 1; ++ } ++ if (s9.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte9 s9.f7: got %d but expected %d\n", s9.f7, 7); ++ return 1; ++ } ++ if (s9.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte9 s9.f8: got %d but expected %d\n", s9.f8, 8); ++ return 1; ++ } ++ if (s9.f9 != 9) { ++ fprintf(stderr, "mono_return_sbyte9 s9.f9: got %d but expected %d\n", s9.f9, 9); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10; ++} sbyte10; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte10 (sbyte10 s10, int addend) { ++ if (s10.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte10 s10.f1: got %d but expected %d\n", s10.f1, 1); ++ return 1; ++ } ++ if (s10.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte10 s10.f2: got %d but expected %d\n", s10.f2, 2); ++ return 1; ++ } ++ if (s10.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte10 s10.f3: got %d but expected %d\n", s10.f3, 3); ++ return 1; ++ } ++ if (s10.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte10 s10.f4: got %d but expected %d\n", s10.f4, 4); ++ return 1; ++ } ++ if (s10.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte10 s10.f5: got %d but expected %d\n", s10.f5, 5); ++ return 1; ++ } ++ if (s10.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte10 s10.f6: got %d but expected %d\n", s10.f6, 6); ++ return 1; ++ } ++ if (s10.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte10 s10.f7: got %d but expected %d\n", s10.f7, 7); ++ return 1; ++ } ++ if (s10.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte10 s10.f8: got %d but expected %d\n", s10.f8, 8); ++ return 1; ++ } ++ if (s10.f9 != 9) { ++ fprintf(stderr, "mono_return_sbyte10 s10.f9: got %d but expected %d\n", s10.f9, 9); ++ return 1; ++ } ++ if (s10.f10 != 10) { ++ fprintf(stderr, "mono_return_sbyte10 s10.f10: got %d but expected %d\n", s10.f10, 10); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11; ++} sbyte11; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte11 (sbyte11 s11, int addend) { ++ if (s11.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f1: got %d but expected %d\n", s11.f1, 1); ++ return 1; ++ } ++ if (s11.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f2: got %d but expected %d\n", s11.f2, 2); ++ return 1; ++ } ++ if (s11.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f3: got %d but expected %d\n", s11.f3, 3); ++ return 1; ++ } ++ if (s11.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f4: got %d but expected %d\n", s11.f4, 4); ++ return 1; ++ } ++ if (s11.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f5: got %d but expected %d\n", s11.f5, 5); ++ return 1; ++ } ++ if (s11.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f6: got %d but expected %d\n", s11.f6, 6); ++ return 1; ++ } ++ if (s11.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f7: got %d but expected %d\n", s11.f7, 7); ++ return 1; ++ } ++ if (s11.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f8: got %d but expected %d\n", s11.f8, 8); ++ return 1; ++ } ++ if (s11.f9 != 9) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f9: got %d but expected %d\n", s11.f9, 9); ++ return 1; ++ } ++ if (s11.f10 != 10) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f10: got %d but expected %d\n", s11.f10, 10); ++ return 1; ++ } ++ if (s11.f11 != 11) { ++ fprintf(stderr, "mono_return_sbyte11 s11.f11: got %d but expected %d\n", s11.f11, 11); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12; ++} sbyte12; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte12 (sbyte12 s12, int addend) { ++ if (s12.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f1: got %d but expected %d\n", s12.f1, 1); ++ return 1; ++ } ++ if (s12.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f2: got %d but expected %d\n", s12.f2, 2); ++ return 1; ++ } ++ if (s12.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f3: got %d but expected %d\n", s12.f3, 3); ++ return 1; ++ } ++ if (s12.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f4: got %d but expected %d\n", s12.f4, 4); ++ return 1; ++ } ++ if (s12.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f5: got %d but expected %d\n", s12.f5, 5); ++ return 1; ++ } ++ if (s12.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f6: got %d but expected %d\n", s12.f6, 6); ++ return 1; ++ } ++ if (s12.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f7: got %d but expected %d\n", s12.f7, 7); ++ return 1; ++ } ++ if (s12.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f8: got %d but expected %d\n", s12.f8, 8); ++ return 1; ++ } ++ if (s12.f9 != 9) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f9: got %d but expected %d\n", s12.f9, 9); ++ return 1; ++ } ++ if (s12.f10 != 10) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f10: got %d but expected %d\n", s12.f10, 10); ++ return 1; ++ } ++ if (s12.f11 != 11) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f11: got %d but expected %d\n", s12.f11, 11); ++ return 1; ++ } ++ if (s12.f12 != 12) { ++ fprintf(stderr, "mono_return_sbyte12 s12.f12: got %d but expected %d\n", s12.f12, 12); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13; ++} sbyte13; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte13 (sbyte13 s13, int addend) { ++ if (s13.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f1: got %d but expected %d\n", s13.f1, 1); ++ return 1; ++ } ++ if (s13.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f2: got %d but expected %d\n", s13.f2, 2); ++ return 1; ++ } ++ if (s13.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f3: got %d but expected %d\n", s13.f3, 3); ++ return 1; ++ } ++ if (s13.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f4: got %d but expected %d\n", s13.f4, 4); ++ return 1; ++ } ++ if (s13.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f5: got %d but expected %d\n", s13.f5, 5); ++ return 1; ++ } ++ if (s13.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f6: got %d but expected %d\n", s13.f6, 6); ++ return 1; ++ } ++ if (s13.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f7: got %d but expected %d\n", s13.f7, 7); ++ return 1; ++ } ++ if (s13.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f8: got %d but expected %d\n", s13.f8, 8); ++ return 1; ++ } ++ if (s13.f9 != 9) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f9: got %d but expected %d\n", s13.f9, 9); ++ return 1; ++ } ++ if (s13.f10 != 10) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f10: got %d but expected %d\n", s13.f10, 10); ++ return 1; ++ } ++ if (s13.f11 != 11) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f11: got %d but expected %d\n", s13.f11, 11); ++ return 1; ++ } ++ if (s13.f12 != 12) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f12: got %d but expected %d\n", s13.f12, 12); ++ return 1; ++ } ++ if (s13.f13 != 13) { ++ fprintf(stderr, "mono_return_sbyte13 s13.f13: got %d but expected %d\n", s13.f13, 13); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14; ++} sbyte14; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte14 (sbyte14 s14, int addend) { ++ if (s14.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f1: got %d but expected %d\n", s14.f1, 1); ++ return 1; ++ } ++ if (s14.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f2: got %d but expected %d\n", s14.f2, 2); ++ return 1; ++ } ++ if (s14.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f3: got %d but expected %d\n", s14.f3, 3); ++ return 1; ++ } ++ if (s14.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f4: got %d but expected %d\n", s14.f4, 4); ++ return 1; ++ } ++ if (s14.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f5: got %d but expected %d\n", s14.f5, 5); ++ return 1; ++ } ++ if (s14.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f6: got %d but expected %d\n", s14.f6, 6); ++ return 1; ++ } ++ if (s14.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f7: got %d but expected %d\n", s14.f7, 7); ++ return 1; ++ } ++ if (s14.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f8: got %d but expected %d\n", s14.f8, 8); ++ return 1; ++ } ++ if (s14.f9 != 9) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f9: got %d but expected %d\n", s14.f9, 9); ++ return 1; ++ } ++ if (s14.f10 != 10) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f10: got %d but expected %d\n", s14.f10, 10); ++ return 1; ++ } ++ if (s14.f11 != 11) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f11: got %d but expected %d\n", s14.f11, 11); ++ return 1; ++ } ++ if (s14.f12 != 12) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f12: got %d but expected %d\n", s14.f12, 12); ++ return 1; ++ } ++ if (s14.f13 != 13) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f13: got %d but expected %d\n", s14.f13, 13); ++ return 1; ++ } ++ if (s14.f14 != 14) { ++ fprintf(stderr, "mono_return_sbyte14 s14.f14: got %d but expected %d\n", s14.f14, 14); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15; ++} sbyte15; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte15 (sbyte15 s15, int addend) { ++ if (s15.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f1: got %d but expected %d\n", s15.f1, 1); ++ return 1; ++ } ++ if (s15.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f2: got %d but expected %d\n", s15.f2, 2); ++ return 1; ++ } ++ if (s15.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f3: got %d but expected %d\n", s15.f3, 3); ++ return 1; ++ } ++ if (s15.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f4: got %d but expected %d\n", s15.f4, 4); ++ return 1; ++ } ++ if (s15.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f5: got %d but expected %d\n", s15.f5, 5); ++ return 1; ++ } ++ if (s15.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f6: got %d but expected %d\n", s15.f6, 6); ++ return 1; ++ } ++ if (s15.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f7: got %d but expected %d\n", s15.f7, 7); ++ return 1; ++ } ++ if (s15.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f8: got %d but expected %d\n", s15.f8, 8); ++ return 1; ++ } ++ if (s15.f9 != 9) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f9: got %d but expected %d\n", s15.f9, 9); ++ return 1; ++ } ++ if (s15.f10 != 10) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f10: got %d but expected %d\n", s15.f10, 10); ++ return 1; ++ } ++ if (s15.f11 != 11) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f11: got %d but expected %d\n", s15.f11, 11); ++ return 1; ++ } ++ if (s15.f12 != 12) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f12: got %d but expected %d\n", s15.f12, 12); ++ return 1; ++ } ++ if (s15.f13 != 13) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f13: got %d but expected %d\n", s15.f13, 13); ++ return 1; ++ } ++ if (s15.f14 != 14) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f14: got %d but expected %d\n", s15.f14, 14); ++ return 1; ++ } ++ if (s15.f15 != 15) { ++ fprintf(stderr, "mono_return_sbyte15 s15.f15: got %d but expected %d\n", s15.f15, 15); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16; ++} sbyte16; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte16 (sbyte16 s16, int addend) { ++ if (s16.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f1: got %d but expected %d\n", s16.f1, 1); ++ return 1; ++ } ++ if (s16.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f2: got %d but expected %d\n", s16.f2, 2); ++ return 1; ++ } ++ if (s16.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f3: got %d but expected %d\n", s16.f3, 3); ++ return 1; ++ } ++ if (s16.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f4: got %d but expected %d\n", s16.f4, 4); ++ return 1; ++ } ++ if (s16.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f5: got %d but expected %d\n", s16.f5, 5); ++ return 1; ++ } ++ if (s16.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f6: got %d but expected %d\n", s16.f6, 6); ++ return 1; ++ } ++ if (s16.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f7: got %d but expected %d\n", s16.f7, 7); ++ return 1; ++ } ++ if (s16.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f8: got %d but expected %d\n", s16.f8, 8); ++ return 1; ++ } ++ if (s16.f9 != 9) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f9: got %d but expected %d\n", s16.f9, 9); ++ return 1; ++ } ++ if (s16.f10 != 10) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f10: got %d but expected %d\n", s16.f10, 10); ++ return 1; ++ } ++ if (s16.f11 != 11) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f11: got %d but expected %d\n", s16.f11, 11); ++ return 1; ++ } ++ if (s16.f12 != 12) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f12: got %d but expected %d\n", s16.f12, 12); ++ return 1; ++ } ++ if (s16.f13 != 13) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f13: got %d but expected %d\n", s16.f13, 13); ++ return 1; ++ } ++ if (s16.f14 != 14) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f14: got %d but expected %d\n", s16.f14, 14); ++ return 1; ++ } ++ if (s16.f15 != 15) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f15: got %d but expected %d\n", s16.f15, 15); ++ return 1; ++ } ++ if (s16.f16 != 16) { ++ fprintf(stderr, "mono_return_sbyte16 s16.f16: got %d but expected %d\n", s16.f16, 16); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17; ++} sbyte17; ++ ++LIBTEST_API char STDCALL ++mono_return_sbyte17 (sbyte17 s17, int addend) { ++ if (s17.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f1: got %d but expected %d\n", s17.f1, 1); ++ return 1; ++ } ++ if (s17.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f2: got %d but expected %d\n", s17.f2, 2); ++ return 1; ++ } ++ if (s17.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f3: got %d but expected %d\n", s17.f3, 3); ++ return 1; ++ } ++ if (s17.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f4: got %d but expected %d\n", s17.f4, 4); ++ return 1; ++ } ++ if (s17.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f5: got %d but expected %d\n", s17.f5, 5); ++ return 1; ++ } ++ if (s17.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f6: got %d but expected %d\n", s17.f6, 6); ++ return 1; ++ } ++ if (s17.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f7: got %d but expected %d\n", s17.f7, 7); ++ return 1; ++ } ++ if (s17.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f8: got %d but expected %d\n", s17.f8, 8); ++ return 1; ++ } ++ if (s17.f9 != 9) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f9: got %d but expected %d\n", s17.f9, 9); ++ return 1; ++ } ++ if (s17.f10 != 10) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f10: got %d but expected %d\n", s17.f10, 10); ++ return 1; ++ } ++ if (s17.f11 != 11) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f11: got %d but expected %d\n", s17.f11, 11); ++ return 1; ++ } ++ if (s17.f12 != 12) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f12: got %d but expected %d\n", s17.f12, 12); ++ return 1; ++ } ++ if (s17.f13 != 13) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f13: got %d but expected %d\n", s17.f13, 13); ++ return 1; ++ } ++ if (s17.f14 != 14) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f14: got %d but expected %d\n", s17.f14, 14); ++ return 1; ++ } ++ if (s17.f15 != 15) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f15: got %d but expected %d\n", s17.f15, 15); ++ return 1; ++ } ++ if (s17.f16 != 16) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f16: got %d but expected %d\n", s17.f16, 16); ++ return 1; ++ } ++ if (s17.f17 != 17) { ++ fprintf(stderr, "mono_return_sbyte17 s17.f17: got %d but expected %d\n", s17.f17, 17); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ short f1; ++} short1; ++ ++LIBTEST_API short STDCALL ++mono_return_short1 (short1 s1, int addend) { ++ if (s1.f1 != 1) { ++ fprintf(stderr, "mono_return_short1 s1.f1: got %d but expected %d\n", s1.f1, 1); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ short f1,f2; ++} short2; ++ ++LIBTEST_API short STDCALL ++mono_return_short2 (short2 s2, int addend) { ++ if (s2.f1 != 1) { ++ fprintf(stderr, "mono_return_short2 s2.f1: got %d but expected %d\n", s2.f1, 1); ++ return 1; ++ } ++ if (s2.f2 != 2) { ++ fprintf(stderr, "mono_return_short2 s2.f2: got %d but expected %d\n", s2.f2, 2); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ short f1,f2,f3; ++} short3; ++ ++LIBTEST_API short STDCALL ++mono_return_short3 (short3 s3, int addend) { ++ if (s3.f1 != 1) { ++ fprintf(stderr, "mono_return_short3 s3.f1: got %d but expected %d\n", s3.f1, 1); ++ return 1; ++ } ++ if (s3.f2 != 2) { ++ fprintf(stderr, "mono_return_short3 s3.f2: got %d but expected %d\n", s3.f2, 2); ++ return 1; ++ } ++ if (s3.f3 != 3) { ++ fprintf(stderr, "mono_return_short3 s3.f3: got %d but expected %d\n", s3.f3, 3); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ short f1,f2,f3,f4; ++} short4; ++ ++LIBTEST_API short STDCALL ++mono_return_short4 (short4 s4, int addend) { ++ if (s4.f1 != 1) { ++ fprintf(stderr, "mono_return_short4 s4.f1: got %d but expected %d\n", s4.f1, 1); ++ return 1; ++ } ++ if (s4.f2 != 2) { ++ fprintf(stderr, "mono_return_short4 s4.f2: got %d but expected %d\n", s4.f2, 2); ++ return 1; ++ } ++ if (s4.f3 != 3) { ++ fprintf(stderr, "mono_return_short4 s4.f3: got %d but expected %d\n", s4.f3, 3); ++ return 1; ++ } ++ if (s4.f4 != 4) { ++ fprintf(stderr, "mono_return_short4 s4.f4: got %d but expected %d\n", s4.f4, 4); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ short f1,f2,f3,f4,f5; ++} short5; ++ ++LIBTEST_API short STDCALL ++mono_return_short5 (short5 s5, int addend) { ++ if (s5.f1 != 1) { ++ fprintf(stderr, "mono_return_short5 s5.f1: got %d but expected %d\n", s5.f1, 1); ++ return 1; ++ } ++ if (s5.f2 != 2) { ++ fprintf(stderr, "mono_return_short5 s5.f2: got %d but expected %d\n", s5.f2, 2); ++ return 1; ++ } ++ if (s5.f3 != 3) { ++ fprintf(stderr, "mono_return_short5 s5.f3: got %d but expected %d\n", s5.f3, 3); ++ return 1; ++ } ++ if (s5.f4 != 4) { ++ fprintf(stderr, "mono_return_short5 s5.f4: got %d but expected %d\n", s5.f4, 4); ++ return 1; ++ } ++ if (s5.f5 != 5) { ++ fprintf(stderr, "mono_return_short5 s5.f5: got %d but expected %d\n", s5.f5, 5); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ short f1,f2,f3,f4,f5,f6; ++} short6; ++ ++LIBTEST_API short STDCALL ++mono_return_short6 (short6 s6, int addend) { ++ if (s6.f1 != 1) { ++ fprintf(stderr, "mono_return_short6 s6.f1: got %d but expected %d\n", s6.f1, 1); ++ return 1; ++ } ++ if (s6.f2 != 2) { ++ fprintf(stderr, "mono_return_short6 s6.f2: got %d but expected %d\n", s6.f2, 2); ++ return 1; ++ } ++ if (s6.f3 != 3) { ++ fprintf(stderr, "mono_return_short6 s6.f3: got %d but expected %d\n", s6.f3, 3); ++ return 1; ++ } ++ if (s6.f4 != 4) { ++ fprintf(stderr, "mono_return_short6 s6.f4: got %d but expected %d\n", s6.f4, 4); ++ return 1; ++ } ++ if (s6.f5 != 5) { ++ fprintf(stderr, "mono_return_short6 s6.f5: got %d but expected %d\n", s6.f5, 5); ++ return 1; ++ } ++ if (s6.f6 != 6) { ++ fprintf(stderr, "mono_return_short6 s6.f6: got %d but expected %d\n", s6.f6, 6); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ short f1,f2,f3,f4,f5,f6,f7; ++} short7; ++ ++LIBTEST_API short STDCALL ++mono_return_short7 (short7 s7, int addend) { ++ if (s7.f1 != 1) { ++ fprintf(stderr, "mono_return_short7 s7.f1: got %d but expected %d\n", s7.f1, 1); ++ return 1; ++ } ++ if (s7.f2 != 2) { ++ fprintf(stderr, "mono_return_short7 s7.f2: got %d but expected %d\n", s7.f2, 2); ++ return 1; ++ } ++ if (s7.f3 != 3) { ++ fprintf(stderr, "mono_return_short7 s7.f3: got %d but expected %d\n", s7.f3, 3); ++ return 1; ++ } ++ if (s7.f4 != 4) { ++ fprintf(stderr, "mono_return_short7 s7.f4: got %d but expected %d\n", s7.f4, 4); ++ return 1; ++ } ++ if (s7.f5 != 5) { ++ fprintf(stderr, "mono_return_short7 s7.f5: got %d but expected %d\n", s7.f5, 5); ++ return 1; ++ } ++ if (s7.f6 != 6) { ++ fprintf(stderr, "mono_return_short7 s7.f6: got %d but expected %d\n", s7.f6, 6); ++ return 1; ++ } ++ if (s7.f7 != 7) { ++ fprintf(stderr, "mono_return_short7 s7.f7: got %d but expected %d\n", s7.f7, 7); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ short f1,f2,f3,f4,f5,f6,f7,f8; ++} short8; ++ ++LIBTEST_API short STDCALL ++mono_return_short8 (short8 s8, int addend) { ++ if (s8.f1 != 1) { ++ fprintf(stderr, "mono_return_short8 s8.f1: got %d but expected %d\n", s8.f1, 1); ++ return 1; ++ } ++ if (s8.f2 != 2) { ++ fprintf(stderr, "mono_return_short8 s8.f2: got %d but expected %d\n", s8.f2, 2); ++ return 1; ++ } ++ if (s8.f3 != 3) { ++ fprintf(stderr, "mono_return_short8 s8.f3: got %d but expected %d\n", s8.f3, 3); ++ return 1; ++ } ++ if (s8.f4 != 4) { ++ fprintf(stderr, "mono_return_short8 s8.f4: got %d but expected %d\n", s8.f4, 4); ++ return 1; ++ } ++ if (s8.f5 != 5) { ++ fprintf(stderr, "mono_return_short8 s8.f5: got %d but expected %d\n", s8.f5, 5); ++ return 1; ++ } ++ if (s8.f6 != 6) { ++ fprintf(stderr, "mono_return_short8 s8.f6: got %d but expected %d\n", s8.f6, 6); ++ return 1; ++ } ++ if (s8.f7 != 7) { ++ fprintf(stderr, "mono_return_short8 s8.f7: got %d but expected %d\n", s8.f7, 7); ++ return 1; ++ } ++ if (s8.f8 != 8) { ++ fprintf(stderr, "mono_return_short8 s8.f8: got %d but expected %d\n", s8.f8, 8); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ short f1,f2,f3,f4,f5,f6,f7,f8,f9; ++} short9; ++ ++LIBTEST_API short STDCALL ++mono_return_short9 (short9 s9, int addend) { ++ if (s9.f1 != 1) { ++ fprintf(stderr, "mono_return_short9 s9.f1: got %d but expected %d\n", s9.f1, 1); ++ return 1; ++ } ++ if (s9.f2 != 2) { ++ fprintf(stderr, "mono_return_short9 s9.f2: got %d but expected %d\n", s9.f2, 2); ++ return 1; ++ } ++ if (s9.f3 != 3) { ++ fprintf(stderr, "mono_return_short9 s9.f3: got %d but expected %d\n", s9.f3, 3); ++ return 1; ++ } ++ if (s9.f4 != 4) { ++ fprintf(stderr, "mono_return_short9 s9.f4: got %d but expected %d\n", s9.f4, 4); ++ return 1; ++ } ++ if (s9.f5 != 5) { ++ fprintf(stderr, "mono_return_short9 s9.f5: got %d but expected %d\n", s9.f5, 5); ++ return 1; ++ } ++ if (s9.f6 != 6) { ++ fprintf(stderr, "mono_return_short9 s9.f6: got %d but expected %d\n", s9.f6, 6); ++ return 1; ++ } ++ if (s9.f7 != 7) { ++ fprintf(stderr, "mono_return_short9 s9.f7: got %d but expected %d\n", s9.f7, 7); ++ return 1; ++ } ++ if (s9.f8 != 8) { ++ fprintf(stderr, "mono_return_short9 s9.f8: got %d but expected %d\n", s9.f8, 8); ++ return 1; ++ } ++ if (s9.f9 != 9) { ++ fprintf(stderr, "mono_return_short9 s9.f9: got %d but expected %d\n", s9.f9, 9); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ int f1; ++} int1; ++ ++LIBTEST_API int STDCALL ++mono_return_int1 (int1 s1, int addend) { ++ if (s1.f1 != 1) { ++ fprintf(stderr, "mono_return_int1 s1.f1: got %d but expected %d\n", s1.f1, 1); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ int f1,f2; ++} int2; ++ ++LIBTEST_API int STDCALL ++mono_return_int2 (int2 s2, int addend) { ++ if (s2.f1 != 1) { ++ fprintf(stderr, "mono_return_int2 s2.f1: got %d but expected %d\n", s2.f1, 1); ++ return 1; ++ } ++ if (s2.f2 != 2) { ++ fprintf(stderr, "mono_return_int2 s2.f2: got %d but expected %d\n", s2.f2, 2); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ int f1,f2,f3; ++} int3; ++ ++LIBTEST_API int STDCALL ++mono_return_int3 (int3 s3, int addend) { ++ if (s3.f1 != 1) { ++ fprintf(stderr, "mono_return_int3 s3.f1: got %d but expected %d\n", s3.f1, 1); ++ return 1; ++ } ++ if (s3.f2 != 2) { ++ fprintf(stderr, "mono_return_int3 s3.f2: got %d but expected %d\n", s3.f2, 2); ++ return 1; ++ } ++ if (s3.f3 != 3) { ++ fprintf(stderr, "mono_return_int3 s3.f3: got %d but expected %d\n", s3.f3, 3); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ int f1,f2,f3,f4; ++} int4; ++ ++LIBTEST_API int STDCALL ++mono_return_int4 (int4 s4, int addend) { ++ if (s4.f1 != 1) { ++ fprintf(stderr, "mono_return_int4 s4.f1: got %d but expected %d\n", s4.f1, 1); ++ return 1; ++ } ++ if (s4.f2 != 2) { ++ fprintf(stderr, "mono_return_int4 s4.f2: got %d but expected %d\n", s4.f2, 2); ++ return 1; ++ } ++ if (s4.f3 != 3) { ++ fprintf(stderr, "mono_return_int4 s4.f3: got %d but expected %d\n", s4.f3, 3); ++ return 1; ++ } ++ if (s4.f4 != 4) { ++ fprintf(stderr, "mono_return_int4 s4.f4: got %d but expected %d\n", s4.f4, 4); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ int f1,f2,f3,f4,f5; ++} int5; ++ ++LIBTEST_API int STDCALL ++mono_return_int5 (int5 s5, int addend) { ++ if (s5.f1 != 1) { ++ fprintf(stderr, "mono_return_int5 s5.f1: got %d but expected %d\n", s5.f1, 1); ++ return 1; ++ } ++ if (s5.f2 != 2) { ++ fprintf(stderr, "mono_return_int5 s5.f2: got %d but expected %d\n", s5.f2, 2); ++ return 1; ++ } ++ if (s5.f3 != 3) { ++ fprintf(stderr, "mono_return_int5 s5.f3: got %d but expected %d\n", s5.f3, 3); ++ return 1; ++ } ++ if (s5.f4 != 4) { ++ fprintf(stderr, "mono_return_int5 s5.f4: got %d but expected %d\n", s5.f4, 4); ++ return 1; ++ } ++ if (s5.f5 != 5) { ++ fprintf(stderr, "mono_return_int5 s5.f5: got %d but expected %d\n", s5.f5, 5); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ float f1; ++} float1; ++ ++LIBTEST_API float STDCALL ++mono_return_float1 (float1 s1, int addend) { ++ if (s1.f1 != 1) { ++ fprintf(stderr, "mono_return_float1 s1.f1: got %f but expected %d\n", s1.f1, 1); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ float f1,f2; ++} float2; ++ ++LIBTEST_API float STDCALL ++mono_return_float2 (float2 s2, int addend) { ++ if (s2.f1 != 1) { ++ fprintf(stderr, "mono_return_float2 s2.f1: got %f but expected %d\n", s2.f1, 1); ++ return 1; ++ } ++ if (s2.f2 != 2) { ++ fprintf(stderr, "mono_return_float2 s2.f2: got %f but expected %d\n", s2.f2, 2); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ float f1,f2,f3; ++} float3; ++ ++LIBTEST_API float STDCALL ++mono_return_float3 (float3 s3, int addend) { ++ if (s3.f1 != 1) { ++ fprintf(stderr, "mono_return_float3 s3.f1: got %f but expected %d\n", s3.f1, 1); ++ return 1; ++ } ++ if (s3.f2 != 2) { ++ fprintf(stderr, "mono_return_float3 s3.f2: got %f but expected %d\n", s3.f2, 2); ++ return 1; ++ } ++ if (s3.f3 != 3) { ++ fprintf(stderr, "mono_return_float3 s3.f3: got %f but expected %d\n", s3.f3, 3); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ float f1,f2,f3,f4; ++} float4; ++ ++LIBTEST_API float STDCALL ++mono_return_float4 (float4 s4, int addend) { ++ if (s4.f1 != 1) { ++ fprintf(stderr, "mono_return_float4 s4.f1: got %f but expected %d\n", s4.f1, 1); ++ return 1; ++ } ++ if (s4.f2 != 2) { ++ fprintf(stderr, "mono_return_float4 s4.f2: got %f but expected %d\n", s4.f2, 2); ++ return 1; ++ } ++ if (s4.f3 != 3) { ++ fprintf(stderr, "mono_return_float4 s4.f3: got %f but expected %d\n", s4.f3, 3); ++ return 1; ++ } ++ if (s4.f4 != 4) { ++ fprintf(stderr, "mono_return_float4 s4.f4: got %f but expected %d\n", s4.f4, 4); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ float f1,f2,f3,f4,f5; ++} float5; ++ ++LIBTEST_API float STDCALL ++mono_return_float5 (float5 s5, int addend) { ++ if (s5.f1 != 1) { ++ fprintf(stderr, "mono_return_float5 s5.f1: got %f but expected %d\n", s5.f1, 1); ++ return 1; ++ } ++ if (s5.f2 != 2) { ++ fprintf(stderr, "mono_return_float5 s5.f2: got %f but expected %d\n", s5.f2, 2); ++ return 1; ++ } ++ if (s5.f3 != 3) { ++ fprintf(stderr, "mono_return_float5 s5.f3: got %f but expected %d\n", s5.f3, 3); ++ return 1; ++ } ++ if (s5.f4 != 4) { ++ fprintf(stderr, "mono_return_float5 s5.f4: got %f but expected %d\n", s5.f4, 4); ++ return 1; ++ } ++ if (s5.f5 != 5) { ++ fprintf(stderr, "mono_return_float5 s5.f5: got %f but expected %d\n", s5.f5, 5); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ float f1,f2,f3,f4,f5,f6; ++} float6; ++ ++LIBTEST_API float STDCALL ++mono_return_float6 (float6 s6, int addend) { ++ if (s6.f1 != 1) { ++ fprintf(stderr, "mono_return_float6 s6.f1: got %f but expected %d\n", s6.f1, 1); ++ return 1; ++ } ++ if (s6.f2 != 2) { ++ fprintf(stderr, "mono_return_float6 s6.f2: got %f but expected %d\n", s6.f2, 2); ++ return 1; ++ } ++ if (s6.f3 != 3) { ++ fprintf(stderr, "mono_return_float6 s6.f3: got %f but expected %d\n", s6.f3, 3); ++ return 1; ++ } ++ if (s6.f4 != 4) { ++ fprintf(stderr, "mono_return_float6 s6.f4: got %f but expected %d\n", s6.f4, 4); ++ return 1; ++ } ++ if (s6.f5 != 5) { ++ fprintf(stderr, "mono_return_float6 s6.f5: got %f but expected %d\n", s6.f5, 5); ++ return 1; ++ } ++ if (s6.f6 != 6) { ++ fprintf(stderr, "mono_return_float6 s6.f6: got %f but expected %d\n", s6.f6, 6); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ float f1,f2,f3,f4,f5,f6,f7; ++} float7; ++ ++LIBTEST_API float STDCALL ++mono_return_float7 (float7 s7, int addend) { ++ if (s7.f1 != 1) { ++ fprintf(stderr, "mono_return_float7 s7.f1: got %f but expected %d\n", s7.f1, 1); ++ return 1; ++ } ++ if (s7.f2 != 2) { ++ fprintf(stderr, "mono_return_float7 s7.f2: got %f but expected %d\n", s7.f2, 2); ++ return 1; ++ } ++ if (s7.f3 != 3) { ++ fprintf(stderr, "mono_return_float7 s7.f3: got %f but expected %d\n", s7.f3, 3); ++ return 1; ++ } ++ if (s7.f4 != 4) { ++ fprintf(stderr, "mono_return_float7 s7.f4: got %f but expected %d\n", s7.f4, 4); ++ return 1; ++ } ++ if (s7.f5 != 5) { ++ fprintf(stderr, "mono_return_float7 s7.f5: got %f but expected %d\n", s7.f5, 5); ++ return 1; ++ } ++ if (s7.f6 != 6) { ++ fprintf(stderr, "mono_return_float7 s7.f6: got %f but expected %d\n", s7.f6, 6); ++ return 1; ++ } ++ if (s7.f7 != 7) { ++ fprintf(stderr, "mono_return_float7 s7.f7: got %f but expected %d\n", s7.f7, 7); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ float f1,f2,f3,f4,f5,f6,f7,f8; ++} float8; ++ ++LIBTEST_API float STDCALL ++mono_return_float8 (float8 s8, int addend) { ++ if (s8.f1 != 1) { ++ fprintf(stderr, "mono_return_float8 s8.f1: got %f but expected %d\n", s8.f1, 1); ++ return 1; ++ } ++ if (s8.f2 != 2) { ++ fprintf(stderr, "mono_return_float8 s8.f2: got %f but expected %d\n", s8.f2, 2); ++ return 1; ++ } ++ if (s8.f3 != 3) { ++ fprintf(stderr, "mono_return_float8 s8.f3: got %f but expected %d\n", s8.f3, 3); ++ return 1; ++ } ++ if (s8.f4 != 4) { ++ fprintf(stderr, "mono_return_float8 s8.f4: got %f but expected %d\n", s8.f4, 4); ++ return 1; ++ } ++ if (s8.f5 != 5) { ++ fprintf(stderr, "mono_return_float8 s8.f5: got %f but expected %d\n", s8.f5, 5); ++ return 1; ++ } ++ if (s8.f6 != 6) { ++ fprintf(stderr, "mono_return_float8 s8.f6: got %f but expected %d\n", s8.f6, 6); ++ return 1; ++ } ++ if (s8.f7 != 7) { ++ fprintf(stderr, "mono_return_float8 s8.f7: got %f but expected %d\n", s8.f7, 7); ++ return 1; ++ } ++ if (s8.f8 != 8) { ++ fprintf(stderr, "mono_return_float8 s8.f8: got %f but expected %d\n", s8.f8, 8); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ float f1,f2,f3,f4,f5,f6,f7,f8,f9; ++} float9; ++ ++LIBTEST_API float STDCALL ++mono_return_float9 (float9 s9, int addend) { ++ if (s9.f1 != 1) { ++ fprintf(stderr, "mono_return_float9 s9.f1: got %f but expected %d\n", s9.f1, 1); ++ return 1; ++ } ++ if (s9.f2 != 2) { ++ fprintf(stderr, "mono_return_float9 s9.f2: got %f but expected %d\n", s9.f2, 2); ++ return 1; ++ } ++ if (s9.f3 != 3) { ++ fprintf(stderr, "mono_return_float9 s9.f3: got %f but expected %d\n", s9.f3, 3); ++ return 1; ++ } ++ if (s9.f4 != 4) { ++ fprintf(stderr, "mono_return_float9 s9.f4: got %f but expected %d\n", s9.f4, 4); ++ return 1; ++ } ++ if (s9.f5 != 5) { ++ fprintf(stderr, "mono_return_float9 s9.f5: got %f but expected %d\n", s9.f5, 5); ++ return 1; ++ } ++ if (s9.f6 != 6) { ++ fprintf(stderr, "mono_return_float9 s9.f6: got %f but expected %d\n", s9.f6, 6); ++ return 1; ++ } ++ if (s9.f7 != 7) { ++ fprintf(stderr, "mono_return_float9 s9.f7: got %f but expected %d\n", s9.f7, 7); ++ return 1; ++ } ++ if (s9.f8 != 8) { ++ fprintf(stderr, "mono_return_float9 s9.f8: got %f but expected %d\n", s9.f8, 8); ++ return 1; ++ } ++ if (s9.f9 != 9) { ++ fprintf(stderr, "mono_return_float9 s9.f9: got %f but expected %d\n", s9.f9, 9); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ double f1; ++} double1; ++ ++LIBTEST_API double STDCALL ++mono_return_double1 (double1 s1, int addend) { ++ if (s1.f1 != 1) { ++ fprintf(stderr, "mono_return_double1 s1.f1: got %f but expected %d\n", s1.f1, 1); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ double f1,f2; ++} double2; ++ ++LIBTEST_API double STDCALL ++mono_return_double2 (double2 s2, int addend) { ++ if (s2.f1 != 1) { ++ fprintf(stderr, "mono_return_double2 s2.f1: got %f but expected %d\n", s2.f1, 1); ++ return 1; ++ } ++ if (s2.f2 != 2) { ++ fprintf(stderr, "mono_return_double2 s2.f2: got %f but expected %d\n", s2.f2, 2); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ double f1,f2,f3; ++} double3; ++ ++LIBTEST_API double STDCALL ++mono_return_double3 (double3 s3, int addend) { ++ if (s3.f1 != 1) { ++ fprintf(stderr, "mono_return_double3 s3.f1: got %f but expected %d\n", s3.f1, 1); ++ return 1; ++ } ++ if (s3.f2 != 2) { ++ fprintf(stderr, "mono_return_double3 s3.f2: got %f but expected %d\n", s3.f2, 2); ++ return 1; ++ } ++ if (s3.f3 != 3) { ++ fprintf(stderr, "mono_return_double3 s3.f3: got %f but expected %d\n", s3.f3, 3); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ double f1,f2,f3,f4; ++} double4; ++ ++LIBTEST_API double STDCALL ++mono_return_double4 (double4 s4, int addend) { ++ if (s4.f1 != 1) { ++ fprintf(stderr, "mono_return_double4 s4.f1: got %f but expected %d\n", s4.f1, 1); ++ return 1; ++ } ++ if (s4.f2 != 2) { ++ fprintf(stderr, "mono_return_double4 s4.f2: got %f but expected %d\n", s4.f2, 2); ++ return 1; ++ } ++ if (s4.f3 != 3) { ++ fprintf(stderr, "mono_return_double4 s4.f3: got %f but expected %d\n", s4.f3, 3); ++ return 1; ++ } ++ if (s4.f4 != 4) { ++ fprintf(stderr, "mono_return_double4 s4.f4: got %f but expected %d\n", s4.f4, 4); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ double f1,f2,f3,f4,f5; ++} double5; ++ ++LIBTEST_API double STDCALL ++mono_return_double5 (double5 s5, int addend) { ++ if (s5.f1 != 1) { ++ fprintf(stderr, "mono_return_double5 s5.f1: got %f but expected %d\n", s5.f1, 1); ++ return 1; ++ } ++ if (s5.f2 != 2) { ++ fprintf(stderr, "mono_return_double5 s5.f2: got %f but expected %d\n", s5.f2, 2); ++ return 1; ++ } ++ if (s5.f3 != 3) { ++ fprintf(stderr, "mono_return_double5 s5.f3: got %f but expected %d\n", s5.f3, 3); ++ return 1; ++ } ++ if (s5.f4 != 4) { ++ fprintf(stderr, "mono_return_double5 s5.f4: got %f but expected %d\n", s5.f4, 4); ++ return 1; ++ } ++ if (s5.f5 != 5) { ++ fprintf(stderr, "mono_return_double5 s5.f5: got %f but expected %d\n", s5.f5, 5); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ double f1,f2,f3,f4,f5,f6; ++} double6; ++ ++LIBTEST_API double STDCALL ++mono_return_double6 (double6 s6, int addend) { ++ if (s6.f1 != 1) { ++ fprintf(stderr, "mono_return_double6 s6.f1: got %f but expected %d\n", s6.f1, 1); ++ return 1; ++ } ++ if (s6.f2 != 2) { ++ fprintf(stderr, "mono_return_double6 s6.f2: got %f but expected %d\n", s6.f2, 2); ++ return 1; ++ } ++ if (s6.f3 != 3) { ++ fprintf(stderr, "mono_return_double6 s6.f3: got %f but expected %d\n", s6.f3, 3); ++ return 1; ++ } ++ if (s6.f4 != 4) { ++ fprintf(stderr, "mono_return_double6 s6.f4: got %f but expected %d\n", s6.f4, 4); ++ return 1; ++ } ++ if (s6.f5 != 5) { ++ fprintf(stderr, "mono_return_double6 s6.f5: got %f but expected %d\n", s6.f5, 5); ++ return 1; ++ } ++ if (s6.f6 != 6) { ++ fprintf(stderr, "mono_return_double6 s6.f6: got %f but expected %d\n", s6.f6, 6); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ double f1,f2,f3,f4,f5,f6,f7; ++} double7; ++ ++LIBTEST_API double STDCALL ++mono_return_double7 (double7 s7, int addend) { ++ if (s7.f1 != 1) { ++ fprintf(stderr, "mono_return_double7 s7.f1: got %f but expected %d\n", s7.f1, 1); ++ return 1; ++ } ++ if (s7.f2 != 2) { ++ fprintf(stderr, "mono_return_double7 s7.f2: got %f but expected %d\n", s7.f2, 2); ++ return 1; ++ } ++ if (s7.f3 != 3) { ++ fprintf(stderr, "mono_return_double7 s7.f3: got %f but expected %d\n", s7.f3, 3); ++ return 1; ++ } ++ if (s7.f4 != 4) { ++ fprintf(stderr, "mono_return_double7 s7.f4: got %f but expected %d\n", s7.f4, 4); ++ return 1; ++ } ++ if (s7.f5 != 5) { ++ fprintf(stderr, "mono_return_double7 s7.f5: got %f but expected %d\n", s7.f5, 5); ++ return 1; ++ } ++ if (s7.f6 != 6) { ++ fprintf(stderr, "mono_return_double7 s7.f6: got %f but expected %d\n", s7.f6, 6); ++ return 1; ++ } ++ if (s7.f7 != 7) { ++ fprintf(stderr, "mono_return_double7 s7.f7: got %f but expected %d\n", s7.f7, 7); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ double f1,f2,f3,f4,f5,f6,f7,f8; ++} double8; ++ ++LIBTEST_API double STDCALL ++mono_return_double8 (double8 s8, int addend) { ++ if (s8.f1 != 1) { ++ fprintf(stderr, "mono_return_double8 s8.f1: got %f but expected %d\n", s8.f1, 1); ++ return 1; ++ } ++ if (s8.f2 != 2) { ++ fprintf(stderr, "mono_return_double8 s8.f2: got %f but expected %d\n", s8.f2, 2); ++ return 1; ++ } ++ if (s8.f3 != 3) { ++ fprintf(stderr, "mono_return_double8 s8.f3: got %f but expected %d\n", s8.f3, 3); ++ return 1; ++ } ++ if (s8.f4 != 4) { ++ fprintf(stderr, "mono_return_double8 s8.f4: got %f but expected %d\n", s8.f4, 4); ++ return 1; ++ } ++ if (s8.f5 != 5) { ++ fprintf(stderr, "mono_return_double8 s8.f5: got %f but expected %d\n", s8.f5, 5); ++ return 1; ++ } ++ if (s8.f6 != 6) { ++ fprintf(stderr, "mono_return_double8 s8.f6: got %f but expected %d\n", s8.f6, 6); ++ return 1; ++ } ++ if (s8.f7 != 7) { ++ fprintf(stderr, "mono_return_double8 s8.f7: got %f but expected %d\n", s8.f7, 7); ++ return 1; ++ } ++ if (s8.f8 != 8) { ++ fprintf(stderr, "mono_return_double8 s8.f8: got %f but expected %d\n", s8.f8, 8); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++typedef struct { ++ double f1,f2,f3,f4,f5,f6,f7,f8,f9; ++} double9; ++ ++LIBTEST_API double STDCALL ++mono_return_double9 (double9 s9, int addend) { ++ if (s9.f1 != 1) { ++ fprintf(stderr, "mono_return_double9 s9.f1: got %f but expected %d\n", s9.f1, 1); ++ return 1; ++ } ++ if (s9.f2 != 2) { ++ fprintf(stderr, "mono_return_double9 s9.f2: got %f but expected %d\n", s9.f2, 2); ++ return 1; ++ } ++ if (s9.f3 != 3) { ++ fprintf(stderr, "mono_return_double9 s9.f3: got %f but expected %d\n", s9.f3, 3); ++ return 1; ++ } ++ if (s9.f4 != 4) { ++ fprintf(stderr, "mono_return_double9 s9.f4: got %f but expected %d\n", s9.f4, 4); ++ return 1; ++ } ++ if (s9.f5 != 5) { ++ fprintf(stderr, "mono_return_double9 s9.f5: got %f but expected %d\n", s9.f5, 5); ++ return 1; ++ } ++ if (s9.f6 != 6) { ++ fprintf(stderr, "mono_return_double9 s9.f6: got %f but expected %d\n", s9.f6, 6); ++ return 1; ++ } ++ if (s9.f7 != 7) { ++ fprintf(stderr, "mono_return_double9 s9.f7: got %f but expected %d\n", s9.f7, 7); ++ return 1; ++ } ++ if (s9.f8 != 8) { ++ fprintf(stderr, "mono_return_double9 s9.f8: got %f but expected %d\n", s9.f8, 8); ++ return 1; ++ } ++ if (s9.f9 != 9) { ++ fprintf(stderr, "mono_return_double9 s9.f9: got %f but expected %d\n", s9.f9, 9); ++ return 1; ++ } ++ return 2*addend; ++} ++ ++ ++ ++// WDS debug ++// To use add: ++// [DllImport ("libtest", EntryPoint="ppc_dbg")] ++// public static extern void ppc_dbg (); ++// Then just call: ++// ppc_dbg(); ++LIBTEST_API void STDCALL ++ppc_dbg(void) ++{ ++ static int cnt=0; ++ ++cnt; ++ printf("@#@#@# ppc_dbg call#%d\n", cnt); ++ return; ++} ++// WDS debug ++ +Index: mono-4.2.1/mono/tests/pinvoke_ppcc.cs +=================================================================== +--- /dev/null ++++ mono-4.2.1/mono/tests/pinvoke_ppcc.cs +@@ -0,0 +1,426 @@ ++// pinvoke_ppcc.cs - Test cases for passing structures to and and returning ++// structures from functions. This particular test is for ++// structures consisting wholy of 1 byte fields. ++// ++// The Power ABI version 2 allows for special parameter ++// passing and returning optimizations for certain ++// structures of homogenous composition (like all ints). ++// This set of tests checks all the possible combinations ++// that use the special parm/return rules and one beyond. ++// ++// Bill Seurer (seurer@linux.vnet.ibm.com) ++// ++// (C) {Copyright holder} ++// ++ ++using System; ++using System.Runtime.InteropServices; ++ ++ ++public class Test_sbyte { ++ ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte1")] ++ public static extern sbyte mono_return_sbyte1 (sbyte1 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte1 { ++ public sbyte f1; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte2")] ++ public static extern sbyte mono_return_sbyte2 (sbyte2 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte2 { ++ public sbyte f1,f2; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte3")] ++ public static extern sbyte mono_return_sbyte3 (sbyte3 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte3 { ++ public sbyte f1,f2,f3; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte4")] ++ public static extern sbyte mono_return_sbyte4 (sbyte4 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte4 { ++ public sbyte f1,f2,f3,f4; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte5")] ++ public static extern sbyte mono_return_sbyte5 (sbyte5 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte5 { ++ public sbyte f1,f2,f3,f4,f5; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte6")] ++ public static extern sbyte mono_return_sbyte6 (sbyte6 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte6 { ++ public sbyte f1,f2,f3,f4,f5,f6; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte7")] ++ public static extern sbyte mono_return_sbyte7 (sbyte7 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte7 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte8")] ++ public static extern sbyte mono_return_sbyte8 (sbyte8 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte8 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7,f8; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte9")] ++ public static extern sbyte mono_return_sbyte9 (sbyte9 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte9 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte10")] ++ public static extern sbyte mono_return_sbyte10 (sbyte10 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte10 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte11")] ++ public static extern sbyte mono_return_sbyte11 (sbyte11 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte11 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte12")] ++ public static extern sbyte mono_return_sbyte12 (sbyte12 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte12 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte13")] ++ public static extern sbyte mono_return_sbyte13 (sbyte13 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte13 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte14")] ++ public static extern sbyte mono_return_sbyte14 (sbyte14 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte14 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte15")] ++ public static extern sbyte mono_return_sbyte15 (sbyte15 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte15 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte16")] ++ public static extern sbyte mono_return_sbyte16 (sbyte16 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte16 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16; ++ } ++ // This structure is 1 element too large to use the special return ++ // rules. ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte17")] ++ public static extern sbyte mono_return_sbyte17 (sbyte17 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte17 { ++ public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17; ++ } ++ ++ // This structure has nested structures within it but they are ++ // homogenous and thus should still use the special rules. ++ public struct sbyte16_nested1 { ++ public sbyte f1; ++ }; ++ public struct sbyte16_nested2 { ++ public sbyte f16; ++ }; ++ [DllImport ("libtest", EntryPoint="mono_return_sbyte16_nested")] ++ public static extern sbyte16_nested mono_return_sbyte16_nested (sbyte16_nested s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct sbyte16_nested { ++ public sbyte16_nested1 nested1; ++ public sbyte f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15; ++ public sbyte16_nested2 nested2; ++ } ++ ++ public static int Main (string[] args) { ++ ++ sbyte1 s1; ++ s1.f1 = 1; ++ sbyte retval1 = mono_return_sbyte1(s1, 9); ++ if (retval1 != 2*9) { ++ Console.WriteLine(" sbyte1 retval1: got {0} but expected {1}", retval1, 2*9); ++ return 1; ++ } ++ ++ sbyte2 s2; ++ s2.f1 = 1; ++ s2.f2 = 2; ++ sbyte retval2 = mono_return_sbyte2(s2, 9); ++ if (retval2 != 2*9) { ++ Console.WriteLine(" sbyte2 retval2: got {0} but expected {1}", retval2, 2*9); ++ return 1; ++ } ++ ++ sbyte3 s3; ++ s3.f1 = 1; ++ s3.f2 = 2; ++ s3.f3 = 3; ++ sbyte retval3 = mono_return_sbyte3(s3, 9); ++ if (retval3 != 2*9) { ++ Console.WriteLine(" sbyte3 retval3: got {0} but expected {1}", retval3, 2*9); ++ return 1; ++ } ++ ++ sbyte4 s4; ++ s4.f1 = 1; ++ s4.f2 = 2; ++ s4.f3 = 3; ++ s4.f4 = 4; ++ sbyte retval4 = mono_return_sbyte4(s4, 9); ++ if (retval4 != 2*9) { ++ Console.WriteLine(" sbyte4 retval4: got {0} but expected {1}", retval4, 2*9); ++ return 1; ++ } ++ ++ sbyte5 s5; ++ s5.f1 = 1; ++ s5.f2 = 2; ++ s5.f3 = 3; ++ s5.f4 = 4; ++ s5.f5 = 5; ++ sbyte retval5 = mono_return_sbyte5(s5, 9); ++ if (retval5 != 2*9) { ++ Console.WriteLine(" sbyte5 retval5: got {0} but expected {1}", retval5, 2*9); ++ return 1; ++ } ++ ++ sbyte6 s6; ++ s6.f1 = 1; ++ s6.f2 = 2; ++ s6.f3 = 3; ++ s6.f4 = 4; ++ s6.f5 = 5; ++ s6.f6 = 6; ++ sbyte retval6 = mono_return_sbyte6(s6, 9); ++ if (retval6 != 2*9) { ++ Console.WriteLine(" sbyte6 retval6: got {0} but expected {1}", retval6, 2*9); ++ return 1; ++ } ++ ++ sbyte7 s7; ++ s7.f1 = 1; ++ s7.f2 = 2; ++ s7.f3 = 3; ++ s7.f4 = 4; ++ s7.f5 = 5; ++ s7.f6 = 6; ++ s7.f7 = 7; ++ sbyte retval7 = mono_return_sbyte7(s7, 9); ++ if (retval7 != 2*9) { ++ Console.WriteLine(" sbyte7 retval7: got {0} but expected {1}", retval7, 2*9); ++ return 1; ++ } ++ ++ sbyte8 s8; ++ s8.f1 = 1; ++ s8.f2 = 2; ++ s8.f3 = 3; ++ s8.f4 = 4; ++ s8.f5 = 5; ++ s8.f6 = 6; ++ s8.f7 = 7; ++ s8.f8 = 8; ++ sbyte retval8 = mono_return_sbyte8(s8, 9); ++ if (retval8 != 2*9) { ++ Console.WriteLine(" sbyte8 retval8: got {0} but expected {1}", retval8, 2*9); ++ return 1; ++ } ++ ++ sbyte9 s9; ++ s9.f1 = 1; ++ s9.f2 = 2; ++ s9.f3 = 3; ++ s9.f4 = 4; ++ s9.f5 = 5; ++ s9.f6 = 6; ++ s9.f7 = 7; ++ s9.f8 = 8; ++ s9.f9 = 9; ++ sbyte retval9 = mono_return_sbyte9(s9, 9); ++ if (retval9 != 2*9) { ++ Console.WriteLine(" sbyte9 retval9: got {0} but expected {1}", retval9, 2*9); ++ return 1; ++ } ++ ++ sbyte10 s10; ++ s10.f1 = 1; ++ s10.f2 = 2; ++ s10.f3 = 3; ++ s10.f4 = 4; ++ s10.f5 = 5; ++ s10.f6 = 6; ++ s10.f7 = 7; ++ s10.f8 = 8; ++ s10.f9 = 9; ++ s10.f10 = 10; ++ sbyte retval10 = mono_return_sbyte10(s10, 9); ++ if (retval10 != 2*9) { ++ Console.WriteLine(" sbyte10 retval10: got {0} but expected {1}", retval10, 2*9); ++ return 1; ++ } ++ ++ sbyte11 s11; ++ s11.f1 = 1; ++ s11.f2 = 2; ++ s11.f3 = 3; ++ s11.f4 = 4; ++ s11.f5 = 5; ++ s11.f6 = 6; ++ s11.f7 = 7; ++ s11.f8 = 8; ++ s11.f9 = 9; ++ s11.f10 = 10; ++ s11.f11 = 11; ++ sbyte retval11 = mono_return_sbyte11(s11, 9); ++ if (retval11 != 2*9) { ++ Console.WriteLine(" sbyte11 retval11: got {0} but expected {1}", retval11, 2*9); ++ return 1; ++ } ++ ++ sbyte12 s12; ++ s12.f1 = 1; ++ s12.f2 = 2; ++ s12.f3 = 3; ++ s12.f4 = 4; ++ s12.f5 = 5; ++ s12.f6 = 6; ++ s12.f7 = 7; ++ s12.f8 = 8; ++ s12.f9 = 9; ++ s12.f10 = 10; ++ s12.f11 = 11; ++ s12.f12 = 12; ++ sbyte retval12 = mono_return_sbyte12(s12, 9); ++ if (retval12 != 2*9) { ++ Console.WriteLine(" sbyte12 retval12: got {0} but expected {1}", retval12, 2*9); ++ return 1; ++ } ++ ++ sbyte13 s13; ++ s13.f1 = 1; ++ s13.f2 = 2; ++ s13.f3 = 3; ++ s13.f4 = 4; ++ s13.f5 = 5; ++ s13.f6 = 6; ++ s13.f7 = 7; ++ s13.f8 = 8; ++ s13.f9 = 9; ++ s13.f10 = 10; ++ s13.f11 = 11; ++ s13.f12 = 12; ++ s13.f13 = 13; ++ sbyte retval13 = mono_return_sbyte13(s13, 9); ++ if (retval13 != 2*9) { ++ Console.WriteLine(" sbyte13 retval13: got {0} but expected {1}", retval13, 2*9); ++ return 1; ++ } ++ ++ sbyte14 s14; ++ s14.f1 = 1; ++ s14.f2 = 2; ++ s14.f3 = 3; ++ s14.f4 = 4; ++ s14.f5 = 5; ++ s14.f6 = 6; ++ s14.f7 = 7; ++ s14.f8 = 8; ++ s14.f9 = 9; ++ s14.f10 = 10; ++ s14.f11 = 11; ++ s14.f12 = 12; ++ s14.f13 = 13; ++ s14.f14 = 14; ++ sbyte retval14 = mono_return_sbyte14(s14, 9); ++ if (retval14 != 2*9) { ++ Console.WriteLine(" sbyte14 retval14: got {0} but expected {1}", retval14, 2*9); ++ return 1; ++ } ++ ++ sbyte15 s15; ++ s15.f1 = 1; ++ s15.f2 = 2; ++ s15.f3 = 3; ++ s15.f4 = 4; ++ s15.f5 = 5; ++ s15.f6 = 6; ++ s15.f7 = 7; ++ s15.f8 = 8; ++ s15.f9 = 9; ++ s15.f10 = 10; ++ s15.f11 = 11; ++ s15.f12 = 12; ++ s15.f13 = 13; ++ s15.f14 = 14; ++ s15.f15 = 15; ++ sbyte retval15 = mono_return_sbyte15(s15, 9); ++ if (retval15 != 2*9) { ++ Console.WriteLine(" sbyte15 retval15: got {0} but expected {1}", retval15, 2*9); ++ return 1; ++ } ++ ++ sbyte16 s16; ++ s16.f1 = 1; ++ s16.f2 = 2; ++ s16.f3 = 3; ++ s16.f4 = 4; ++ s16.f5 = 5; ++ s16.f6 = 6; ++ s16.f7 = 7; ++ s16.f8 = 8; ++ s16.f9 = 9; ++ s16.f10 = 10; ++ s16.f11 = 11; ++ s16.f12 = 12; ++ s16.f13 = 13; ++ s16.f14 = 14; ++ s16.f15 = 15; ++ s16.f16 = 16; ++ sbyte retval16 = mono_return_sbyte16(s16, 9); ++ if (retval16 != 2*9) { ++ Console.WriteLine(" sbyte16 retval16: got {0} but expected {1}", retval16, 2*9); ++ return 1; ++ } ++ ++ sbyte17 s17; ++ s17.f1 = 1; ++ s17.f2 = 2; ++ s17.f3 = 3; ++ s17.f4 = 4; ++ s17.f5 = 5; ++ s17.f6 = 6; ++ s17.f7 = 7; ++ s17.f8 = 8; ++ s17.f9 = 9; ++ s17.f10 = 10; ++ s17.f11 = 11; ++ s17.f12 = 12; ++ s17.f13 = 13; ++ s17.f14 = 14; ++ s17.f15 = 15; ++ s17.f16 = 16; ++ s17.f17 = 17; ++ sbyte retval17 = mono_return_sbyte17(s17, 9); ++ if (retval17 != 2*9) { ++ Console.WriteLine(" sbyte17 retval17: got {0} but expected {1}", retval17, 2*9); ++ return 1; ++ } ++ ++ ++ return 0; ++ } // end Main ++} // end class Test_sbyte ++ ++ ++ ++ ++ +Index: mono-4.2.1/mono/tests/pinvoke_ppcd.cs +=================================================================== +--- /dev/null ++++ mono-4.2.1/mono/tests/pinvoke_ppcd.cs +@@ -0,0 +1,215 @@ ++// pinvoke_ppcd.cs - Test cases for passing structures to and and returning ++// structures from functions. This particular test is for ++// structures consisting wholy of 8 byte fields. ++// ++// The Power ABI version 2 allows for special parameter ++// passing and returning optimizations for certain ++// structures of homogenous composition (like all ints). ++// This set of tests checks all the possible combinations ++// that use the special parm/return rules and one beyond. ++// ++// Bill Seurer (seurer@linux.vnet.ibm.com) ++// ++// (C) {Copyright holder} ++// ++ ++using System; ++using System.Runtime.InteropServices; ++ ++ ++public class Test_double { ++ ++ [DllImport ("libtest", EntryPoint="mono_return_double1")] ++ public static extern double mono_return_double1 (double1 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct double1 { ++ public double f1; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_double2")] ++ public static extern double mono_return_double2 (double2 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct double2 { ++ public double f1,f2; ++ } ++ // This structure is 1 element too large to use the special return ++ // rules. ++ [DllImport ("libtest", EntryPoint="mono_return_double3")] ++ public static extern double mono_return_double3 (double3 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct double3 { ++ public double f1,f2,f3; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_double4")] ++ public static extern double mono_return_double4 (double4 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct double4 { ++ public double f1,f2,f3,f4; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_double5")] ++ public static extern double mono_return_double5 (double5 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct double5 { ++ public double f1,f2,f3,f4,f5; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_double6")] ++ public static extern double mono_return_double6 (double6 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct double6 { ++ public double f1,f2,f3,f4,f5,f6; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_double7")] ++ public static extern double mono_return_double7 (double7 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct double7 { ++ public double f1,f2,f3,f4,f5,f6,f7; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_double8")] ++ public static extern double mono_return_double8 (double8 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct double8 { ++ public double f1,f2,f3,f4,f5,f6,f7,f8; ++ } ++ // This structure is 1 element too large to use the special parameter ++ // passing rules. ++ [DllImport ("libtest", EntryPoint="mono_return_double9")] ++ public static extern double mono_return_double9 (double9 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct double9 { ++ public double f1,f2,f3,f4,f5,f6,f7,f8,f9; ++ } ++ ++ // This structure has nested structures within it but they are ++ // homogenous and thus should still use the special rules. ++ public struct double2_nested1 { ++ public double f1; ++ }; ++ public struct double2_nested2 { ++ public double f2; ++ }; ++ [DllImport ("libtest", EntryPoint="mono_return_double2_nested")] ++ public static extern double2_nested mono_return_double2_nested (double2_nested s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct double2_nested { ++ public double2_nested1 nested1; ++ public double2_nested2 nested2; ++ } ++ ++ public static int Main (string[] args) { ++ ++ double1 s1; ++ s1.f1 = 1; ++ double retval1 = mono_return_double1(s1, 9); ++ if (retval1 != 2*9) { ++ Console.WriteLine(" double1 retval1: got {0} but expected {1}", retval1, 2*9); ++ return 1; ++ } ++ ++ double2 s2; ++ s2.f1 = 1; ++ s2.f2 = 2; ++ double retval2 = mono_return_double2(s2, 9); ++ if (retval2 != 2*9) { ++ Console.WriteLine(" double2 retval2: got {0} but expected {1}", retval2, 2*9); ++ return 1; ++ } ++ ++ double3 s3; ++ s3.f1 = 1; ++ s3.f2 = 2; ++ s3.f3 = 3; ++ double retval3 = mono_return_double3(s3, 9); ++ if (retval3 != 2*9) { ++ Console.WriteLine(" double3 retval3: got {0} but expected {1}", retval3, 2*9); ++ return 1; ++ } ++ ++ double4 s4; ++ s4.f1 = 1; ++ s4.f2 = 2; ++ s4.f3 = 3; ++ s4.f4 = 4; ++ double retval4 = mono_return_double4(s4, 9); ++ if (retval4 != 2*9) { ++ Console.WriteLine(" double4 retval4: got {0} but expected {1}", retval4, 2*9); ++ return 1; ++ } ++ ++ double5 s5; ++ s5.f1 = 1; ++ s5.f2 = 2; ++ s5.f3 = 3; ++ s5.f4 = 4; ++ s5.f5 = 5; ++ double retval5 = mono_return_double5(s5, 9); ++ if (retval5 != 2*9) { ++ Console.WriteLine(" double5 retval5: got {0} but expected {1}", retval5, 2*9); ++ return 1; ++ } ++ ++ double6 s6; ++ s6.f1 = 1; ++ s6.f2 = 2; ++ s6.f3 = 3; ++ s6.f4 = 4; ++ s6.f5 = 5; ++ s6.f6 = 6; ++ double retval6 = mono_return_double6(s6, 9); ++ if (retval6 != 2*9) { ++ Console.WriteLine(" double6 retval6: got {0} but expected {1}", retval6, 2*9); ++ return 1; ++ } ++ ++ double7 s7; ++ s7.f1 = 1; ++ s7.f2 = 2; ++ s7.f3 = 3; ++ s7.f4 = 4; ++ s7.f5 = 5; ++ s7.f6 = 6; ++ s7.f7 = 7; ++ double retval7 = mono_return_double7(s7, 9); ++ if (retval7 != 2*9) { ++ Console.WriteLine(" double7 retval7: got {0} but expected {1}", retval7, 2*9); ++ return 1; ++ } ++ ++ double8 s8; ++ s8.f1 = 1; ++ s8.f2 = 2; ++ s8.f3 = 3; ++ s8.f4 = 4; ++ s8.f5 = 5; ++ s8.f6 = 6; ++ s8.f7 = 7; ++ s8.f8 = 8; ++ double retval8 = mono_return_double8(s8, 9); ++ if (retval8 != 2*9) { ++ Console.WriteLine(" double8 retval8: got {0} but expected {1}", retval8, 2*9); ++ return 1; ++ } ++ ++ double9 s9; ++ s9.f1 = 1; ++ s9.f2 = 2; ++ s9.f3 = 3; ++ s9.f4 = 4; ++ s9.f5 = 5; ++ s9.f6 = 6; ++ s9.f7 = 7; ++ s9.f8 = 8; ++ s9.f9 = 9; ++ double retval9 = mono_return_double9(s9, 9); ++ if (retval9 != 2*9) { ++ Console.WriteLine(" double9 retval9: got {0} but expected {1}", retval9, 2*9); ++ return 1; ++ } ++ ++ ++ return 0; ++ } // end Main ++} // end class Test_double ++ ++ ++ ++ ++ +Index: mono-4.2.1/mono/tests/pinvoke_ppcf.cs +=================================================================== +--- /dev/null ++++ mono-4.2.1/mono/tests/pinvoke_ppcf.cs +@@ -0,0 +1,216 @@ ++// pinvoke_ppcf.cs - Test cases for passing structures to and and returning ++// structures from functions. This particular test is for ++// structures consisting wholy of 4 byte fields. ++// ++// The Power ABI version 2 allows for special parameter ++// passing and returning optimizations for certain ++// structures of homogenous composition (like all ints). ++// This set of tests checks all the possible combinations ++// that use the special parm/return rules and one beyond. ++// ++// Bill Seurer (seurer@linux.vnet.ibm.com) ++// ++// (C) {Copyright holder} ++// ++ ++using System; ++using System.Runtime.InteropServices; ++ ++ ++public class Test_float { ++ ++ [DllImport ("libtest", EntryPoint="mono_return_float1")] ++ public static extern float mono_return_float1 (float1 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct float1 { ++ public float f1; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_float2")] ++ public static extern float mono_return_float2 (float2 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct float2 { ++ public float f1,f2; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_float3")] ++ public static extern float mono_return_float3 (float3 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct float3 { ++ public float f1,f2,f3; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_float4")] ++ public static extern float mono_return_float4 (float4 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct float4 { ++ public float f1,f2,f3,f4; ++ } ++ // This structure is 1 element too large to use the special return ++ // rules. ++ [DllImport ("libtest", EntryPoint="mono_return_float5")] ++ public static extern float mono_return_float5 (float5 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct float5 { ++ public float f1,f2,f3,f4,f5; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_float6")] ++ public static extern float mono_return_float6 (float6 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct float6 { ++ public float f1,f2,f3,f4,f5,f6; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_float7")] ++ public static extern float mono_return_float7 (float7 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct float7 { ++ public float f1,f2,f3,f4,f5,f6,f7; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_float8")] ++ public static extern float mono_return_float8 (float8 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct float8 { ++ public float f1,f2,f3,f4,f5,f6,f7,f8; ++ } ++ // This structure is 1 element too large to use the special parameter ++ // passing rules. ++ [DllImport ("libtest", EntryPoint="mono_return_float9")] ++ public static extern float mono_return_float9 (float9 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct float9 { ++ public float f1,f2,f3,f4,f5,f6,f7,f8,f9; ++ } ++ ++ // This structure has nested structures within it but they are ++ // homogenous and thus should still use the special rules. ++ public struct float4_nested1 { ++ public float f1; ++ }; ++ public struct float4_nested2 { ++ public float f4; ++ }; ++ [DllImport ("libtest", EntryPoint="mono_return_float4_nested")] ++ public static extern float4_nested mono_return_float4_nested (float4_nested s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct float4_nested { ++ public float4_nested1 nested1; ++ public float f2,f3; ++ public float4_nested2 nested2; ++ } ++ ++ public static int Main (string[] args) { ++ ++ float1 s1; ++ s1.f1 = 1; ++ float retval1 = mono_return_float1(s1, 906); ++ if (retval1 != 2*906) { ++ Console.WriteLine(" float1 retval1: got {0} but expected {1}", retval1, 2*906); ++ return 1; ++ } ++ ++ float2 s2; ++ s2.f1 = 1; ++ s2.f2 = 2; ++ float retval2 = mono_return_float2(s2, 906); ++ if (retval2 != 2*906) { ++ Console.WriteLine(" float2 retval2: got {0} but expected {1}", retval2, 2*906); ++ return 1; ++ } ++ ++ float3 s3; ++ s3.f1 = 1; ++ s3.f2 = 2; ++ s3.f3 = 3; ++ float retval3 = mono_return_float3(s3, 906); ++ if (retval3 != 2*906) { ++ Console.WriteLine(" float3 retval3: got {0} but expected {1}", retval3, 2*906); ++ return 1; ++ } ++ ++ float4 s4; ++ s4.f1 = 1; ++ s4.f2 = 2; ++ s4.f3 = 3; ++ s4.f4 = 4; ++ float retval4 = mono_return_float4(s4, 906); ++ if (retval4 != 2*906) { ++ Console.WriteLine(" float4 retval4: got {0} but expected {1}", retval4, 2*906); ++ return 1; ++ } ++ ++ float5 s5; ++ s5.f1 = 1; ++ s5.f2 = 2; ++ s5.f3 = 3; ++ s5.f4 = 4; ++ s5.f5 = 5; ++ float retval5 = mono_return_float5(s5, 906); ++ if (retval5 != 2*906) { ++ Console.WriteLine(" float5 retval5: got {0} but expected {1}", retval5, 2*906); ++ return 1; ++ } ++ ++ float6 s6; ++ s6.f1 = 1; ++ s6.f2 = 2; ++ s6.f3 = 3; ++ s6.f4 = 4; ++ s6.f5 = 5; ++ s6.f6 = 6; ++ float retval6 = mono_return_float6(s6, 906); ++ if (retval6 != 2*906) { ++ Console.WriteLine(" float6 retval6: got {0} but expected {1}", retval6, 2*906); ++ return 1; ++ } ++ ++ float7 s7; ++ s7.f1 = 1; ++ s7.f2 = 2; ++ s7.f3 = 3; ++ s7.f4 = 4; ++ s7.f5 = 5; ++ s7.f6 = 6; ++ s7.f7 = 7; ++ float retval7 = mono_return_float7(s7, 906); ++ if (retval7 != 2*906) { ++ Console.WriteLine(" float7 retval7: got {0} but expected {1}", retval7, 2*906); ++ return 1; ++ } ++ ++ float8 s8; ++ s8.f1 = 1; ++ s8.f2 = 2; ++ s8.f3 = 3; ++ s8.f4 = 4; ++ s8.f5 = 5; ++ s8.f6 = 6; ++ s8.f7 = 7; ++ s8.f8 = 8; ++ float retval8 = mono_return_float8(s8, 906); ++ if (retval8 != 2*906) { ++ Console.WriteLine(" float8 retval8: got {0} but expected {1}", retval8, 2*906); ++ return 1; ++ } ++ ++ float9 s9; ++ s9.f1 = 1; ++ s9.f2 = 2; ++ s9.f3 = 3; ++ s9.f4 = 4; ++ s9.f5 = 5; ++ s9.f6 = 6; ++ s9.f7 = 7; ++ s9.f8 = 8; ++ s9.f9 = 9; ++ float retval9 = mono_return_float9(s9, 906); ++ if (retval9 != 2*906) { ++ Console.WriteLine(" float9 retval9: got {0} but expected {1}", retval9, 2*906); ++ return 1; ++ } ++ ++ ++ return 0; ++ } // end Main ++} // end class Test_float ++ ++ ++ ++ ++ +Index: mono-4.2.1/mono/tests/pinvoke_ppci.cs +=================================================================== +--- /dev/null ++++ mono-4.2.1/mono/tests/pinvoke_ppci.cs +@@ -0,0 +1,132 @@ ++// pinvoke_ppci.cs - Test cases for passing structures to and and returning ++// structures from functions. This particular test is for ++// structures consisting wholy of 4 byte fields. ++// ++// The Power ABI version 2 allows for special parameter ++// passing and returning optimizations for certain ++// structures of homogenous composition (like all ints). ++// This set of tests checks all the possible combinations ++// that use the special parm/return rules and one beyond. ++// ++// Bill Seurer (seurer@linux.vnet.ibm.com) ++// ++// (C) {Copyright holder} ++// ++ ++using System; ++using System.Runtime.InteropServices; ++ ++ ++public class Test_int { ++ ++ [DllImport ("libtest", EntryPoint="mono_return_int1")] ++ public static extern int mono_return_int1 (int1 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct int1 { ++ public int f1; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_int2")] ++ public static extern int mono_return_int2 (int2 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct int2 { ++ public int f1,f2; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_int3")] ++ public static extern int mono_return_int3 (int3 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct int3 { ++ public int f1,f2,f3; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_int4")] ++ public static extern int mono_return_int4 (int4 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct int4 { ++ public int f1,f2,f3,f4; ++ } ++ // This structure is 1 element too large to use the special return ++ // rules. ++ [DllImport ("libtest", EntryPoint="mono_return_int5")] ++ public static extern int mono_return_int5 (int5 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct int5 { ++ public int f1,f2,f3,f4,f5; ++ } ++ ++ // This structure has nested structures within it but they are ++ // homogenous and thus should still use the special rules. ++ public struct int4_nested1 { ++ public int f1; ++ }; ++ public struct int4_nested2 { ++ public int f4; ++ }; ++ [DllImport ("libtest", EntryPoint="mono_return_int4_nested")] ++ public static extern int4_nested mono_return_int4_nested (int4_nested s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct int4_nested { ++ public int4_nested1 nested1; ++ public int f2,f3; ++ public int4_nested2 nested2; ++ } ++ ++ public static int Main (string[] args) { ++ ++ int1 s1; ++ s1.f1 = 1; ++ int retval1 = mono_return_int1(s1, 906); ++ if (retval1 != 2*906) { ++ Console.WriteLine(" int1 retval1: got {0} but expected {1}", retval1, 2*906); ++ return 1; ++ } ++ ++ int2 s2; ++ s2.f1 = 1; ++ s2.f2 = 2; ++ int retval2 = mono_return_int2(s2, 906); ++ if (retval2 != 2*906) { ++ Console.WriteLine(" int2 retval2: got {0} but expected {1}", retval2, 2*906); ++ return 1; ++ } ++ ++ int3 s3; ++ s3.f1 = 1; ++ s3.f2 = 2; ++ s3.f3 = 3; ++ int retval3 = mono_return_int3(s3, 906); ++ if (retval3 != 2*906) { ++ Console.WriteLine(" int3 retval3: got {0} but expected {1}", retval3, 2*906); ++ return 1; ++ } ++ ++ int4 s4; ++ s4.f1 = 1; ++ s4.f2 = 2; ++ s4.f3 = 3; ++ s4.f4 = 4; ++ int retval4 = mono_return_int4(s4, 906); ++ if (retval4 != 2*906) { ++ Console.WriteLine(" int4 retval4: got {0} but expected {1}", retval4, 2*906); ++ return 1; ++ } ++ ++ int5 s5; ++ s5.f1 = 1; ++ s5.f2 = 2; ++ s5.f3 = 3; ++ s5.f4 = 4; ++ s5.f5 = 5; ++ int retval5 = mono_return_int5(s5, 906); ++ if (retval5 != 2*906) { ++ Console.WriteLine(" int5 retval5: got {0} but expected {1}", retval5, 2*906); ++ return 1; ++ } ++ ++ ++ return 0; ++ } // end Main ++} // end class Test_int ++ ++ ++ ++ ++ +Index: mono-4.2.1/mono/tests/pinvoke_ppcs.cs +=================================================================== +--- /dev/null ++++ mono-4.2.1/mono/tests/pinvoke_ppcs.cs +@@ -0,0 +1,214 @@ ++// pinvoke_ppcs.cs - Test cases for passing structures to and and returning ++// structures from functions. This particular test is for ++// structures consisting wholy of 2 byte fields. ++// ++// The Power ABI version 2 allows for special parameter ++// passing and returning optimizations for certain ++// structures of homogenous composition (like all ints). ++// This set of tests checks all the possible combinations ++// that use the special parm/return rules and one beyond. ++// ++// Bill Seurer (seurer@linux.vnet.ibm.com) ++// ++// (C) {Copyright holder} ++// ++ ++using System; ++using System.Runtime.InteropServices; ++ ++ ++public class Test_short { ++ ++ [DllImport ("libtest", EntryPoint="mono_return_short1")] ++ public static extern short mono_return_short1 (short1 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct short1 { ++ public short f1; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_short2")] ++ public static extern short mono_return_short2 (short2 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct short2 { ++ public short f1,f2; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_short3")] ++ public static extern short mono_return_short3 (short3 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct short3 { ++ public short f1,f2,f3; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_short4")] ++ public static extern short mono_return_short4 (short4 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct short4 { ++ public short f1,f2,f3,f4; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_short5")] ++ public static extern short mono_return_short5 (short5 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct short5 { ++ public short f1,f2,f3,f4,f5; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_short6")] ++ public static extern short mono_return_short6 (short6 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct short6 { ++ public short f1,f2,f3,f4,f5,f6; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_short7")] ++ public static extern short mono_return_short7 (short7 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct short7 { ++ public short f1,f2,f3,f4,f5,f6,f7; ++ } ++ [DllImport ("libtest", EntryPoint="mono_return_short8")] ++ public static extern short mono_return_short8 (short8 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct short8 { ++ public short f1,f2,f3,f4,f5,f6,f7,f8; ++ } ++ // This structure is 1 element too large to use the special return ++ // rules. ++ [DllImport ("libtest", EntryPoint="mono_return_short9")] ++ public static extern short mono_return_short9 (short9 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct short9 { ++ public short f1,f2,f3,f4,f5,f6,f7,f8,f9; ++ } ++ ++ // This structure has nested structures within it but they are ++ // homogenous and thus should still use the special rules. ++ public struct short8_nested1 { ++ public short f1; ++ }; ++ public struct short8_nested2 { ++ public short f8; ++ }; ++ [DllImport ("libtest", EntryPoint="mono_return_short8_nested")] ++ public static extern short8_nested mono_return_short8_nested (short8_nested s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public struct short8_nested { ++ public short8_nested1 nested1; ++ public short f2,f3,f4,f5,f6,f7; ++ public short8_nested2 nested2; ++ } ++ ++ public static int Main (string[] args) { ++ ++ short1 s1; ++ s1.f1 = 1; ++ short retval1 = mono_return_short1(s1, 90); ++ if (retval1 != 2*90) { ++ Console.WriteLine(" short1 retval1: got {0} but expected {1}", retval1, 2*90); ++ return 1; ++ } ++ ++ short2 s2; ++ s2.f1 = 1; ++ s2.f2 = 2; ++ short retval2 = mono_return_short2(s2, 90); ++ if (retval2 != 2*90) { ++ Console.WriteLine(" short2 retval2: got {0} but expected {1}", retval2, 2*90); ++ return 1; ++ } ++ ++ short3 s3; ++ s3.f1 = 1; ++ s3.f2 = 2; ++ s3.f3 = 3; ++ short retval3 = mono_return_short3(s3, 90); ++ if (retval3 != 2*90) { ++ Console.WriteLine(" short3 retval3: got {0} but expected {1}", retval3, 2*90); ++ return 1; ++ } ++ ++ short4 s4; ++ s4.f1 = 1; ++ s4.f2 = 2; ++ s4.f3 = 3; ++ s4.f4 = 4; ++ short retval4 = mono_return_short4(s4, 90); ++ if (retval4 != 2*90) { ++ Console.WriteLine(" short4 retval4: got {0} but expected {1}", retval4, 2*90); ++ return 1; ++ } ++ ++ short5 s5; ++ s5.f1 = 1; ++ s5.f2 = 2; ++ s5.f3 = 3; ++ s5.f4 = 4; ++ s5.f5 = 5; ++ short retval5 = mono_return_short5(s5, 90); ++ if (retval5 != 2*90) { ++ Console.WriteLine(" short5 retval5: got {0} but expected {1}", retval5, 2*90); ++ return 1; ++ } ++ ++ short6 s6; ++ s6.f1 = 1; ++ s6.f2 = 2; ++ s6.f3 = 3; ++ s6.f4 = 4; ++ s6.f5 = 5; ++ s6.f6 = 6; ++ short retval6 = mono_return_short6(s6, 90); ++ if (retval6 != 2*90) { ++ Console.WriteLine(" short6 retval6: got {0} but expected {1}", retval6, 2*90); ++ return 1; ++ } ++ ++ short7 s7; ++ s7.f1 = 1; ++ s7.f2 = 2; ++ s7.f3 = 3; ++ s7.f4 = 4; ++ s7.f5 = 5; ++ s7.f6 = 6; ++ s7.f7 = 7; ++ short retval7 = mono_return_short7(s7, 90); ++ if (retval7 != 2*90) { ++ Console.WriteLine(" short7 retval7: got {0} but expected {1}", retval7, 2*90); ++ return 1; ++ } ++ ++ short8 s8; ++ s8.f1 = 1; ++ s8.f2 = 2; ++ s8.f3 = 3; ++ s8.f4 = 4; ++ s8.f5 = 5; ++ s8.f6 = 6; ++ s8.f7 = 7; ++ s8.f8 = 8; ++ short retval8 = mono_return_short8(s8, 90); ++ if (retval8 != 2*90) { ++ Console.WriteLine(" short8 retval8: got {0} but expected {1}", retval8, 2*90); ++ return 1; ++ } ++ ++ short9 s9; ++ s9.f1 = 1; ++ s9.f2 = 2; ++ s9.f3 = 3; ++ s9.f4 = 4; ++ s9.f5 = 5; ++ s9.f6 = 6; ++ s9.f7 = 7; ++ s9.f8 = 8; ++ s9.f9 = 9; ++ short retval9 = mono_return_short9(s9, 90); ++ if (retval9 != 2*90) { ++ Console.WriteLine(" short9 retval9: got {0} but expected {1}", retval9, 2*90); ++ return 1; ++ } ++ ++ ++ return 0; ++ } // end Main ++} // end class Test_short ++ ++ ++ ++ ++ diff --git a/mono-core.changes b/mono-core.changes index 40aed35..5b6d7e8 100644 --- a/mono-core.changes +++ b/mono-core.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Fri Dec 11 08:32:06 UTC 2015 - normand@linux.vnet.ibm.com + +- retrieve from upstream all ppc patches not yet in 4.2.1 tarball + ppc_instruction_length_of_atomic_add_i4_is_28.patch + fix_atomic_add_i4_support_for_32bit_ppc.patch + basic_changes_powerpc_be.patch (already done yesterday) + ppc_add_monocontext_and_async_callback.patch + fix_passing_struct_parms_per_elf_abiv2.patch + update_elf_abiv2_testcases.patch + partial_sharing_false_4_powerpc.patch + fix_exception_when_reading_from_timezone_file.patch + ------------------------------------------------------------------- Thu Dec 10 15:08:07 UTC 2015 - normand@linux.vnet.ibm.com diff --git a/mono-core.spec b/mono-core.spec index 406dfd2..664d93c 100644 --- a/mono-core.spec +++ b/mono-core.spec @@ -39,7 +39,17 @@ Patch2: authors.patch # PATCH-FIX-OPENSUSE fix insecure use of strncat at process.c:383 to fix build process Patch3: strncat-process-c.patch Patch4: mono-un-revoke-fix-in-BNC-144655.patch -Patch5: basic_changes_powerpc_be.patch +################## +## set of ppc patches from git upstream not yet in tarball 4.2.1 +Patch5: ppc_instruction_length_of_atomic_add_i4_is_28.patch +Patch6: fix_atomic_add_i4_support_for_32bit_ppc.patch +Patch7: basic_changes_powerpc_be.patch +Patch8: ppc_add_monocontext_and_async_callback.patch +Patch9: fix_passing_struct_parms_per_elf_abiv2.patch +Patch10: update_elf_abiv2_testcases.patch +Patch11: partial_sharing_false_4_powerpc.patch +Patch12: fix_exception_when_reading_from_timezone_file.patch +################## BuildRequires: autoconf BuildRequires: automake BuildRequires: bison @@ -117,6 +127,13 @@ technologies that have been submitted to the ECMA for standardization. %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 %build NOCONFIGURE="yes" ./autogen.sh diff --git a/partial_sharing_false_4_powerpc.patch b/partial_sharing_false_4_powerpc.patch new file mode 100644 index 0000000..1c56eec --- /dev/null +++ b/partial_sharing_false_4_powerpc.patch @@ -0,0 +1,24 @@ +From 35b511524a4d15b75cfbba982d82b7abef3a29dc Mon Sep 17 00:00:00 2001 +From: Bill Seurer +Date: Tue, 8 Dec 2015 12:52:01 -0600 +Subject: [PATCH] [ppc] Temporary fix for power to get builds working. + + +--- + mono/mini/mini-ppc.c | 3 +++ + 1 file changed, 3 insertions(+) + +Index: mono-4.2.1/mono/mini/mini-ppc.c +=================================================================== +--- mono-4.2.1.orig/mono/mini/mini-ppc.c ++++ mono-4.2.1/mono/mini/mini-ppc.c +@@ -627,6 +627,9 @@ mono_arch_init (void) + mono_mprotect (bp_trigger_page, mono_pagesize (), 0); + + mono_aot_register_jit_icall ("mono_ppc_throw_exception", mono_ppc_throw_exception); ++ ++ // FIXME: Fix partial sharing for power and remove this ++ mono_set_partial_sharing_supported (FALSE); + } + + /* diff --git a/ppc_add_monocontext_and_async_callback.patch b/ppc_add_monocontext_and_async_callback.patch new file mode 100644 index 0000000..9379f85 --- /dev/null +++ b/ppc_add_monocontext_and_async_callback.patch @@ -0,0 +1,168 @@ +From f05362d9a16317c65cf46506b7557dfb0176a678 Mon Sep 17 00:00:00 2001 +From: Bill Seurer +Date: Mon, 24 Aug 2015 17:10:36 -0500 +Subject: [PATCH] [ppc] Add MonoContext and asynch callback support + + +--- + mono/mini/exceptions-ppc.c | 13 ++++++ + mono/mini/mini-ppc.h | 11 ++++- + mono/utils/mono-context.h | 95 +++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 117 insertions(+), 2 deletions(-) + +Index: mono-4.2.1/mono/mini/exceptions-ppc.c +=================================================================== +--- mono-4.2.1.orig/mono/mini/exceptions-ppc.c ++++ mono-4.2.1/mono/mini/exceptions-ppc.c +@@ -783,3 +783,16 @@ mono_arch_handle_exception (void *ctx, g + return result; + #endif + } ++ ++ ++// FIX ME: This is not complete ++void ++mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data) ++{ ++ uintptr_t sp = (uintptr_t) MONO_CONTEXT_GET_SP(ctx); ++ sp -= PPC_MINIMAL_STACK_SIZE; ++ *(unsigned long *)sp = MONO_CONTEXT_GET_SP(ctx); ++ MONO_CONTEXT_SET_BP(ctx, sp); ++ MONO_CONTEXT_SET_IP(ctx, (unsigned long) async_cb); ++} ++ +Index: mono-4.2.1/mono/mini/mini-ppc.h +=================================================================== +--- mono-4.2.1.orig/mono/mini/mini-ppc.h ++++ mono-4.2.1/mono/mini/mini-ppc.h +@@ -139,8 +139,15 @@ typedef struct MonoCompileArch { + /* Linux */ + #ifdef __mono_ppc64__ + #define PPC_RET_ADDR_OFFSET 16 +-#define PPC_STACK_PARAM_OFFSET 48 +-#define PPC_MINIMAL_STACK_SIZE 48 ++ // Power LE abvi2 ++ #if (_CALL_ELF == 2) ++ #define PPC_STACK_PARAM_OFFSET 32 ++ #define PPC_MINIMAL_STACK_SIZE 32 ++ #else ++ #define PPC_STACK_PARAM_OFFSET 48 ++ #define PPC_MINIMAL_STACK_SIZE 48 ++ #endif ++#define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1 + #define PPC_MINIMAL_PARAM_AREA_SIZE 64 + #define PPC_LAST_FPARG_REG ppc_f13 + #define PPC_PASS_STRUCTS_BY_VALUE 1 +Index: mono-4.2.1/mono/utils/mono-context.h +=================================================================== +--- mono-4.2.1.orig/mono/utils/mono-context.h ++++ mono-4.2.1/mono/utils/mono-context.h +@@ -359,6 +359,100 @@ typedef struct { + * We might also want to add an additional field to propagate + * the original context from the signal handler. + */ ++#ifdef __mono_ppc64__ ++ ++typedef struct { ++ gulong sc_ir; // pc ++ gulong sc_sp; // r1 ++ mgreg_t regs [32]; ++ double fregs [32]; ++} MonoContext; ++ ++/* we have the stack pointer, not the base pointer in sigcontext */ ++#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_ir = (gulong)ip; } while (0); ++#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_sp = (gulong)bp; } while (0); ++#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->sc_sp = (gulong)sp; } while (0); ++ ++#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->sc_ir)) ++#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ppc_r31-13])) ++#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sc_sp)) ++ ++#define MONO_CONTEXT_GET_CURRENT(ctx) \ ++ __asm__ __volatile__( \ ++ "std 0, 0(%0)\n" \ ++ "std 1, 8(%0)\n" \ ++ "std 0, 8*0+16(%0)\n" \ ++ "std 1, 8*1+16(%0)\n" \ ++ "std 2, 8*2+16(%0)\n" \ ++ "std 3, 8*3+16(%0)\n" \ ++ "std 4, 8*4+16(%0)\n" \ ++ "std 5, 8*5+16(%0)\n" \ ++ "std 6, 8*6+16(%0)\n" \ ++ "std 7, 8*7+16(%0)\n" \ ++ "std 8, 8*8+16(%0)\n" \ ++ "std 9, 8*9+16(%0)\n" \ ++ "std 10, 8*10+16(%0)\n" \ ++ "std 11, 8*11+16(%0)\n" \ ++ "std 12, 8*12+16(%0)\n" \ ++ "std 13, 8*13+16(%0)\n" \ ++ "std 14, 8*14+16(%0)\n" \ ++ "std 15, 8*15+16(%0)\n" \ ++ "std 16, 8*16+16(%0)\n" \ ++ "std 17, 8*17+16(%0)\n" \ ++ "std 18, 8*18+16(%0)\n" \ ++ "std 19, 8*19+16(%0)\n" \ ++ "std 20, 8*20+16(%0)\n" \ ++ "std 21, 8*21+16(%0)\n" \ ++ "std 22, 8*22+16(%0)\n" \ ++ "std 23, 8*23+16(%0)\n" \ ++ "std 24, 8*24+16(%0)\n" \ ++ "std 25, 8*25+16(%0)\n" \ ++ "std 26, 8*26+16(%0)\n" \ ++ "std 27, 8*27+16(%0)\n" \ ++ "std 28, 8*28+16(%0)\n" \ ++ "std 29, 8*29+16(%0)\n" \ ++ "std 30, 8*30+16(%0)\n" \ ++ "std 31, 8*31+16(%0)\n" \ ++ "stfd 0, 8*0+8*32+16(%0)\n" \ ++ "stfd 1, 8*1+8*32+16(%0)\n" \ ++ "stfd 2, 8*2+8*32+16(%0)\n" \ ++ "stfd 3, 8*3+8*32+16(%0)\n" \ ++ "stfd 4, 8*4+8*32+16(%0)\n" \ ++ "stfd 5, 8*5+8*32+16(%0)\n" \ ++ "stfd 6, 8*6+8*32+16(%0)\n" \ ++ "stfd 7, 8*7+8*32+16(%0)\n" \ ++ "stfd 8, 8*8+8*32+16(%0)\n" \ ++ "stfd 9, 8*9+8*32+16(%0)\n" \ ++ "stfd 10, 8*10+8*32+16(%0)\n" \ ++ "stfd 11, 8*11+8*32+16(%0)\n" \ ++ "stfd 12, 8*12+8*32+16(%0)\n" \ ++ "stfd 13, 8*13+8*32+16(%0)\n" \ ++ "stfd 14, 8*14+8*32+16(%0)\n" \ ++ "stfd 15, 8*15+8*32+16(%0)\n" \ ++ "stfd 16, 8*16+8*32+16(%0)\n" \ ++ "stfd 17, 8*17+8*32+16(%0)\n" \ ++ "stfd 18, 8*18+8*32+16(%0)\n" \ ++ "stfd 19, 8*19+8*32+16(%0)\n" \ ++ "stfd 20, 8*20+8*32+16(%0)\n" \ ++ "stfd 21, 8*21+8*32+16(%0)\n" \ ++ "stfd 22, 8*22+8*32+16(%0)\n" \ ++ "stfd 23, 8*23+8*32+16(%0)\n" \ ++ "stfd 24, 8*24+8*32+16(%0)\n" \ ++ "stfd 25, 8*25+8*32+16(%0)\n" \ ++ "stfd 26, 8*26+8*32+16(%0)\n" \ ++ "stfd 27, 8*27+8*32+16(%0)\n" \ ++ "stfd 28, 8*28+8*32+16(%0)\n" \ ++ "stfd 29, 8*29+8*32+16(%0)\n" \ ++ "stfd 30, 8*30+8*32+16(%0)\n" \ ++ "stfd 31, 8*31+8*32+16(%0)\n" \ ++ : : "r" (&(ctx)) \ ++ : "memory" \ ++ ) ++ ++#define MONO_ARCH_HAS_MONO_CONTEXT 1 ++ ++#else ++ + typedef struct { + gulong sc_ir; // pc + gulong sc_sp; // r1 +@@ -375,6 +469,7 @@ typedef struct { + #define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->sc_ir)) + #define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ppc_r31-13])) + #define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sc_sp)) ++#endif + + #elif defined(__sparc__) || defined(sparc) /* defined(__mono_ppc__) */ + diff --git a/ppc_instruction_length_of_atomic_add_i4_is_28.patch b/ppc_instruction_length_of_atomic_add_i4_is_28.patch new file mode 100644 index 0000000..3dfb04f --- /dev/null +++ b/ppc_instruction_length_of_atomic_add_i4_is_28.patch @@ -0,0 +1,21 @@ +From f967c79926900343f399c75624deedaba460e544 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= +Date: Mon, 3 Aug 2015 17:32:07 +0200 +Subject: [PATCH] [ppc] Instruction length of atomic_add_i4 is 28. + + +--- + mono/mini/cpu-ppc.md | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: mono-4.2.1/mono/mini/cpu-ppc.md +=================================================================== +--- mono-4.2.1.orig/mono/mini/cpu-ppc.md ++++ mono-4.2.1/mono/mini/cpu-ppc.md +@@ -314,5 +314,5 @@ vcall2_membase: src1:b len:16 clob:c + + jump_table: dest:i len:8 + +-atomic_add_i4: src1:b src2:i dest:i len:20 ++atomic_add_i4: src1:b src2:i dest:i len:28 + atomic_cas_i4: src1:b src2:i src3:i dest:i len:38 diff --git a/update_elf_abiv2_testcases.patch b/update_elf_abiv2_testcases.patch new file mode 100644 index 0000000..5f28f51 --- /dev/null +++ b/update_elf_abiv2_testcases.patch @@ -0,0 +1,4409 @@ +From 5013b989ed16303bc808a3d6570cddb4dfd8011d Mon Sep 17 00:00:00 2001 +From: Bill Seurer +Date: Wed, 23 Sep 2015 15:44:24 -0500 +Subject: [PATCH] [ppc] Updated ELF ABI v2 test cases to include returning + structures from functions + + +--- + mono/tests/libtest.c | 765 ++++++++++++++++++++------------------------ + mono/tests/pinvoke_ppcc.cs | 768 ++++++++++++++++++++++++++++++++++++++++----- + mono/tests/pinvoke_ppcd.cs | 269 +++++++++++++-- + mono/tests/pinvoke_ppcf.cs | 243 +++++++++++--- + mono/tests/pinvoke_ppci.cs | 107 ++++-- + mono/tests/pinvoke_ppcs.cs | 263 +++++++++++++-- + 6 files changed, 1783 insertions(+), 632 deletions(-) + +Index: mono-4.2.1/mono/tests/libtest.c +=================================================================== +--- mono-4.2.1.orig/mono/tests/libtest.c ++++ mono-4.2.1/mono/tests/libtest.c +@@ -5450,1670 +5450,1605 @@ typedef struct { + char f1; + } sbyte1; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte1 STDCALL + mono_return_sbyte1 (sbyte1 s1, int addend) { + if (s1.f1 != 1) { + fprintf(stderr, "mono_return_sbyte1 s1.f1: got %d but expected %d\n", s1.f1, 1); +- return 1; + } +- return 2*addend; ++ s1.f1+=addend; ++ return s1; + } + + typedef struct { + char f1,f2; + } sbyte2; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte2 STDCALL + mono_return_sbyte2 (sbyte2 s2, int addend) { + if (s2.f1 != 1) { + fprintf(stderr, "mono_return_sbyte2 s2.f1: got %d but expected %d\n", s2.f1, 1); +- return 1; + } + if (s2.f2 != 2) { + fprintf(stderr, "mono_return_sbyte2 s2.f2: got %d but expected %d\n", s2.f2, 2); +- return 1; + } +- return 2*addend; ++ s2.f1+=addend; s2.f2+=addend; ++ return s2; + } + + typedef struct { + char f1,f2,f3; + } sbyte3; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte3 STDCALL + mono_return_sbyte3 (sbyte3 s3, int addend) { + if (s3.f1 != 1) { + fprintf(stderr, "mono_return_sbyte3 s3.f1: got %d but expected %d\n", s3.f1, 1); +- return 1; + } + if (s3.f2 != 2) { + fprintf(stderr, "mono_return_sbyte3 s3.f2: got %d but expected %d\n", s3.f2, 2); +- return 1; + } + if (s3.f3 != 3) { + fprintf(stderr, "mono_return_sbyte3 s3.f3: got %d but expected %d\n", s3.f3, 3); +- return 1; + } +- return 2*addend; ++ s3.f1+=addend; s3.f2+=addend; s3.f3+=addend; ++ return s3; + } + + typedef struct { + char f1,f2,f3,f4; + } sbyte4; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte4 STDCALL + mono_return_sbyte4 (sbyte4 s4, int addend) { + if (s4.f1 != 1) { + fprintf(stderr, "mono_return_sbyte4 s4.f1: got %d but expected %d\n", s4.f1, 1); +- return 1; + } + if (s4.f2 != 2) { + fprintf(stderr, "mono_return_sbyte4 s4.f2: got %d but expected %d\n", s4.f2, 2); +- return 1; + } + if (s4.f3 != 3) { + fprintf(stderr, "mono_return_sbyte4 s4.f3: got %d but expected %d\n", s4.f3, 3); +- return 1; + } + if (s4.f4 != 4) { + fprintf(stderr, "mono_return_sbyte4 s4.f4: got %d but expected %d\n", s4.f4, 4); +- return 1; + } +- return 2*addend; ++ s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend; ++ return s4; + } + + typedef struct { + char f1,f2,f3,f4,f5; + } sbyte5; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte5 STDCALL + mono_return_sbyte5 (sbyte5 s5, int addend) { + if (s5.f1 != 1) { + fprintf(stderr, "mono_return_sbyte5 s5.f1: got %d but expected %d\n", s5.f1, 1); +- return 1; + } + if (s5.f2 != 2) { + fprintf(stderr, "mono_return_sbyte5 s5.f2: got %d but expected %d\n", s5.f2, 2); +- return 1; + } + if (s5.f3 != 3) { + fprintf(stderr, "mono_return_sbyte5 s5.f3: got %d but expected %d\n", s5.f3, 3); +- return 1; + } + if (s5.f4 != 4) { + fprintf(stderr, "mono_return_sbyte5 s5.f4: got %d but expected %d\n", s5.f4, 4); +- return 1; + } + if (s5.f5 != 5) { + fprintf(stderr, "mono_return_sbyte5 s5.f5: got %d but expected %d\n", s5.f5, 5); +- return 1; + } +- return 2*addend; ++ s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend; ++ return s5; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6; + } sbyte6; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte6 STDCALL + mono_return_sbyte6 (sbyte6 s6, int addend) { + if (s6.f1 != 1) { + fprintf(stderr, "mono_return_sbyte6 s6.f1: got %d but expected %d\n", s6.f1, 1); +- return 1; + } + if (s6.f2 != 2) { + fprintf(stderr, "mono_return_sbyte6 s6.f2: got %d but expected %d\n", s6.f2, 2); +- return 1; + } + if (s6.f3 != 3) { + fprintf(stderr, "mono_return_sbyte6 s6.f3: got %d but expected %d\n", s6.f3, 3); +- return 1; + } + if (s6.f4 != 4) { + fprintf(stderr, "mono_return_sbyte6 s6.f4: got %d but expected %d\n", s6.f4, 4); +- return 1; + } + if (s6.f5 != 5) { + fprintf(stderr, "mono_return_sbyte6 s6.f5: got %d but expected %d\n", s6.f5, 5); +- return 1; + } + if (s6.f6 != 6) { + fprintf(stderr, "mono_return_sbyte6 s6.f6: got %d but expected %d\n", s6.f6, 6); +- return 1; + } +- return 2*addend; ++ s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend; ++ return s6; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7; + } sbyte7; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte7 STDCALL + mono_return_sbyte7 (sbyte7 s7, int addend) { + if (s7.f1 != 1) { + fprintf(stderr, "mono_return_sbyte7 s7.f1: got %d but expected %d\n", s7.f1, 1); +- return 1; + } + if (s7.f2 != 2) { + fprintf(stderr, "mono_return_sbyte7 s7.f2: got %d but expected %d\n", s7.f2, 2); +- return 1; + } + if (s7.f3 != 3) { + fprintf(stderr, "mono_return_sbyte7 s7.f3: got %d but expected %d\n", s7.f3, 3); +- return 1; + } + if (s7.f4 != 4) { + fprintf(stderr, "mono_return_sbyte7 s7.f4: got %d but expected %d\n", s7.f4, 4); +- return 1; + } + if (s7.f5 != 5) { + fprintf(stderr, "mono_return_sbyte7 s7.f5: got %d but expected %d\n", s7.f5, 5); +- return 1; + } + if (s7.f6 != 6) { + fprintf(stderr, "mono_return_sbyte7 s7.f6: got %d but expected %d\n", s7.f6, 6); +- return 1; + } + if (s7.f7 != 7) { + fprintf(stderr, "mono_return_sbyte7 s7.f7: got %d but expected %d\n", s7.f7, 7); +- return 1; + } +- return 2*addend; ++ s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend; ++ return s7; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7,f8; + } sbyte8; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte8 STDCALL + mono_return_sbyte8 (sbyte8 s8, int addend) { + if (s8.f1 != 1) { + fprintf(stderr, "mono_return_sbyte8 s8.f1: got %d but expected %d\n", s8.f1, 1); +- return 1; + } + if (s8.f2 != 2) { + fprintf(stderr, "mono_return_sbyte8 s8.f2: got %d but expected %d\n", s8.f2, 2); +- return 1; + } + if (s8.f3 != 3) { + fprintf(stderr, "mono_return_sbyte8 s8.f3: got %d but expected %d\n", s8.f3, 3); +- return 1; + } + if (s8.f4 != 4) { + fprintf(stderr, "mono_return_sbyte8 s8.f4: got %d but expected %d\n", s8.f4, 4); +- return 1; + } + if (s8.f5 != 5) { + fprintf(stderr, "mono_return_sbyte8 s8.f5: got %d but expected %d\n", s8.f5, 5); +- return 1; + } + if (s8.f6 != 6) { + fprintf(stderr, "mono_return_sbyte8 s8.f6: got %d but expected %d\n", s8.f6, 6); +- return 1; + } + if (s8.f7 != 7) { + fprintf(stderr, "mono_return_sbyte8 s8.f7: got %d but expected %d\n", s8.f7, 7); +- return 1; + } + if (s8.f8 != 8) { + fprintf(stderr, "mono_return_sbyte8 s8.f8: got %d but expected %d\n", s8.f8, 8); +- return 1; + } +- return 2*addend; ++ s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend; ++ return s8; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7,f8,f9; + } sbyte9; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte9 STDCALL + mono_return_sbyte9 (sbyte9 s9, int addend) { + if (s9.f1 != 1) { + fprintf(stderr, "mono_return_sbyte9 s9.f1: got %d but expected %d\n", s9.f1, 1); +- return 1; + } + if (s9.f2 != 2) { + fprintf(stderr, "mono_return_sbyte9 s9.f2: got %d but expected %d\n", s9.f2, 2); +- return 1; + } + if (s9.f3 != 3) { + fprintf(stderr, "mono_return_sbyte9 s9.f3: got %d but expected %d\n", s9.f3, 3); +- return 1; + } + if (s9.f4 != 4) { + fprintf(stderr, "mono_return_sbyte9 s9.f4: got %d but expected %d\n", s9.f4, 4); +- return 1; + } + if (s9.f5 != 5) { + fprintf(stderr, "mono_return_sbyte9 s9.f5: got %d but expected %d\n", s9.f5, 5); +- return 1; + } + if (s9.f6 != 6) { + fprintf(stderr, "mono_return_sbyte9 s9.f6: got %d but expected %d\n", s9.f6, 6); +- return 1; + } + if (s9.f7 != 7) { + fprintf(stderr, "mono_return_sbyte9 s9.f7: got %d but expected %d\n", s9.f7, 7); +- return 1; + } + if (s9.f8 != 8) { + fprintf(stderr, "mono_return_sbyte9 s9.f8: got %d but expected %d\n", s9.f8, 8); +- return 1; + } + if (s9.f9 != 9) { + fprintf(stderr, "mono_return_sbyte9 s9.f9: got %d but expected %d\n", s9.f9, 9); +- return 1; + } +- return 2*addend; ++ s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend; ++ return s9; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10; + } sbyte10; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte10 STDCALL + mono_return_sbyte10 (sbyte10 s10, int addend) { + if (s10.f1 != 1) { + fprintf(stderr, "mono_return_sbyte10 s10.f1: got %d but expected %d\n", s10.f1, 1); +- return 1; + } + if (s10.f2 != 2) { + fprintf(stderr, "mono_return_sbyte10 s10.f2: got %d but expected %d\n", s10.f2, 2); +- return 1; + } + if (s10.f3 != 3) { + fprintf(stderr, "mono_return_sbyte10 s10.f3: got %d but expected %d\n", s10.f3, 3); +- return 1; + } + if (s10.f4 != 4) { + fprintf(stderr, "mono_return_sbyte10 s10.f4: got %d but expected %d\n", s10.f4, 4); +- return 1; + } + if (s10.f5 != 5) { + fprintf(stderr, "mono_return_sbyte10 s10.f5: got %d but expected %d\n", s10.f5, 5); +- return 1; + } + if (s10.f6 != 6) { + fprintf(stderr, "mono_return_sbyte10 s10.f6: got %d but expected %d\n", s10.f6, 6); +- return 1; + } + if (s10.f7 != 7) { + fprintf(stderr, "mono_return_sbyte10 s10.f7: got %d but expected %d\n", s10.f7, 7); +- return 1; + } + if (s10.f8 != 8) { + fprintf(stderr, "mono_return_sbyte10 s10.f8: got %d but expected %d\n", s10.f8, 8); +- return 1; + } + if (s10.f9 != 9) { + fprintf(stderr, "mono_return_sbyte10 s10.f9: got %d but expected %d\n", s10.f9, 9); +- return 1; + } + if (s10.f10 != 10) { + fprintf(stderr, "mono_return_sbyte10 s10.f10: got %d but expected %d\n", s10.f10, 10); +- return 1; + } +- return 2*addend; ++ s10.f1+=addend; s10.f2+=addend; s10.f3+=addend; s10.f4+=addend; s10.f5+=addend; s10.f6+=addend; s10.f7+=addend; s10.f8+=addend; s10.f9+=addend; s10.f10+=addend; ++ return s10; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11; + } sbyte11; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte11 STDCALL + mono_return_sbyte11 (sbyte11 s11, int addend) { + if (s11.f1 != 1) { + fprintf(stderr, "mono_return_sbyte11 s11.f1: got %d but expected %d\n", s11.f1, 1); +- return 1; + } + if (s11.f2 != 2) { + fprintf(stderr, "mono_return_sbyte11 s11.f2: got %d but expected %d\n", s11.f2, 2); +- return 1; + } + if (s11.f3 != 3) { + fprintf(stderr, "mono_return_sbyte11 s11.f3: got %d but expected %d\n", s11.f3, 3); +- return 1; + } + if (s11.f4 != 4) { + fprintf(stderr, "mono_return_sbyte11 s11.f4: got %d but expected %d\n", s11.f4, 4); +- return 1; + } + if (s11.f5 != 5) { + fprintf(stderr, "mono_return_sbyte11 s11.f5: got %d but expected %d\n", s11.f5, 5); +- return 1; + } + if (s11.f6 != 6) { + fprintf(stderr, "mono_return_sbyte11 s11.f6: got %d but expected %d\n", s11.f6, 6); +- return 1; + } + if (s11.f7 != 7) { + fprintf(stderr, "mono_return_sbyte11 s11.f7: got %d but expected %d\n", s11.f7, 7); +- return 1; + } + if (s11.f8 != 8) { + fprintf(stderr, "mono_return_sbyte11 s11.f8: got %d but expected %d\n", s11.f8, 8); +- return 1; + } + if (s11.f9 != 9) { + fprintf(stderr, "mono_return_sbyte11 s11.f9: got %d but expected %d\n", s11.f9, 9); +- return 1; + } + if (s11.f10 != 10) { + fprintf(stderr, "mono_return_sbyte11 s11.f10: got %d but expected %d\n", s11.f10, 10); +- return 1; + } + if (s11.f11 != 11) { + fprintf(stderr, "mono_return_sbyte11 s11.f11: got %d but expected %d\n", s11.f11, 11); +- return 1; + } +- return 2*addend; ++ s11.f1+=addend; s11.f2+=addend; s11.f3+=addend; s11.f4+=addend; s11.f5+=addend; s11.f6+=addend; s11.f7+=addend; s11.f8+=addend; s11.f9+=addend; s11.f10+=addend; s11.f11+=addend; ++ return s11; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12; + } sbyte12; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte12 STDCALL + mono_return_sbyte12 (sbyte12 s12, int addend) { + if (s12.f1 != 1) { + fprintf(stderr, "mono_return_sbyte12 s12.f1: got %d but expected %d\n", s12.f1, 1); +- return 1; + } + if (s12.f2 != 2) { + fprintf(stderr, "mono_return_sbyte12 s12.f2: got %d but expected %d\n", s12.f2, 2); +- return 1; + } + if (s12.f3 != 3) { + fprintf(stderr, "mono_return_sbyte12 s12.f3: got %d but expected %d\n", s12.f3, 3); +- return 1; + } + if (s12.f4 != 4) { + fprintf(stderr, "mono_return_sbyte12 s12.f4: got %d but expected %d\n", s12.f4, 4); +- return 1; + } + if (s12.f5 != 5) { + fprintf(stderr, "mono_return_sbyte12 s12.f5: got %d but expected %d\n", s12.f5, 5); +- return 1; + } + if (s12.f6 != 6) { + fprintf(stderr, "mono_return_sbyte12 s12.f6: got %d but expected %d\n", s12.f6, 6); +- return 1; + } + if (s12.f7 != 7) { + fprintf(stderr, "mono_return_sbyte12 s12.f7: got %d but expected %d\n", s12.f7, 7); +- return 1; + } + if (s12.f8 != 8) { + fprintf(stderr, "mono_return_sbyte12 s12.f8: got %d but expected %d\n", s12.f8, 8); +- return 1; + } + if (s12.f9 != 9) { + fprintf(stderr, "mono_return_sbyte12 s12.f9: got %d but expected %d\n", s12.f9, 9); +- return 1; + } + if (s12.f10 != 10) { + fprintf(stderr, "mono_return_sbyte12 s12.f10: got %d but expected %d\n", s12.f10, 10); +- return 1; + } + if (s12.f11 != 11) { + fprintf(stderr, "mono_return_sbyte12 s12.f11: got %d but expected %d\n", s12.f11, 11); +- return 1; + } + if (s12.f12 != 12) { + fprintf(stderr, "mono_return_sbyte12 s12.f12: got %d but expected %d\n", s12.f12, 12); +- return 1; + } +- return 2*addend; ++ s12.f1+=addend; s12.f2+=addend; s12.f3+=addend; s12.f4+=addend; s12.f5+=addend; s12.f6+=addend; s12.f7+=addend; s12.f8+=addend; s12.f9+=addend; s12.f10+=addend; s12.f11+=addend; s12.f12+=addend; ++ return s12; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13; + } sbyte13; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte13 STDCALL + mono_return_sbyte13 (sbyte13 s13, int addend) { + if (s13.f1 != 1) { + fprintf(stderr, "mono_return_sbyte13 s13.f1: got %d but expected %d\n", s13.f1, 1); +- return 1; + } + if (s13.f2 != 2) { + fprintf(stderr, "mono_return_sbyte13 s13.f2: got %d but expected %d\n", s13.f2, 2); +- return 1; + } + if (s13.f3 != 3) { + fprintf(stderr, "mono_return_sbyte13 s13.f3: got %d but expected %d\n", s13.f3, 3); +- return 1; + } + if (s13.f4 != 4) { + fprintf(stderr, "mono_return_sbyte13 s13.f4: got %d but expected %d\n", s13.f4, 4); +- return 1; + } + if (s13.f5 != 5) { + fprintf(stderr, "mono_return_sbyte13 s13.f5: got %d but expected %d\n", s13.f5, 5); +- return 1; + } + if (s13.f6 != 6) { + fprintf(stderr, "mono_return_sbyte13 s13.f6: got %d but expected %d\n", s13.f6, 6); +- return 1; + } + if (s13.f7 != 7) { + fprintf(stderr, "mono_return_sbyte13 s13.f7: got %d but expected %d\n", s13.f7, 7); +- return 1; + } + if (s13.f8 != 8) { + fprintf(stderr, "mono_return_sbyte13 s13.f8: got %d but expected %d\n", s13.f8, 8); +- return 1; + } + if (s13.f9 != 9) { + fprintf(stderr, "mono_return_sbyte13 s13.f9: got %d but expected %d\n", s13.f9, 9); +- return 1; + } + if (s13.f10 != 10) { + fprintf(stderr, "mono_return_sbyte13 s13.f10: got %d but expected %d\n", s13.f10, 10); +- return 1; + } + if (s13.f11 != 11) { + fprintf(stderr, "mono_return_sbyte13 s13.f11: got %d but expected %d\n", s13.f11, 11); +- return 1; + } + if (s13.f12 != 12) { + fprintf(stderr, "mono_return_sbyte13 s13.f12: got %d but expected %d\n", s13.f12, 12); +- return 1; + } + if (s13.f13 != 13) { + fprintf(stderr, "mono_return_sbyte13 s13.f13: got %d but expected %d\n", s13.f13, 13); +- return 1; + } +- return 2*addend; ++ s13.f1+=addend; s13.f2+=addend; s13.f3+=addend; s13.f4+=addend; s13.f5+=addend; s13.f6+=addend; s13.f7+=addend; s13.f8+=addend; s13.f9+=addend; s13.f10+=addend; s13.f11+=addend; s13.f12+=addend; s13.f13+=addend; ++ return s13; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14; + } sbyte14; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte14 STDCALL + mono_return_sbyte14 (sbyte14 s14, int addend) { + if (s14.f1 != 1) { + fprintf(stderr, "mono_return_sbyte14 s14.f1: got %d but expected %d\n", s14.f1, 1); +- return 1; + } + if (s14.f2 != 2) { + fprintf(stderr, "mono_return_sbyte14 s14.f2: got %d but expected %d\n", s14.f2, 2); +- return 1; + } + if (s14.f3 != 3) { + fprintf(stderr, "mono_return_sbyte14 s14.f3: got %d but expected %d\n", s14.f3, 3); +- return 1; + } + if (s14.f4 != 4) { + fprintf(stderr, "mono_return_sbyte14 s14.f4: got %d but expected %d\n", s14.f4, 4); +- return 1; + } + if (s14.f5 != 5) { + fprintf(stderr, "mono_return_sbyte14 s14.f5: got %d but expected %d\n", s14.f5, 5); +- return 1; + } + if (s14.f6 != 6) { + fprintf(stderr, "mono_return_sbyte14 s14.f6: got %d but expected %d\n", s14.f6, 6); +- return 1; + } + if (s14.f7 != 7) { + fprintf(stderr, "mono_return_sbyte14 s14.f7: got %d but expected %d\n", s14.f7, 7); +- return 1; + } + if (s14.f8 != 8) { + fprintf(stderr, "mono_return_sbyte14 s14.f8: got %d but expected %d\n", s14.f8, 8); +- return 1; + } + if (s14.f9 != 9) { + fprintf(stderr, "mono_return_sbyte14 s14.f9: got %d but expected %d\n", s14.f9, 9); +- return 1; + } + if (s14.f10 != 10) { + fprintf(stderr, "mono_return_sbyte14 s14.f10: got %d but expected %d\n", s14.f10, 10); +- return 1; + } + if (s14.f11 != 11) { + fprintf(stderr, "mono_return_sbyte14 s14.f11: got %d but expected %d\n", s14.f11, 11); +- return 1; + } + if (s14.f12 != 12) { + fprintf(stderr, "mono_return_sbyte14 s14.f12: got %d but expected %d\n", s14.f12, 12); +- return 1; + } + if (s14.f13 != 13) { + fprintf(stderr, "mono_return_sbyte14 s14.f13: got %d but expected %d\n", s14.f13, 13); +- return 1; + } + if (s14.f14 != 14) { + fprintf(stderr, "mono_return_sbyte14 s14.f14: got %d but expected %d\n", s14.f14, 14); +- return 1; + } +- return 2*addend; ++ s14.f1+=addend; s14.f2+=addend; s14.f3+=addend; s14.f4+=addend; s14.f5+=addend; s14.f6+=addend; s14.f7+=addend; s14.f8+=addend; s14.f9+=addend; s14.f10+=addend; s14.f11+=addend; s14.f12+=addend; s14.f13+=addend; s14.f14+=addend; ++ return s14; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15; + } sbyte15; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte15 STDCALL + mono_return_sbyte15 (sbyte15 s15, int addend) { + if (s15.f1 != 1) { + fprintf(stderr, "mono_return_sbyte15 s15.f1: got %d but expected %d\n", s15.f1, 1); +- return 1; + } + if (s15.f2 != 2) { + fprintf(stderr, "mono_return_sbyte15 s15.f2: got %d but expected %d\n", s15.f2, 2); +- return 1; + } + if (s15.f3 != 3) { + fprintf(stderr, "mono_return_sbyte15 s15.f3: got %d but expected %d\n", s15.f3, 3); +- return 1; + } + if (s15.f4 != 4) { + fprintf(stderr, "mono_return_sbyte15 s15.f4: got %d but expected %d\n", s15.f4, 4); +- return 1; + } + if (s15.f5 != 5) { + fprintf(stderr, "mono_return_sbyte15 s15.f5: got %d but expected %d\n", s15.f5, 5); +- return 1; + } + if (s15.f6 != 6) { + fprintf(stderr, "mono_return_sbyte15 s15.f6: got %d but expected %d\n", s15.f6, 6); +- return 1; + } + if (s15.f7 != 7) { + fprintf(stderr, "mono_return_sbyte15 s15.f7: got %d but expected %d\n", s15.f7, 7); +- return 1; + } + if (s15.f8 != 8) { + fprintf(stderr, "mono_return_sbyte15 s15.f8: got %d but expected %d\n", s15.f8, 8); +- return 1; + } + if (s15.f9 != 9) { + fprintf(stderr, "mono_return_sbyte15 s15.f9: got %d but expected %d\n", s15.f9, 9); +- return 1; + } + if (s15.f10 != 10) { + fprintf(stderr, "mono_return_sbyte15 s15.f10: got %d but expected %d\n", s15.f10, 10); +- return 1; + } + if (s15.f11 != 11) { + fprintf(stderr, "mono_return_sbyte15 s15.f11: got %d but expected %d\n", s15.f11, 11); +- return 1; + } + if (s15.f12 != 12) { + fprintf(stderr, "mono_return_sbyte15 s15.f12: got %d but expected %d\n", s15.f12, 12); +- return 1; + } + if (s15.f13 != 13) { + fprintf(stderr, "mono_return_sbyte15 s15.f13: got %d but expected %d\n", s15.f13, 13); +- return 1; + } + if (s15.f14 != 14) { + fprintf(stderr, "mono_return_sbyte15 s15.f14: got %d but expected %d\n", s15.f14, 14); +- return 1; + } + if (s15.f15 != 15) { + fprintf(stderr, "mono_return_sbyte15 s15.f15: got %d but expected %d\n", s15.f15, 15); +- return 1; + } +- return 2*addend; ++ s15.f1+=addend; s15.f2+=addend; s15.f3+=addend; s15.f4+=addend; s15.f5+=addend; s15.f6+=addend; s15.f7+=addend; s15.f8+=addend; s15.f9+=addend; s15.f10+=addend; s15.f11+=addend; s15.f12+=addend; s15.f13+=addend; s15.f14+=addend; s15.f15+=addend; ++ return s15; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16; + } sbyte16; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte16 STDCALL + mono_return_sbyte16 (sbyte16 s16, int addend) { + if (s16.f1 != 1) { + fprintf(stderr, "mono_return_sbyte16 s16.f1: got %d but expected %d\n", s16.f1, 1); +- return 1; + } + if (s16.f2 != 2) { + fprintf(stderr, "mono_return_sbyte16 s16.f2: got %d but expected %d\n", s16.f2, 2); +- return 1; + } + if (s16.f3 != 3) { + fprintf(stderr, "mono_return_sbyte16 s16.f3: got %d but expected %d\n", s16.f3, 3); +- return 1; + } + if (s16.f4 != 4) { + fprintf(stderr, "mono_return_sbyte16 s16.f4: got %d but expected %d\n", s16.f4, 4); +- return 1; + } + if (s16.f5 != 5) { + fprintf(stderr, "mono_return_sbyte16 s16.f5: got %d but expected %d\n", s16.f5, 5); +- return 1; + } + if (s16.f6 != 6) { + fprintf(stderr, "mono_return_sbyte16 s16.f6: got %d but expected %d\n", s16.f6, 6); +- return 1; + } + if (s16.f7 != 7) { + fprintf(stderr, "mono_return_sbyte16 s16.f7: got %d but expected %d\n", s16.f7, 7); +- return 1; + } + if (s16.f8 != 8) { + fprintf(stderr, "mono_return_sbyte16 s16.f8: got %d but expected %d\n", s16.f8, 8); +- return 1; + } + if (s16.f9 != 9) { + fprintf(stderr, "mono_return_sbyte16 s16.f9: got %d but expected %d\n", s16.f9, 9); +- return 1; + } + if (s16.f10 != 10) { + fprintf(stderr, "mono_return_sbyte16 s16.f10: got %d but expected %d\n", s16.f10, 10); +- return 1; + } + if (s16.f11 != 11) { + fprintf(stderr, "mono_return_sbyte16 s16.f11: got %d but expected %d\n", s16.f11, 11); +- return 1; + } + if (s16.f12 != 12) { + fprintf(stderr, "mono_return_sbyte16 s16.f12: got %d but expected %d\n", s16.f12, 12); +- return 1; + } + if (s16.f13 != 13) { + fprintf(stderr, "mono_return_sbyte16 s16.f13: got %d but expected %d\n", s16.f13, 13); +- return 1; + } + if (s16.f14 != 14) { + fprintf(stderr, "mono_return_sbyte16 s16.f14: got %d but expected %d\n", s16.f14, 14); +- return 1; + } + if (s16.f15 != 15) { + fprintf(stderr, "mono_return_sbyte16 s16.f15: got %d but expected %d\n", s16.f15, 15); +- return 1; + } + if (s16.f16 != 16) { + fprintf(stderr, "mono_return_sbyte16 s16.f16: got %d but expected %d\n", s16.f16, 16); +- return 1; + } +- return 2*addend; ++ s16.f1+=addend; s16.f2+=addend; s16.f3+=addend; s16.f4+=addend; s16.f5+=addend; s16.f6+=addend; s16.f7+=addend; s16.f8+=addend; s16.f9+=addend; s16.f10+=addend; s16.f11+=addend; s16.f12+=addend; s16.f13+=addend; s16.f14+=addend; s16.f15+=addend; s16.f16+=addend; ++ return s16; + } + + typedef struct { + char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17; + } sbyte17; + +-LIBTEST_API char STDCALL ++LIBTEST_API sbyte17 STDCALL + mono_return_sbyte17 (sbyte17 s17, int addend) { + if (s17.f1 != 1) { + fprintf(stderr, "mono_return_sbyte17 s17.f1: got %d but expected %d\n", s17.f1, 1); +- return 1; + } + if (s17.f2 != 2) { + fprintf(stderr, "mono_return_sbyte17 s17.f2: got %d but expected %d\n", s17.f2, 2); +- return 1; + } + if (s17.f3 != 3) { + fprintf(stderr, "mono_return_sbyte17 s17.f3: got %d but expected %d\n", s17.f3, 3); +- return 1; + } + if (s17.f4 != 4) { + fprintf(stderr, "mono_return_sbyte17 s17.f4: got %d but expected %d\n", s17.f4, 4); +- return 1; + } + if (s17.f5 != 5) { + fprintf(stderr, "mono_return_sbyte17 s17.f5: got %d but expected %d\n", s17.f5, 5); +- return 1; + } + if (s17.f6 != 6) { + fprintf(stderr, "mono_return_sbyte17 s17.f6: got %d but expected %d\n", s17.f6, 6); +- return 1; + } + if (s17.f7 != 7) { + fprintf(stderr, "mono_return_sbyte17 s17.f7: got %d but expected %d\n", s17.f7, 7); +- return 1; + } + if (s17.f8 != 8) { + fprintf(stderr, "mono_return_sbyte17 s17.f8: got %d but expected %d\n", s17.f8, 8); +- return 1; + } + if (s17.f9 != 9) { + fprintf(stderr, "mono_return_sbyte17 s17.f9: got %d but expected %d\n", s17.f9, 9); +- return 1; + } + if (s17.f10 != 10) { + fprintf(stderr, "mono_return_sbyte17 s17.f10: got %d but expected %d\n", s17.f10, 10); +- return 1; + } + if (s17.f11 != 11) { + fprintf(stderr, "mono_return_sbyte17 s17.f11: got %d but expected %d\n", s17.f11, 11); +- return 1; + } + if (s17.f12 != 12) { + fprintf(stderr, "mono_return_sbyte17 s17.f12: got %d but expected %d\n", s17.f12, 12); +- return 1; + } + if (s17.f13 != 13) { + fprintf(stderr, "mono_return_sbyte17 s17.f13: got %d but expected %d\n", s17.f13, 13); +- return 1; + } + if (s17.f14 != 14) { + fprintf(stderr, "mono_return_sbyte17 s17.f14: got %d but expected %d\n", s17.f14, 14); +- return 1; + } + if (s17.f15 != 15) { + fprintf(stderr, "mono_return_sbyte17 s17.f15: got %d but expected %d\n", s17.f15, 15); +- return 1; + } + if (s17.f16 != 16) { + fprintf(stderr, "mono_return_sbyte17 s17.f16: got %d but expected %d\n", s17.f16, 16); +- return 1; + } + if (s17.f17 != 17) { + fprintf(stderr, "mono_return_sbyte17 s17.f17: got %d but expected %d\n", s17.f17, 17); +- return 1; + } +- return 2*addend; ++ s17.f1+=addend; s17.f2+=addend; s17.f3+=addend; s17.f4+=addend; s17.f5+=addend; s17.f6+=addend; s17.f7+=addend; s17.f8+=addend; s17.f9+=addend; s17.f10+=addend; s17.f11+=addend; s17.f12+=addend; s17.f13+=addend; s17.f14+=addend; s17.f15+=addend; s17.f16+=addend; s17.f17+=addend; ++ return s17; + } + + typedef struct { ++ struct { ++ char f1; ++ } nested1; ++ char f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15; ++ struct { ++ char f16; ++ } nested2; ++} sbyte16_nested; ++ ++LIBTEST_API sbyte16_nested STDCALL ++mono_return_sbyte16_nested (sbyte16_nested sn16, int addend) { ++ if (sn16.nested1.f1 != 1) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.nested1.f1: got %d but expected %d\n", sn16.nested1.f1, 1); ++ } ++ if (sn16.f2 != 2) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f2: got %d but expected %d\n", sn16.f2, 2); ++ } ++ if (sn16.f3 != 3) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f3: got %d but expected %d\n", sn16.f3, 3); ++ } ++ if (sn16.f4 != 4) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f4: got %d but expected %d\n", sn16.f4, 4); ++ } ++ if (sn16.f5 != 5) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f5: got %d but expected %d\n", sn16.f5, 5); ++ } ++ if (sn16.f6 != 6) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f6: got %d but expected %d\n", sn16.f6, 6); ++ } ++ if (sn16.f7 != 7) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f7: got %d but expected %d\n", sn16.f7, 7); ++ } ++ if (sn16.f8 != 8) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f8: got %d but expected %d\n", sn16.f8, 8); ++ } ++ if (sn16.f9 != 9) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f9: got %d but expected %d\n", sn16.f9, 9); ++ } ++ if (sn16.f10 != 10) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f10: got %d but expected %d\n", sn16.f10, 10); ++ } ++ if (sn16.f11 != 11) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f11: got %d but expected %d\n", sn16.f11, 11); ++ } ++ if (sn16.f12 != 12) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f12: got %d but expected %d\n", sn16.f12, 12); ++ } ++ if (sn16.f13 != 13) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f13: got %d but expected %d\n", sn16.f13, 13); ++ } ++ if (sn16.f14 != 14) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f14: got %d but expected %d\n", sn16.f14, 14); ++ } ++ if (sn16.f15 != 15) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.f15: got %d but expected %d\n", sn16.f15, 15); ++ } ++ if (sn16.nested2.f16 != 16) { ++ fprintf(stderr, "mono_return_sbyte16_nested sn16.nested2.f16: got %d but expected %d\n", sn16.nested2.f16, 16); ++ } ++ sn16.nested1.f1+=addend; sn16.f2+=addend; sn16.f3+=addend; sn16.f4+=addend; sn16.f5+=addend; sn16.f6+=addend; sn16.f7+=addend; sn16.f8+=addend; sn16.f9+=addend; sn16.f10+=addend; sn16.f11+=addend; sn16.f12+=addend; sn16.f13+=addend; sn16.f14+=addend; sn16.f15+=addend; sn16.nested2.f16+=addend; ++ return sn16; ++} ++ ++ ++typedef struct { + short f1; + } short1; + +-LIBTEST_API short STDCALL ++LIBTEST_API short1 STDCALL + mono_return_short1 (short1 s1, int addend) { + if (s1.f1 != 1) { + fprintf(stderr, "mono_return_short1 s1.f1: got %d but expected %d\n", s1.f1, 1); +- return 1; + } +- return 2*addend; ++ s1.f1+=addend; ++ return s1; + } + + typedef struct { + short f1,f2; + } short2; + +-LIBTEST_API short STDCALL ++LIBTEST_API short2 STDCALL + mono_return_short2 (short2 s2, int addend) { + if (s2.f1 != 1) { + fprintf(stderr, "mono_return_short2 s2.f1: got %d but expected %d\n", s2.f1, 1); +- return 1; + } + if (s2.f2 != 2) { + fprintf(stderr, "mono_return_short2 s2.f2: got %d but expected %d\n", s2.f2, 2); +- return 1; + } +- return 2*addend; ++ s2.f1+=addend; s2.f2+=addend; ++ return s2; + } + + typedef struct { + short f1,f2,f3; + } short3; + +-LIBTEST_API short STDCALL ++LIBTEST_API short3 STDCALL + mono_return_short3 (short3 s3, int addend) { + if (s3.f1 != 1) { + fprintf(stderr, "mono_return_short3 s3.f1: got %d but expected %d\n", s3.f1, 1); +- return 1; + } + if (s3.f2 != 2) { + fprintf(stderr, "mono_return_short3 s3.f2: got %d but expected %d\n", s3.f2, 2); +- return 1; + } + if (s3.f3 != 3) { + fprintf(stderr, "mono_return_short3 s3.f3: got %d but expected %d\n", s3.f3, 3); +- return 1; + } +- return 2*addend; ++ s3.f1+=addend; s3.f2+=addend; s3.f3+=addend; ++ return s3; + } + + typedef struct { + short f1,f2,f3,f4; + } short4; + +-LIBTEST_API short STDCALL ++LIBTEST_API short4 STDCALL + mono_return_short4 (short4 s4, int addend) { + if (s4.f1 != 1) { + fprintf(stderr, "mono_return_short4 s4.f1: got %d but expected %d\n", s4.f1, 1); +- return 1; + } + if (s4.f2 != 2) { + fprintf(stderr, "mono_return_short4 s4.f2: got %d but expected %d\n", s4.f2, 2); +- return 1; + } + if (s4.f3 != 3) { + fprintf(stderr, "mono_return_short4 s4.f3: got %d but expected %d\n", s4.f3, 3); +- return 1; + } + if (s4.f4 != 4) { + fprintf(stderr, "mono_return_short4 s4.f4: got %d but expected %d\n", s4.f4, 4); +- return 1; + } +- return 2*addend; ++ s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend; ++ return s4; + } + + typedef struct { + short f1,f2,f3,f4,f5; + } short5; + +-LIBTEST_API short STDCALL ++LIBTEST_API short5 STDCALL + mono_return_short5 (short5 s5, int addend) { + if (s5.f1 != 1) { + fprintf(stderr, "mono_return_short5 s5.f1: got %d but expected %d\n", s5.f1, 1); +- return 1; + } + if (s5.f2 != 2) { + fprintf(stderr, "mono_return_short5 s5.f2: got %d but expected %d\n", s5.f2, 2); +- return 1; + } + if (s5.f3 != 3) { + fprintf(stderr, "mono_return_short5 s5.f3: got %d but expected %d\n", s5.f3, 3); +- return 1; + } + if (s5.f4 != 4) { + fprintf(stderr, "mono_return_short5 s5.f4: got %d but expected %d\n", s5.f4, 4); +- return 1; + } + if (s5.f5 != 5) { + fprintf(stderr, "mono_return_short5 s5.f5: got %d but expected %d\n", s5.f5, 5); +- return 1; + } +- return 2*addend; ++ s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend; ++ return s5; + } + + typedef struct { + short f1,f2,f3,f4,f5,f6; + } short6; + +-LIBTEST_API short STDCALL ++LIBTEST_API short6 STDCALL + mono_return_short6 (short6 s6, int addend) { + if (s6.f1 != 1) { + fprintf(stderr, "mono_return_short6 s6.f1: got %d but expected %d\n", s6.f1, 1); +- return 1; + } + if (s6.f2 != 2) { + fprintf(stderr, "mono_return_short6 s6.f2: got %d but expected %d\n", s6.f2, 2); +- return 1; + } + if (s6.f3 != 3) { + fprintf(stderr, "mono_return_short6 s6.f3: got %d but expected %d\n", s6.f3, 3); +- return 1; + } + if (s6.f4 != 4) { + fprintf(stderr, "mono_return_short6 s6.f4: got %d but expected %d\n", s6.f4, 4); +- return 1; + } + if (s6.f5 != 5) { + fprintf(stderr, "mono_return_short6 s6.f5: got %d but expected %d\n", s6.f5, 5); +- return 1; + } + if (s6.f6 != 6) { + fprintf(stderr, "mono_return_short6 s6.f6: got %d but expected %d\n", s6.f6, 6); +- return 1; + } +- return 2*addend; ++ s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend; ++ return s6; + } + + typedef struct { + short f1,f2,f3,f4,f5,f6,f7; + } short7; + +-LIBTEST_API short STDCALL ++LIBTEST_API short7 STDCALL + mono_return_short7 (short7 s7, int addend) { + if (s7.f1 != 1) { + fprintf(stderr, "mono_return_short7 s7.f1: got %d but expected %d\n", s7.f1, 1); +- return 1; + } + if (s7.f2 != 2) { + fprintf(stderr, "mono_return_short7 s7.f2: got %d but expected %d\n", s7.f2, 2); +- return 1; + } + if (s7.f3 != 3) { + fprintf(stderr, "mono_return_short7 s7.f3: got %d but expected %d\n", s7.f3, 3); +- return 1; + } + if (s7.f4 != 4) { + fprintf(stderr, "mono_return_short7 s7.f4: got %d but expected %d\n", s7.f4, 4); +- return 1; + } + if (s7.f5 != 5) { + fprintf(stderr, "mono_return_short7 s7.f5: got %d but expected %d\n", s7.f5, 5); +- return 1; + } + if (s7.f6 != 6) { + fprintf(stderr, "mono_return_short7 s7.f6: got %d but expected %d\n", s7.f6, 6); +- return 1; + } + if (s7.f7 != 7) { + fprintf(stderr, "mono_return_short7 s7.f7: got %d but expected %d\n", s7.f7, 7); +- return 1; + } +- return 2*addend; ++ s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend; ++ return s7; + } + + typedef struct { + short f1,f2,f3,f4,f5,f6,f7,f8; + } short8; + +-LIBTEST_API short STDCALL ++LIBTEST_API short8 STDCALL + mono_return_short8 (short8 s8, int addend) { + if (s8.f1 != 1) { + fprintf(stderr, "mono_return_short8 s8.f1: got %d but expected %d\n", s8.f1, 1); +- return 1; + } + if (s8.f2 != 2) { + fprintf(stderr, "mono_return_short8 s8.f2: got %d but expected %d\n", s8.f2, 2); +- return 1; + } + if (s8.f3 != 3) { + fprintf(stderr, "mono_return_short8 s8.f3: got %d but expected %d\n", s8.f3, 3); +- return 1; + } + if (s8.f4 != 4) { + fprintf(stderr, "mono_return_short8 s8.f4: got %d but expected %d\n", s8.f4, 4); +- return 1; + } + if (s8.f5 != 5) { + fprintf(stderr, "mono_return_short8 s8.f5: got %d but expected %d\n", s8.f5, 5); +- return 1; + } + if (s8.f6 != 6) { + fprintf(stderr, "mono_return_short8 s8.f6: got %d but expected %d\n", s8.f6, 6); +- return 1; + } + if (s8.f7 != 7) { + fprintf(stderr, "mono_return_short8 s8.f7: got %d but expected %d\n", s8.f7, 7); +- return 1; + } + if (s8.f8 != 8) { + fprintf(stderr, "mono_return_short8 s8.f8: got %d but expected %d\n", s8.f8, 8); +- return 1; + } +- return 2*addend; ++ s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend; ++ return s8; + } + + typedef struct { + short f1,f2,f3,f4,f5,f6,f7,f8,f9; + } short9; + +-LIBTEST_API short STDCALL ++LIBTEST_API short9 STDCALL + mono_return_short9 (short9 s9, int addend) { + if (s9.f1 != 1) { + fprintf(stderr, "mono_return_short9 s9.f1: got %d but expected %d\n", s9.f1, 1); +- return 1; + } + if (s9.f2 != 2) { + fprintf(stderr, "mono_return_short9 s9.f2: got %d but expected %d\n", s9.f2, 2); +- return 1; + } + if (s9.f3 != 3) { + fprintf(stderr, "mono_return_short9 s9.f3: got %d but expected %d\n", s9.f3, 3); +- return 1; + } + if (s9.f4 != 4) { + fprintf(stderr, "mono_return_short9 s9.f4: got %d but expected %d\n", s9.f4, 4); +- return 1; + } + if (s9.f5 != 5) { + fprintf(stderr, "mono_return_short9 s9.f5: got %d but expected %d\n", s9.f5, 5); +- return 1; + } + if (s9.f6 != 6) { + fprintf(stderr, "mono_return_short9 s9.f6: got %d but expected %d\n", s9.f6, 6); +- return 1; + } + if (s9.f7 != 7) { + fprintf(stderr, "mono_return_short9 s9.f7: got %d but expected %d\n", s9.f7, 7); +- return 1; + } + if (s9.f8 != 8) { + fprintf(stderr, "mono_return_short9 s9.f8: got %d but expected %d\n", s9.f8, 8); +- return 1; + } + if (s9.f9 != 9) { + fprintf(stderr, "mono_return_short9 s9.f9: got %d but expected %d\n", s9.f9, 9); +- return 1; + } +- return 2*addend; ++ s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend; ++ return s9; ++} ++ ++typedef struct { ++ struct { ++ short f1; ++ } nested1; ++ short f2,f3,f4,f5,f6,f7; ++ struct { ++ short f8; ++ } nested2; ++} short8_nested; ++ ++LIBTEST_API short8_nested STDCALL ++mono_return_short8_nested (short8_nested sn8, int addend) { ++ if (sn8.nested1.f1 != 1) { ++ fprintf(stderr, "mono_return_short8_nested sn8.nested1.f1: got %d but expected %d\n", sn8.nested1.f1, 1); ++ } ++ if (sn8.f2 != 2) { ++ fprintf(stderr, "mono_return_short8_nested sn8.f2: got %d but expected %d\n", sn8.f2, 2); ++ } ++ if (sn8.f3 != 3) { ++ fprintf(stderr, "mono_return_short8_nested sn8.f3: got %d but expected %d\n", sn8.f3, 3); ++ } ++ if (sn8.f4 != 4) { ++ fprintf(stderr, "mono_return_short8_nested sn8.f4: got %d but expected %d\n", sn8.f4, 4); ++ } ++ if (sn8.f5 != 5) { ++ fprintf(stderr, "mono_return_short8_nested sn8.f5: got %d but expected %d\n", sn8.f5, 5); ++ } ++ if (sn8.f6 != 6) { ++ fprintf(stderr, "mono_return_short8_nested sn8.f6: got %d but expected %d\n", sn8.f6, 6); ++ } ++ if (sn8.f7 != 7) { ++ fprintf(stderr, "mono_return_short8_nested sn8.f7: got %d but expected %d\n", sn8.f7, 7); ++ } ++ if (sn8.nested2.f8 != 8) { ++ fprintf(stderr, "mono_return_short8_nested sn8.nested2.f8: got %d but expected %d\n", sn8.nested2.f8, 8); ++ } ++ sn8.nested1.f1+=addend; sn8.f2+=addend; sn8.f3+=addend; sn8.f4+=addend; sn8.f5+=addend; sn8.f6+=addend; sn8.f7+=addend; sn8.nested2.f8+=addend; ++ return sn8; + } + ++ + typedef struct { + int f1; + } int1; + +-LIBTEST_API int STDCALL ++LIBTEST_API int1 STDCALL + mono_return_int1 (int1 s1, int addend) { + if (s1.f1 != 1) { + fprintf(stderr, "mono_return_int1 s1.f1: got %d but expected %d\n", s1.f1, 1); +- return 1; + } +- return 2*addend; ++ s1.f1+=addend; ++ return s1; + } + + typedef struct { + int f1,f2; + } int2; + +-LIBTEST_API int STDCALL ++LIBTEST_API int2 STDCALL + mono_return_int2 (int2 s2, int addend) { + if (s2.f1 != 1) { + fprintf(stderr, "mono_return_int2 s2.f1: got %d but expected %d\n", s2.f1, 1); +- return 1; + } + if (s2.f2 != 2) { + fprintf(stderr, "mono_return_int2 s2.f2: got %d but expected %d\n", s2.f2, 2); +- return 1; + } +- return 2*addend; ++ s2.f1+=addend; s2.f2+=addend; ++ return s2; + } + + typedef struct { + int f1,f2,f3; + } int3; + +-LIBTEST_API int STDCALL ++LIBTEST_API int3 STDCALL + mono_return_int3 (int3 s3, int addend) { + if (s3.f1 != 1) { + fprintf(stderr, "mono_return_int3 s3.f1: got %d but expected %d\n", s3.f1, 1); +- return 1; + } + if (s3.f2 != 2) { + fprintf(stderr, "mono_return_int3 s3.f2: got %d but expected %d\n", s3.f2, 2); +- return 1; + } + if (s3.f3 != 3) { + fprintf(stderr, "mono_return_int3 s3.f3: got %d but expected %d\n", s3.f3, 3); +- return 1; + } +- return 2*addend; ++ s3.f1+=addend; s3.f2+=addend; s3.f3+=addend; ++ return s3; + } + + typedef struct { + int f1,f2,f3,f4; + } int4; + +-LIBTEST_API int STDCALL ++LIBTEST_API int4 STDCALL + mono_return_int4 (int4 s4, int addend) { + if (s4.f1 != 1) { + fprintf(stderr, "mono_return_int4 s4.f1: got %d but expected %d\n", s4.f1, 1); +- return 1; + } + if (s4.f2 != 2) { + fprintf(stderr, "mono_return_int4 s4.f2: got %d but expected %d\n", s4.f2, 2); +- return 1; + } + if (s4.f3 != 3) { + fprintf(stderr, "mono_return_int4 s4.f3: got %d but expected %d\n", s4.f3, 3); +- return 1; + } + if (s4.f4 != 4) { + fprintf(stderr, "mono_return_int4 s4.f4: got %d but expected %d\n", s4.f4, 4); +- return 1; + } +- return 2*addend; ++ s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend; ++ return s4; + } + + typedef struct { + int f1,f2,f3,f4,f5; + } int5; + +-LIBTEST_API int STDCALL ++LIBTEST_API int5 STDCALL + mono_return_int5 (int5 s5, int addend) { + if (s5.f1 != 1) { + fprintf(stderr, "mono_return_int5 s5.f1: got %d but expected %d\n", s5.f1, 1); +- return 1; + } + if (s5.f2 != 2) { + fprintf(stderr, "mono_return_int5 s5.f2: got %d but expected %d\n", s5.f2, 2); +- return 1; + } + if (s5.f3 != 3) { + fprintf(stderr, "mono_return_int5 s5.f3: got %d but expected %d\n", s5.f3, 3); +- return 1; + } + if (s5.f4 != 4) { + fprintf(stderr, "mono_return_int5 s5.f4: got %d but expected %d\n", s5.f4, 4); +- return 1; + } + if (s5.f5 != 5) { + fprintf(stderr, "mono_return_int5 s5.f5: got %d but expected %d\n", s5.f5, 5); +- return 1; + } +- return 2*addend; ++ s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend; ++ return s5; ++} ++ ++typedef struct { ++ struct { ++ int f1; ++ } nested1; ++ int f2,f3; ++ struct { ++ int f4; ++ } nested2; ++} int4_nested; ++ ++LIBTEST_API int4_nested STDCALL ++mono_return_int4_nested (int4_nested sn4, int addend) { ++ if (sn4.nested1.f1 != 1) { ++ fprintf(stderr, "mono_return_int4_nested sn4.nested1.f1: got %d but expected %d\n", sn4.nested1.f1, 1); ++ } ++ if (sn4.f2 != 2) { ++ fprintf(stderr, "mono_return_int4_nested sn4.f2: got %d but expected %d\n", sn4.f2, 2); ++ } ++ if (sn4.f3 != 3) { ++ fprintf(stderr, "mono_return_int4_nested sn4.f3: got %d but expected %d\n", sn4.f3, 3); ++ } ++ if (sn4.nested2.f4 != 4) { ++ fprintf(stderr, "mono_return_int4_nested sn4.nested2.f4: got %d but expected %d\n", sn4.nested2.f4, 4); ++ } ++ sn4.nested1.f1+=addend; sn4.f2+=addend; sn4.f3+=addend; sn4.nested2.f4+=addend; ++ return sn4; + } + + typedef struct { + float f1; + } float1; + +-LIBTEST_API float STDCALL ++LIBTEST_API float1 STDCALL + mono_return_float1 (float1 s1, int addend) { + if (s1.f1 != 1) { + fprintf(stderr, "mono_return_float1 s1.f1: got %f but expected %d\n", s1.f1, 1); +- return 1; + } +- return 2*addend; ++ s1.f1+=addend; ++ return s1; + } + + typedef struct { + float f1,f2; + } float2; + +-LIBTEST_API float STDCALL ++LIBTEST_API float2 STDCALL + mono_return_float2 (float2 s2, int addend) { + if (s2.f1 != 1) { + fprintf(stderr, "mono_return_float2 s2.f1: got %f but expected %d\n", s2.f1, 1); +- return 1; + } + if (s2.f2 != 2) { + fprintf(stderr, "mono_return_float2 s2.f2: got %f but expected %d\n", s2.f2, 2); +- return 1; + } +- return 2*addend; ++ s2.f1+=addend; s2.f2+=addend; ++ return s2; + } + + typedef struct { + float f1,f2,f3; + } float3; + +-LIBTEST_API float STDCALL ++LIBTEST_API float3 STDCALL + mono_return_float3 (float3 s3, int addend) { + if (s3.f1 != 1) { + fprintf(stderr, "mono_return_float3 s3.f1: got %f but expected %d\n", s3.f1, 1); +- return 1; + } + if (s3.f2 != 2) { + fprintf(stderr, "mono_return_float3 s3.f2: got %f but expected %d\n", s3.f2, 2); +- return 1; + } + if (s3.f3 != 3) { + fprintf(stderr, "mono_return_float3 s3.f3: got %f but expected %d\n", s3.f3, 3); +- return 1; + } +- return 2*addend; ++ s3.f1+=addend; s3.f2+=addend; s3.f3+=addend; ++ return s3; + } + + typedef struct { + float f1,f2,f3,f4; + } float4; + +-LIBTEST_API float STDCALL ++LIBTEST_API float4 STDCALL + mono_return_float4 (float4 s4, int addend) { + if (s4.f1 != 1) { + fprintf(stderr, "mono_return_float4 s4.f1: got %f but expected %d\n", s4.f1, 1); +- return 1; + } + if (s4.f2 != 2) { + fprintf(stderr, "mono_return_float4 s4.f2: got %f but expected %d\n", s4.f2, 2); +- return 1; + } + if (s4.f3 != 3) { + fprintf(stderr, "mono_return_float4 s4.f3: got %f but expected %d\n", s4.f3, 3); +- return 1; + } + if (s4.f4 != 4) { + fprintf(stderr, "mono_return_float4 s4.f4: got %f but expected %d\n", s4.f4, 4); +- return 1; + } +- return 2*addend; ++ s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend; ++ return s4; + } + + typedef struct { + float f1,f2,f3,f4,f5; + } float5; + +-LIBTEST_API float STDCALL ++LIBTEST_API float5 STDCALL + mono_return_float5 (float5 s5, int addend) { + if (s5.f1 != 1) { + fprintf(stderr, "mono_return_float5 s5.f1: got %f but expected %d\n", s5.f1, 1); +- return 1; + } + if (s5.f2 != 2) { + fprintf(stderr, "mono_return_float5 s5.f2: got %f but expected %d\n", s5.f2, 2); +- return 1; + } + if (s5.f3 != 3) { + fprintf(stderr, "mono_return_float5 s5.f3: got %f but expected %d\n", s5.f3, 3); +- return 1; + } + if (s5.f4 != 4) { + fprintf(stderr, "mono_return_float5 s5.f4: got %f but expected %d\n", s5.f4, 4); +- return 1; + } + if (s5.f5 != 5) { + fprintf(stderr, "mono_return_float5 s5.f5: got %f but expected %d\n", s5.f5, 5); +- return 1; + } +- return 2*addend; ++ s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend; ++ return s5; + } + + typedef struct { + float f1,f2,f3,f4,f5,f6; + } float6; + +-LIBTEST_API float STDCALL ++LIBTEST_API float6 STDCALL + mono_return_float6 (float6 s6, int addend) { + if (s6.f1 != 1) { + fprintf(stderr, "mono_return_float6 s6.f1: got %f but expected %d\n", s6.f1, 1); +- return 1; + } + if (s6.f2 != 2) { + fprintf(stderr, "mono_return_float6 s6.f2: got %f but expected %d\n", s6.f2, 2); +- return 1; + } + if (s6.f3 != 3) { + fprintf(stderr, "mono_return_float6 s6.f3: got %f but expected %d\n", s6.f3, 3); +- return 1; + } + if (s6.f4 != 4) { + fprintf(stderr, "mono_return_float6 s6.f4: got %f but expected %d\n", s6.f4, 4); +- return 1; + } + if (s6.f5 != 5) { + fprintf(stderr, "mono_return_float6 s6.f5: got %f but expected %d\n", s6.f5, 5); +- return 1; + } + if (s6.f6 != 6) { + fprintf(stderr, "mono_return_float6 s6.f6: got %f but expected %d\n", s6.f6, 6); +- return 1; + } +- return 2*addend; ++ s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend; ++ return s6; + } + + typedef struct { + float f1,f2,f3,f4,f5,f6,f7; + } float7; + +-LIBTEST_API float STDCALL ++LIBTEST_API float7 STDCALL + mono_return_float7 (float7 s7, int addend) { + if (s7.f1 != 1) { + fprintf(stderr, "mono_return_float7 s7.f1: got %f but expected %d\n", s7.f1, 1); +- return 1; + } + if (s7.f2 != 2) { + fprintf(stderr, "mono_return_float7 s7.f2: got %f but expected %d\n", s7.f2, 2); +- return 1; + } + if (s7.f3 != 3) { + fprintf(stderr, "mono_return_float7 s7.f3: got %f but expected %d\n", s7.f3, 3); +- return 1; + } + if (s7.f4 != 4) { + fprintf(stderr, "mono_return_float7 s7.f4: got %f but expected %d\n", s7.f4, 4); +- return 1; + } + if (s7.f5 != 5) { + fprintf(stderr, "mono_return_float7 s7.f5: got %f but expected %d\n", s7.f5, 5); +- return 1; + } + if (s7.f6 != 6) { + fprintf(stderr, "mono_return_float7 s7.f6: got %f but expected %d\n", s7.f6, 6); +- return 1; + } + if (s7.f7 != 7) { + fprintf(stderr, "mono_return_float7 s7.f7: got %f but expected %d\n", s7.f7, 7); +- return 1; + } +- return 2*addend; ++ s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend; ++ return s7; + } + + typedef struct { + float f1,f2,f3,f4,f5,f6,f7,f8; + } float8; + +-LIBTEST_API float STDCALL ++LIBTEST_API float8 STDCALL + mono_return_float8 (float8 s8, int addend) { + if (s8.f1 != 1) { + fprintf(stderr, "mono_return_float8 s8.f1: got %f but expected %d\n", s8.f1, 1); +- return 1; + } + if (s8.f2 != 2) { + fprintf(stderr, "mono_return_float8 s8.f2: got %f but expected %d\n", s8.f2, 2); +- return 1; + } + if (s8.f3 != 3) { + fprintf(stderr, "mono_return_float8 s8.f3: got %f but expected %d\n", s8.f3, 3); +- return 1; + } + if (s8.f4 != 4) { + fprintf(stderr, "mono_return_float8 s8.f4: got %f but expected %d\n", s8.f4, 4); +- return 1; + } + if (s8.f5 != 5) { + fprintf(stderr, "mono_return_float8 s8.f5: got %f but expected %d\n", s8.f5, 5); +- return 1; + } + if (s8.f6 != 6) { + fprintf(stderr, "mono_return_float8 s8.f6: got %f but expected %d\n", s8.f6, 6); +- return 1; + } + if (s8.f7 != 7) { + fprintf(stderr, "mono_return_float8 s8.f7: got %f but expected %d\n", s8.f7, 7); +- return 1; + } + if (s8.f8 != 8) { + fprintf(stderr, "mono_return_float8 s8.f8: got %f but expected %d\n", s8.f8, 8); +- return 1; + } +- return 2*addend; ++ s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend; ++ return s8; + } + + typedef struct { + float f1,f2,f3,f4,f5,f6,f7,f8,f9; + } float9; + +-LIBTEST_API float STDCALL ++LIBTEST_API float9 STDCALL + mono_return_float9 (float9 s9, int addend) { + if (s9.f1 != 1) { + fprintf(stderr, "mono_return_float9 s9.f1: got %f but expected %d\n", s9.f1, 1); +- return 1; + } + if (s9.f2 != 2) { + fprintf(stderr, "mono_return_float9 s9.f2: got %f but expected %d\n", s9.f2, 2); +- return 1; + } + if (s9.f3 != 3) { + fprintf(stderr, "mono_return_float9 s9.f3: got %f but expected %d\n", s9.f3, 3); +- return 1; + } + if (s9.f4 != 4) { + fprintf(stderr, "mono_return_float9 s9.f4: got %f but expected %d\n", s9.f4, 4); +- return 1; + } + if (s9.f5 != 5) { + fprintf(stderr, "mono_return_float9 s9.f5: got %f but expected %d\n", s9.f5, 5); +- return 1; + } + if (s9.f6 != 6) { + fprintf(stderr, "mono_return_float9 s9.f6: got %f but expected %d\n", s9.f6, 6); +- return 1; + } + if (s9.f7 != 7) { + fprintf(stderr, "mono_return_float9 s9.f7: got %f but expected %d\n", s9.f7, 7); +- return 1; + } + if (s9.f8 != 8) { + fprintf(stderr, "mono_return_float9 s9.f8: got %f but expected %d\n", s9.f8, 8); +- return 1; + } + if (s9.f9 != 9) { + fprintf(stderr, "mono_return_float9 s9.f9: got %f but expected %d\n", s9.f9, 9); +- return 1; + } +- return 2*addend; ++ s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend; ++ return s9; ++} ++ ++typedef struct { ++ struct { ++ float f1; ++ } nested1; ++ float f2,f3; ++ struct { ++ float f4; ++ } nested2; ++} float4_nested; ++ ++LIBTEST_API float4_nested STDCALL ++mono_return_float4_nested (float4_nested sn4, int addend) { ++ if (sn4.nested1.f1 != 1) { ++ fprintf(stderr, "mono_return_float4_nested sn4.nested1.f1: got %f but expected %d\n", sn4.nested1.f1, 1); ++ } ++ if (sn4.f2 != 2) { ++ fprintf(stderr, "mono_return_float4_nested sn4.f2: got %f but expected %d\n", sn4.f2, 2); ++ } ++ if (sn4.f3 != 3) { ++ fprintf(stderr, "mono_return_float4_nested sn4.f3: got %f but expected %d\n", sn4.f3, 3); ++ } ++ if (sn4.nested2.f4 != 4) { ++ fprintf(stderr, "mono_return_float4_nested sn4.nested2.f4: got %f but expected %d\n", sn4.nested2.f4, 4); ++ } ++ sn4.nested1.f1+=addend; sn4.f2+=addend; sn4.f3+=addend; sn4.nested2.f4+=addend; ++ return sn4; + } + + typedef struct { + double f1; + } double1; + +-LIBTEST_API double STDCALL ++LIBTEST_API double1 STDCALL + mono_return_double1 (double1 s1, int addend) { + if (s1.f1 != 1) { + fprintf(stderr, "mono_return_double1 s1.f1: got %f but expected %d\n", s1.f1, 1); +- return 1; + } +- return 2*addend; ++ s1.f1+=addend; ++ return s1; + } + + typedef struct { + double f1,f2; + } double2; + +-LIBTEST_API double STDCALL ++LIBTEST_API double2 STDCALL + mono_return_double2 (double2 s2, int addend) { + if (s2.f1 != 1) { + fprintf(stderr, "mono_return_double2 s2.f1: got %f but expected %d\n", s2.f1, 1); +- return 1; + } + if (s2.f2 != 2) { + fprintf(stderr, "mono_return_double2 s2.f2: got %f but expected %d\n", s2.f2, 2); +- return 1; + } +- return 2*addend; ++ s2.f1+=addend; s2.f2+=addend; ++ return s2; + } + + typedef struct { + double f1,f2,f3; + } double3; + +-LIBTEST_API double STDCALL ++LIBTEST_API double3 STDCALL + mono_return_double3 (double3 s3, int addend) { + if (s3.f1 != 1) { + fprintf(stderr, "mono_return_double3 s3.f1: got %f but expected %d\n", s3.f1, 1); +- return 1; + } + if (s3.f2 != 2) { + fprintf(stderr, "mono_return_double3 s3.f2: got %f but expected %d\n", s3.f2, 2); +- return 1; + } + if (s3.f3 != 3) { + fprintf(stderr, "mono_return_double3 s3.f3: got %f but expected %d\n", s3.f3, 3); +- return 1; + } +- return 2*addend; ++ s3.f1+=addend; s3.f2+=addend; s3.f3+=addend; ++ return s3; + } + + typedef struct { + double f1,f2,f3,f4; + } double4; + +-LIBTEST_API double STDCALL ++LIBTEST_API double4 STDCALL + mono_return_double4 (double4 s4, int addend) { + if (s4.f1 != 1) { + fprintf(stderr, "mono_return_double4 s4.f1: got %f but expected %d\n", s4.f1, 1); +- return 1; + } + if (s4.f2 != 2) { + fprintf(stderr, "mono_return_double4 s4.f2: got %f but expected %d\n", s4.f2, 2); +- return 1; + } + if (s4.f3 != 3) { + fprintf(stderr, "mono_return_double4 s4.f3: got %f but expected %d\n", s4.f3, 3); +- return 1; + } + if (s4.f4 != 4) { + fprintf(stderr, "mono_return_double4 s4.f4: got %f but expected %d\n", s4.f4, 4); +- return 1; + } +- return 2*addend; ++ s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend; ++ return s4; + } + + typedef struct { + double f1,f2,f3,f4,f5; + } double5; + +-LIBTEST_API double STDCALL ++LIBTEST_API double5 STDCALL + mono_return_double5 (double5 s5, int addend) { + if (s5.f1 != 1) { + fprintf(stderr, "mono_return_double5 s5.f1: got %f but expected %d\n", s5.f1, 1); +- return 1; + } + if (s5.f2 != 2) { + fprintf(stderr, "mono_return_double5 s5.f2: got %f but expected %d\n", s5.f2, 2); +- return 1; + } + if (s5.f3 != 3) { + fprintf(stderr, "mono_return_double5 s5.f3: got %f but expected %d\n", s5.f3, 3); +- return 1; + } + if (s5.f4 != 4) { + fprintf(stderr, "mono_return_double5 s5.f4: got %f but expected %d\n", s5.f4, 4); +- return 1; + } + if (s5.f5 != 5) { + fprintf(stderr, "mono_return_double5 s5.f5: got %f but expected %d\n", s5.f5, 5); +- return 1; + } +- return 2*addend; ++ s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend; ++ return s5; + } + + typedef struct { + double f1,f2,f3,f4,f5,f6; + } double6; + +-LIBTEST_API double STDCALL ++LIBTEST_API double6 STDCALL + mono_return_double6 (double6 s6, int addend) { + if (s6.f1 != 1) { + fprintf(stderr, "mono_return_double6 s6.f1: got %f but expected %d\n", s6.f1, 1); +- return 1; + } + if (s6.f2 != 2) { + fprintf(stderr, "mono_return_double6 s6.f2: got %f but expected %d\n", s6.f2, 2); +- return 1; + } + if (s6.f3 != 3) { + fprintf(stderr, "mono_return_double6 s6.f3: got %f but expected %d\n", s6.f3, 3); +- return 1; + } + if (s6.f4 != 4) { + fprintf(stderr, "mono_return_double6 s6.f4: got %f but expected %d\n", s6.f4, 4); +- return 1; + } + if (s6.f5 != 5) { + fprintf(stderr, "mono_return_double6 s6.f5: got %f but expected %d\n", s6.f5, 5); +- return 1; + } + if (s6.f6 != 6) { + fprintf(stderr, "mono_return_double6 s6.f6: got %f but expected %d\n", s6.f6, 6); +- return 1; + } +- return 2*addend; ++ s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend; ++ return s6; + } + + typedef struct { + double f1,f2,f3,f4,f5,f6,f7; + } double7; + +-LIBTEST_API double STDCALL ++LIBTEST_API double7 STDCALL + mono_return_double7 (double7 s7, int addend) { + if (s7.f1 != 1) { + fprintf(stderr, "mono_return_double7 s7.f1: got %f but expected %d\n", s7.f1, 1); +- return 1; + } + if (s7.f2 != 2) { + fprintf(stderr, "mono_return_double7 s7.f2: got %f but expected %d\n", s7.f2, 2); +- return 1; + } + if (s7.f3 != 3) { + fprintf(stderr, "mono_return_double7 s7.f3: got %f but expected %d\n", s7.f3, 3); +- return 1; + } + if (s7.f4 != 4) { + fprintf(stderr, "mono_return_double7 s7.f4: got %f but expected %d\n", s7.f4, 4); +- return 1; + } + if (s7.f5 != 5) { + fprintf(stderr, "mono_return_double7 s7.f5: got %f but expected %d\n", s7.f5, 5); +- return 1; + } + if (s7.f6 != 6) { + fprintf(stderr, "mono_return_double7 s7.f6: got %f but expected %d\n", s7.f6, 6); +- return 1; + } + if (s7.f7 != 7) { + fprintf(stderr, "mono_return_double7 s7.f7: got %f but expected %d\n", s7.f7, 7); +- return 1; + } +- return 2*addend; ++ s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend; ++ return s7; + } + + typedef struct { + double f1,f2,f3,f4,f5,f6,f7,f8; + } double8; + +-LIBTEST_API double STDCALL ++LIBTEST_API double8 STDCALL + mono_return_double8 (double8 s8, int addend) { + if (s8.f1 != 1) { + fprintf(stderr, "mono_return_double8 s8.f1: got %f but expected %d\n", s8.f1, 1); +- return 1; + } + if (s8.f2 != 2) { + fprintf(stderr, "mono_return_double8 s8.f2: got %f but expected %d\n", s8.f2, 2); +- return 1; + } + if (s8.f3 != 3) { + fprintf(stderr, "mono_return_double8 s8.f3: got %f but expected %d\n", s8.f3, 3); +- return 1; + } + if (s8.f4 != 4) { + fprintf(stderr, "mono_return_double8 s8.f4: got %f but expected %d\n", s8.f4, 4); +- return 1; + } + if (s8.f5 != 5) { + fprintf(stderr, "mono_return_double8 s8.f5: got %f but expected %d\n", s8.f5, 5); +- return 1; + } + if (s8.f6 != 6) { + fprintf(stderr, "mono_return_double8 s8.f6: got %f but expected %d\n", s8.f6, 6); +- return 1; + } + if (s8.f7 != 7) { + fprintf(stderr, "mono_return_double8 s8.f7: got %f but expected %d\n", s8.f7, 7); +- return 1; + } + if (s8.f8 != 8) { + fprintf(stderr, "mono_return_double8 s8.f8: got %f but expected %d\n", s8.f8, 8); +- return 1; + } +- return 2*addend; ++ s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend; ++ return s8; + } + + typedef struct { + double f1,f2,f3,f4,f5,f6,f7,f8,f9; + } double9; + +-LIBTEST_API double STDCALL ++LIBTEST_API double9 STDCALL + mono_return_double9 (double9 s9, int addend) { + if (s9.f1 != 1) { + fprintf(stderr, "mono_return_double9 s9.f1: got %f but expected %d\n", s9.f1, 1); +- return 1; + } + if (s9.f2 != 2) { + fprintf(stderr, "mono_return_double9 s9.f2: got %f but expected %d\n", s9.f2, 2); +- return 1; + } + if (s9.f3 != 3) { + fprintf(stderr, "mono_return_double9 s9.f3: got %f but expected %d\n", s9.f3, 3); +- return 1; + } + if (s9.f4 != 4) { + fprintf(stderr, "mono_return_double9 s9.f4: got %f but expected %d\n", s9.f4, 4); +- return 1; + } + if (s9.f5 != 5) { + fprintf(stderr, "mono_return_double9 s9.f5: got %f but expected %d\n", s9.f5, 5); +- return 1; + } + if (s9.f6 != 6) { + fprintf(stderr, "mono_return_double9 s9.f6: got %f but expected %d\n", s9.f6, 6); +- return 1; + } + if (s9.f7 != 7) { + fprintf(stderr, "mono_return_double9 s9.f7: got %f but expected %d\n", s9.f7, 7); +- return 1; + } + if (s9.f8 != 8) { + fprintf(stderr, "mono_return_double9 s9.f8: got %f but expected %d\n", s9.f8, 8); +- return 1; + } + if (s9.f9 != 9) { + fprintf(stderr, "mono_return_double9 s9.f9: got %f but expected %d\n", s9.f9, 9); +- return 1; + } +- return 2*addend; ++ s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend; ++ return s9; + } + ++typedef struct { ++ struct { ++ double f1; ++ } nested1; ++ struct { ++ double f2; ++ } nested2; ++} double2_nested; ++ ++LIBTEST_API double2_nested STDCALL ++mono_return_double2_nested (double2_nested sn2, int addend) { ++ if (sn2.nested1.f1 != 1) { ++ fprintf(stderr, "mono_return_double2_nested sn2.nested1.f1: got %f but expected %d\n", sn2.nested1.f1, 1); ++ } ++ if (sn2.nested2.f2 != 2) { ++ fprintf(stderr, "mono_return_double2_nested sn2.nested2.f2: got %f but expected %d\n", sn2.nested2.f2, 2); ++ } ++ sn2.nested1.f1+=addend; sn2.nested2.f2+=addend; ++ return sn2; ++} + + +-// WDS debug +-// To use add: +-// [DllImport ("libtest", EntryPoint="ppc_dbg")] +-// public static extern void ppc_dbg (); +-// Then just call: +-// ppc_dbg(); +-LIBTEST_API void STDCALL +-ppc_dbg(void) +-{ +- static int cnt=0; +- ++cnt; +- printf("@#@#@# ppc_dbg call#%d\n", cnt); +- return; ++ ++typedef struct { ++ double f1[4]; ++} double_array4; ++ ++LIBTEST_API double_array4 STDCALL ++mono_return_double_array4 (double_array4 sa4, int addend) { ++ if (sa4.f1[0] != 1) { ++ fprintf(stderr, "mono_return_double_array4 sa4.f1[0]: got %f but expected %d\n", sa4.f1[0], 1); ++ } ++ if (sa4.f1[1] != 2) { ++ fprintf(stderr, "mono_return_double_array4 sa4.f1[1]: got %f but expected %d\n", sa4.f1[1], 2); ++ } ++ if (sa4.f1[2] != 3) { ++ fprintf(stderr, "mono_return_double_array4 sa4.f1[2]: got %f but expected %d\n", sa4.f1[2], 3); ++ } ++ if (sa4.f1[3] != 4) { ++ fprintf(stderr, "mono_return_double_array4 sa4.f1[3]: got %f but expected %d\n", sa4.f1[3], 4); ++ } ++ sa4.f1[0]+=addend; sa4.f1[1]+=addend; sa4.f1[2]+=addend; sa4.f1[3]+=addend; ++ return sa4; + } +-// WDS debug + +Index: mono-4.2.1/mono/tests/pinvoke_ppcc.cs +=================================================================== +--- mono-4.2.1.orig/mono/tests/pinvoke_ppcc.cs ++++ mono-4.2.1/mono/tests/pinvoke_ppcc.cs +@@ -20,97 +20,97 @@ using System.Runtime.InteropServices; + public class Test_sbyte { + + [DllImport ("libtest", EntryPoint="mono_return_sbyte1")] +- public static extern sbyte mono_return_sbyte1 (sbyte1 s, int addend); ++ public static extern sbyte1 mono_return_sbyte1 (sbyte1 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte1 { + public sbyte f1; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte2")] +- public static extern sbyte mono_return_sbyte2 (sbyte2 s, int addend); ++ public static extern sbyte2 mono_return_sbyte2 (sbyte2 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte2 { + public sbyte f1,f2; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte3")] +- public static extern sbyte mono_return_sbyte3 (sbyte3 s, int addend); ++ public static extern sbyte3 mono_return_sbyte3 (sbyte3 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte3 { + public sbyte f1,f2,f3; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte4")] +- public static extern sbyte mono_return_sbyte4 (sbyte4 s, int addend); ++ public static extern sbyte4 mono_return_sbyte4 (sbyte4 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte4 { + public sbyte f1,f2,f3,f4; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte5")] +- public static extern sbyte mono_return_sbyte5 (sbyte5 s, int addend); ++ public static extern sbyte5 mono_return_sbyte5 (sbyte5 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte5 { + public sbyte f1,f2,f3,f4,f5; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte6")] +- public static extern sbyte mono_return_sbyte6 (sbyte6 s, int addend); ++ public static extern sbyte6 mono_return_sbyte6 (sbyte6 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte6 { + public sbyte f1,f2,f3,f4,f5,f6; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte7")] +- public static extern sbyte mono_return_sbyte7 (sbyte7 s, int addend); ++ public static extern sbyte7 mono_return_sbyte7 (sbyte7 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte7 { + public sbyte f1,f2,f3,f4,f5,f6,f7; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte8")] +- public static extern sbyte mono_return_sbyte8 (sbyte8 s, int addend); ++ public static extern sbyte8 mono_return_sbyte8 (sbyte8 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte8 { + public sbyte f1,f2,f3,f4,f5,f6,f7,f8; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte9")] +- public static extern sbyte mono_return_sbyte9 (sbyte9 s, int addend); ++ public static extern sbyte9 mono_return_sbyte9 (sbyte9 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte9 { + public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte10")] +- public static extern sbyte mono_return_sbyte10 (sbyte10 s, int addend); ++ public static extern sbyte10 mono_return_sbyte10 (sbyte10 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte10 { + public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte11")] +- public static extern sbyte mono_return_sbyte11 (sbyte11 s, int addend); ++ public static extern sbyte11 mono_return_sbyte11 (sbyte11 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte11 { + public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte12")] +- public static extern sbyte mono_return_sbyte12 (sbyte12 s, int addend); ++ public static extern sbyte12 mono_return_sbyte12 (sbyte12 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte12 { + public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte13")] +- public static extern sbyte mono_return_sbyte13 (sbyte13 s, int addend); ++ public static extern sbyte13 mono_return_sbyte13 (sbyte13 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte13 { + public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte14")] +- public static extern sbyte mono_return_sbyte14 (sbyte14 s, int addend); ++ public static extern sbyte14 mono_return_sbyte14 (sbyte14 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte14 { + public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte15")] +- public static extern sbyte mono_return_sbyte15 (sbyte15 s, int addend); ++ public static extern sbyte15 mono_return_sbyte15 (sbyte15 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte15 { + public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15; + } + [DllImport ("libtest", EntryPoint="mono_return_sbyte16")] +- public static extern sbyte mono_return_sbyte16 (sbyte16 s, int addend); ++ public static extern sbyte16 mono_return_sbyte16 (sbyte16 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte16 { + public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16; +@@ -118,7 +118,7 @@ public class Test_sbyte { + // This structure is 1 element too large to use the special return + // rules. + [DllImport ("libtest", EntryPoint="mono_return_sbyte17")] +- public static extern sbyte mono_return_sbyte17 (sbyte17 s, int addend); ++ public static extern sbyte17 mono_return_sbyte17 (sbyte17 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct sbyte17 { + public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17; +@@ -145,41 +145,66 @@ public class Test_sbyte { + + sbyte1 s1; + s1.f1 = 1; +- sbyte retval1 = mono_return_sbyte1(s1, 9); +- if (retval1 != 2*9) { +- Console.WriteLine(" sbyte1 retval1: got {0} but expected {1}", retval1, 2*9); ++ s1 = mono_return_sbyte1(s1, 9); ++ ++ if (s1.f1 != 1+9) { ++ Console.WriteLine(" sbyte1 s1.f1: got {0} but expected {1}", s1.f1, 1+9); + return 1; + } + + sbyte2 s2; + s2.f1 = 1; + s2.f2 = 2; +- sbyte retval2 = mono_return_sbyte2(s2, 9); +- if (retval2 != 2*9) { +- Console.WriteLine(" sbyte2 retval2: got {0} but expected {1}", retval2, 2*9); ++ s2 = mono_return_sbyte2(s2, 9); ++ if (s2.f1 != 1+9) { ++ Console.WriteLine(" sbyte2 s2.f1: got {0} but expected {1}", s2.f1, 1+9); + return 1; + } ++ if (s2.f2 != 2+9) { ++ Console.WriteLine(" sbyte2 s2.f2: got {0} but expected {1}", s2.f2, 2+9); ++ return 2; ++ } + + sbyte3 s3; + s3.f1 = 1; + s3.f2 = 2; + s3.f3 = 3; +- sbyte retval3 = mono_return_sbyte3(s3, 9); +- if (retval3 != 2*9) { +- Console.WriteLine(" sbyte3 retval3: got {0} but expected {1}", retval3, 2*9); ++ s3 = mono_return_sbyte3(s3, 9); ++ if (s3.f1 != 1+9) { ++ Console.WriteLine(" sbyte3 s3.f1: got {0} but expected {1}", s3.f1, 1+9); + return 1; + } ++ if (s3.f2 != 2+9) { ++ Console.WriteLine(" sbyte3 s3.f2: got {0} but expected {1}", s3.f2, 2+9); ++ return 2; ++ } ++ if (s3.f3 != 3+9) { ++ Console.WriteLine(" sbyte3 s3.f3: got {0} but expected {1}", s3.f3, 3+9); ++ return 3; ++ } + + sbyte4 s4; + s4.f1 = 1; + s4.f2 = 2; + s4.f3 = 3; + s4.f4 = 4; +- sbyte retval4 = mono_return_sbyte4(s4, 9); +- if (retval4 != 2*9) { +- Console.WriteLine(" sbyte4 retval4: got {0} but expected {1}", retval4, 2*9); ++ s4 = mono_return_sbyte4(s4, 9); ++ if (s4.f1 != 1+9) { ++ Console.WriteLine(" sbyte4 s4.f1: got {0} but expected {1}", s4.f1, 1+9); + return 1; + } ++ if (s4.f2 != 2+9) { ++ Console.WriteLine(" sbyte4 s4.f2: got {0} but expected {1}", s4.f2, 2+9); ++ return 2; ++ } ++ if (s4.f3 != 3+9) { ++ Console.WriteLine(" sbyte4 s4.f3: got {0} but expected {1}", s4.f3, 3+9); ++ return 3; ++ } ++ if (s4.f4 != 4+9) { ++ Console.WriteLine(" sbyte4 s4.f4: got {0} but expected {1}", s4.f4, 4+9); ++ return 4; ++ } + + sbyte5 s5; + s5.f1 = 1; +@@ -187,11 +212,27 @@ public class Test_sbyte { + s5.f3 = 3; + s5.f4 = 4; + s5.f5 = 5; +- sbyte retval5 = mono_return_sbyte5(s5, 9); +- if (retval5 != 2*9) { +- Console.WriteLine(" sbyte5 retval5: got {0} but expected {1}", retval5, 2*9); ++ s5 = mono_return_sbyte5(s5, 9); ++ if (s5.f1 != 1+9) { ++ Console.WriteLine(" sbyte5 s5.f1: got {0} but expected {1}", s5.f1, 1+9); + return 1; + } ++ if (s5.f2 != 2+9) { ++ Console.WriteLine(" sbyte5 s5.f2: got {0} but expected {1}", s5.f2, 2+9); ++ return 2; ++ } ++ if (s5.f3 != 3+9) { ++ Console.WriteLine(" sbyte5 s5.f3: got {0} but expected {1}", s5.f3, 3+9); ++ return 3; ++ } ++ if (s5.f4 != 4+9) { ++ Console.WriteLine(" sbyte5 s5.f4: got {0} but expected {1}", s5.f4, 4+9); ++ return 4; ++ } ++ if (s5.f5 != 5+9) { ++ Console.WriteLine(" sbyte5 s5.f5: got {0} but expected {1}", s5.f5, 5+9); ++ return 5; ++ } + + sbyte6 s6; + s6.f1 = 1; +@@ -200,11 +241,31 @@ public class Test_sbyte { + s6.f4 = 4; + s6.f5 = 5; + s6.f6 = 6; +- sbyte retval6 = mono_return_sbyte6(s6, 9); +- if (retval6 != 2*9) { +- Console.WriteLine(" sbyte6 retval6: got {0} but expected {1}", retval6, 2*9); ++ s6 = mono_return_sbyte6(s6, 9); ++ if (s6.f1 != 1+9) { ++ Console.WriteLine(" sbyte6 s6.f1: got {0} but expected {1}", s6.f1, 1+9); + return 1; + } ++ if (s6.f2 != 2+9) { ++ Console.WriteLine(" sbyte6 s6.f2: got {0} but expected {1}", s6.f2, 2+9); ++ return 2; ++ } ++ if (s6.f3 != 3+9) { ++ Console.WriteLine(" sbyte6 s6.f3: got {0} but expected {1}", s6.f3, 3+9); ++ return 3; ++ } ++ if (s6.f4 != 4+9) { ++ Console.WriteLine(" sbyte6 s6.f4: got {0} but expected {1}", s6.f4, 4+9); ++ return 4; ++ } ++ if (s6.f5 != 5+9) { ++ Console.WriteLine(" sbyte6 s6.f5: got {0} but expected {1}", s6.f5, 5+9); ++ return 5; ++ } ++ if (s6.f6 != 6+9) { ++ Console.WriteLine(" sbyte6 s6.f6: got {0} but expected {1}", s6.f6, 6+9); ++ return 6; ++ } + + sbyte7 s7; + s7.f1 = 1; +@@ -214,11 +275,35 @@ public class Test_sbyte { + s7.f5 = 5; + s7.f6 = 6; + s7.f7 = 7; +- sbyte retval7 = mono_return_sbyte7(s7, 9); +- if (retval7 != 2*9) { +- Console.WriteLine(" sbyte7 retval7: got {0} but expected {1}", retval7, 2*9); ++ s7 = mono_return_sbyte7(s7, 9); ++ if (s7.f1 != 1+9) { ++ Console.WriteLine(" sbyte7 s7.f1: got {0} but expected {1}", s7.f1, 1+9); + return 1; + } ++ if (s7.f2 != 2+9) { ++ Console.WriteLine(" sbyte7 s7.f2: got {0} but expected {1}", s7.f2, 2+9); ++ return 2; ++ } ++ if (s7.f3 != 3+9) { ++ Console.WriteLine(" sbyte7 s7.f3: got {0} but expected {1}", s7.f3, 3+9); ++ return 3; ++ } ++ if (s7.f4 != 4+9) { ++ Console.WriteLine(" sbyte7 s7.f4: got {0} but expected {1}", s7.f4, 4+9); ++ return 4; ++ } ++ if (s7.f5 != 5+9) { ++ Console.WriteLine(" sbyte7 s7.f5: got {0} but expected {1}", s7.f5, 5+9); ++ return 5; ++ } ++ if (s7.f6 != 6+9) { ++ Console.WriteLine(" sbyte7 s7.f6: got {0} but expected {1}", s7.f6, 6+9); ++ return 6; ++ } ++ if (s7.f7 != 7+9) { ++ Console.WriteLine(" sbyte7 s7.f7: got {0} but expected {1}", s7.f7, 7+9); ++ return 7; ++ } + + sbyte8 s8; + s8.f1 = 1; +@@ -229,11 +314,39 @@ public class Test_sbyte { + s8.f6 = 6; + s8.f7 = 7; + s8.f8 = 8; +- sbyte retval8 = mono_return_sbyte8(s8, 9); +- if (retval8 != 2*9) { +- Console.WriteLine(" sbyte8 retval8: got {0} but expected {1}", retval8, 2*9); ++ s8 = mono_return_sbyte8(s8, 9); ++ if (s8.f1 != 1+9) { ++ Console.WriteLine(" sbyte8 s8.f1: got {0} but expected {1}", s8.f1, 1+9); + return 1; + } ++ if (s8.f2 != 2+9) { ++ Console.WriteLine(" sbyte8 s8.f2: got {0} but expected {1}", s8.f2, 2+9); ++ return 2; ++ } ++ if (s8.f3 != 3+9) { ++ Console.WriteLine(" sbyte8 s8.f3: got {0} but expected {1}", s8.f3, 3+9); ++ return 3; ++ } ++ if (s8.f4 != 4+9) { ++ Console.WriteLine(" sbyte8 s8.f4: got {0} but expected {1}", s8.f4, 4+9); ++ return 4; ++ } ++ if (s8.f5 != 5+9) { ++ Console.WriteLine(" sbyte8 s8.f5: got {0} but expected {1}", s8.f5, 5+9); ++ return 5; ++ } ++ if (s8.f6 != 6+9) { ++ Console.WriteLine(" sbyte8 s8.f6: got {0} but expected {1}", s8.f6, 6+9); ++ return 6; ++ } ++ if (s8.f7 != 7+9) { ++ Console.WriteLine(" sbyte8 s8.f7: got {0} but expected {1}", s8.f7, 7+9); ++ return 7; ++ } ++ if (s8.f8 != 8+9) { ++ Console.WriteLine(" sbyte8 s8.f8: got {0} but expected {1}", s8.f8, 8+9); ++ return 8; ++ } + + sbyte9 s9; + s9.f1 = 1; +@@ -245,11 +358,43 @@ public class Test_sbyte { + s9.f7 = 7; + s9.f8 = 8; + s9.f9 = 9; +- sbyte retval9 = mono_return_sbyte9(s9, 9); +- if (retval9 != 2*9) { +- Console.WriteLine(" sbyte9 retval9: got {0} but expected {1}", retval9, 2*9); ++ s9 = mono_return_sbyte9(s9, 9); ++ if (s9.f1 != 1+9) { ++ Console.WriteLine(" sbyte9 s9.f1: got {0} but expected {1}", s9.f1, 1+9); + return 1; + } ++ if (s9.f2 != 2+9) { ++ Console.WriteLine(" sbyte9 s9.f2: got {0} but expected {1}", s9.f2, 2+9); ++ return 2; ++ } ++ if (s9.f3 != 3+9) { ++ Console.WriteLine(" sbyte9 s9.f3: got {0} but expected {1}", s9.f3, 3+9); ++ return 3; ++ } ++ if (s9.f4 != 4+9) { ++ Console.WriteLine(" sbyte9 s9.f4: got {0} but expected {1}", s9.f4, 4+9); ++ return 4; ++ } ++ if (s9.f5 != 5+9) { ++ Console.WriteLine(" sbyte9 s9.f5: got {0} but expected {1}", s9.f5, 5+9); ++ return 5; ++ } ++ if (s9.f6 != 6+9) { ++ Console.WriteLine(" sbyte9 s9.f6: got {0} but expected {1}", s9.f6, 6+9); ++ return 6; ++ } ++ if (s9.f7 != 7+9) { ++ Console.WriteLine(" sbyte9 s9.f7: got {0} but expected {1}", s9.f7, 7+9); ++ return 7; ++ } ++ if (s9.f8 != 8+9) { ++ Console.WriteLine(" sbyte9 s9.f8: got {0} but expected {1}", s9.f8, 8+9); ++ return 8; ++ } ++ if (s9.f9 != 9+9) { ++ Console.WriteLine(" sbyte9 s9.f9: got {0} but expected {1}", s9.f9, 9+9); ++ return 9; ++ } + + sbyte10 s10; + s10.f1 = 1; +@@ -262,11 +407,47 @@ public class Test_sbyte { + s10.f8 = 8; + s10.f9 = 9; + s10.f10 = 10; +- sbyte retval10 = mono_return_sbyte10(s10, 9); +- if (retval10 != 2*9) { +- Console.WriteLine(" sbyte10 retval10: got {0} but expected {1}", retval10, 2*9); ++ s10 = mono_return_sbyte10(s10, 9); ++ if (s10.f1 != 1+9) { ++ Console.WriteLine(" sbyte10 s10.f1: got {0} but expected {1}", s10.f1, 1+9); + return 1; + } ++ if (s10.f2 != 2+9) { ++ Console.WriteLine(" sbyte10 s10.f2: got {0} but expected {1}", s10.f2, 2+9); ++ return 2; ++ } ++ if (s10.f3 != 3+9) { ++ Console.WriteLine(" sbyte10 s10.f3: got {0} but expected {1}", s10.f3, 3+9); ++ return 3; ++ } ++ if (s10.f4 != 4+9) { ++ Console.WriteLine(" sbyte10 s10.f4: got {0} but expected {1}", s10.f4, 4+9); ++ return 4; ++ } ++ if (s10.f5 != 5+9) { ++ Console.WriteLine(" sbyte10 s10.f5: got {0} but expected {1}", s10.f5, 5+9); ++ return 5; ++ } ++ if (s10.f6 != 6+9) { ++ Console.WriteLine(" sbyte10 s10.f6: got {0} but expected {1}", s10.f6, 6+9); ++ return 6; ++ } ++ if (s10.f7 != 7+9) { ++ Console.WriteLine(" sbyte10 s10.f7: got {0} but expected {1}", s10.f7, 7+9); ++ return 7; ++ } ++ if (s10.f8 != 8+9) { ++ Console.WriteLine(" sbyte10 s10.f8: got {0} but expected {1}", s10.f8, 8+9); ++ return 8; ++ } ++ if (s10.f9 != 9+9) { ++ Console.WriteLine(" sbyte10 s10.f9: got {0} but expected {1}", s10.f9, 9+9); ++ return 9; ++ } ++ if (s10.f10 != 10+9) { ++ Console.WriteLine(" sbyte10 s10.f10: got {0} but expected {1}", s10.f10, 10+9); ++ return 10; ++ } + + sbyte11 s11; + s11.f1 = 1; +@@ -280,11 +461,51 @@ public class Test_sbyte { + s11.f9 = 9; + s11.f10 = 10; + s11.f11 = 11; +- sbyte retval11 = mono_return_sbyte11(s11, 9); +- if (retval11 != 2*9) { +- Console.WriteLine(" sbyte11 retval11: got {0} but expected {1}", retval11, 2*9); ++ s11 = mono_return_sbyte11(s11, 9); ++ if (s11.f1 != 1+9) { ++ Console.WriteLine(" sbyte11 s11.f1: got {0} but expected {1}", s11.f1, 1+9); + return 1; + } ++ if (s11.f2 != 2+9) { ++ Console.WriteLine(" sbyte11 s11.f2: got {0} but expected {1}", s11.f2, 2+9); ++ return 2; ++ } ++ if (s11.f3 != 3+9) { ++ Console.WriteLine(" sbyte11 s11.f3: got {0} but expected {1}", s11.f3, 3+9); ++ return 3; ++ } ++ if (s11.f4 != 4+9) { ++ Console.WriteLine(" sbyte11 s11.f4: got {0} but expected {1}", s11.f4, 4+9); ++ return 4; ++ } ++ if (s11.f5 != 5+9) { ++ Console.WriteLine(" sbyte11 s11.f5: got {0} but expected {1}", s11.f5, 5+9); ++ return 5; ++ } ++ if (s11.f6 != 6+9) { ++ Console.WriteLine(" sbyte11 s11.f6: got {0} but expected {1}", s11.f6, 6+9); ++ return 6; ++ } ++ if (s11.f7 != 7+9) { ++ Console.WriteLine(" sbyte11 s11.f7: got {0} but expected {1}", s11.f7, 7+9); ++ return 7; ++ } ++ if (s11.f8 != 8+9) { ++ Console.WriteLine(" sbyte11 s11.f8: got {0} but expected {1}", s11.f8, 8+9); ++ return 8; ++ } ++ if (s11.f9 != 9+9) { ++ Console.WriteLine(" sbyte11 s11.f9: got {0} but expected {1}", s11.f9, 9+9); ++ return 9; ++ } ++ if (s11.f10 != 10+9) { ++ Console.WriteLine(" sbyte11 s11.f10: got {0} but expected {1}", s11.f10, 10+9); ++ return 10; ++ } ++ if (s11.f11 != 11+9) { ++ Console.WriteLine(" sbyte11 s11.f11: got {0} but expected {1}", s11.f11, 11+9); ++ return 11; ++ } + + sbyte12 s12; + s12.f1 = 1; +@@ -299,11 +520,55 @@ public class Test_sbyte { + s12.f10 = 10; + s12.f11 = 11; + s12.f12 = 12; +- sbyte retval12 = mono_return_sbyte12(s12, 9); +- if (retval12 != 2*9) { +- Console.WriteLine(" sbyte12 retval12: got {0} but expected {1}", retval12, 2*9); ++ s12 = mono_return_sbyte12(s12, 9); ++ if (s12.f1 != 1+9) { ++ Console.WriteLine(" sbyte12 s12.f1: got {0} but expected {1}", s12.f1, 1+9); + return 1; + } ++ if (s12.f2 != 2+9) { ++ Console.WriteLine(" sbyte12 s12.f2: got {0} but expected {1}", s12.f2, 2+9); ++ return 2; ++ } ++ if (s12.f3 != 3+9) { ++ Console.WriteLine(" sbyte12 s12.f3: got {0} but expected {1}", s12.f3, 3+9); ++ return 3; ++ } ++ if (s12.f4 != 4+9) { ++ Console.WriteLine(" sbyte12 s12.f4: got {0} but expected {1}", s12.f4, 4+9); ++ return 4; ++ } ++ if (s12.f5 != 5+9) { ++ Console.WriteLine(" sbyte12 s12.f5: got {0} but expected {1}", s12.f5, 5+9); ++ return 5; ++ } ++ if (s12.f6 != 6+9) { ++ Console.WriteLine(" sbyte12 s12.f6: got {0} but expected {1}", s12.f6, 6+9); ++ return 6; ++ } ++ if (s12.f7 != 7+9) { ++ Console.WriteLine(" sbyte12 s12.f7: got {0} but expected {1}", s12.f7, 7+9); ++ return 7; ++ } ++ if (s12.f8 != 8+9) { ++ Console.WriteLine(" sbyte12 s12.f8: got {0} but expected {1}", s12.f8, 8+9); ++ return 8; ++ } ++ if (s12.f9 != 9+9) { ++ Console.WriteLine(" sbyte12 s12.f9: got {0} but expected {1}", s12.f9, 9+9); ++ return 9; ++ } ++ if (s12.f10 != 10+9) { ++ Console.WriteLine(" sbyte12 s12.f10: got {0} but expected {1}", s12.f10, 10+9); ++ return 10; ++ } ++ if (s12.f11 != 11+9) { ++ Console.WriteLine(" sbyte12 s12.f11: got {0} but expected {1}", s12.f11, 11+9); ++ return 11; ++ } ++ if (s12.f12 != 12+9) { ++ Console.WriteLine(" sbyte12 s12.f12: got {0} but expected {1}", s12.f12, 12+9); ++ return 12; ++ } + + sbyte13 s13; + s13.f1 = 1; +@@ -319,11 +584,59 @@ public class Test_sbyte { + s13.f11 = 11; + s13.f12 = 12; + s13.f13 = 13; +- sbyte retval13 = mono_return_sbyte13(s13, 9); +- if (retval13 != 2*9) { +- Console.WriteLine(" sbyte13 retval13: got {0} but expected {1}", retval13, 2*9); ++ s13 = mono_return_sbyte13(s13, 9); ++ if (s13.f1 != 1+9) { ++ Console.WriteLine(" sbyte13 s13.f1: got {0} but expected {1}", s13.f1, 1+9); + return 1; + } ++ if (s13.f2 != 2+9) { ++ Console.WriteLine(" sbyte13 s13.f2: got {0} but expected {1}", s13.f2, 2+9); ++ return 2; ++ } ++ if (s13.f3 != 3+9) { ++ Console.WriteLine(" sbyte13 s13.f3: got {0} but expected {1}", s13.f3, 3+9); ++ return 3; ++ } ++ if (s13.f4 != 4+9) { ++ Console.WriteLine(" sbyte13 s13.f4: got {0} but expected {1}", s13.f4, 4+9); ++ return 4; ++ } ++ if (s13.f5 != 5+9) { ++ Console.WriteLine(" sbyte13 s13.f5: got {0} but expected {1}", s13.f5, 5+9); ++ return 5; ++ } ++ if (s13.f6 != 6+9) { ++ Console.WriteLine(" sbyte13 s13.f6: got {0} but expected {1}", s13.f6, 6+9); ++ return 6; ++ } ++ if (s13.f7 != 7+9) { ++ Console.WriteLine(" sbyte13 s13.f7: got {0} but expected {1}", s13.f7, 7+9); ++ return 7; ++ } ++ if (s13.f8 != 8+9) { ++ Console.WriteLine(" sbyte13 s13.f8: got {0} but expected {1}", s13.f8, 8+9); ++ return 8; ++ } ++ if (s13.f9 != 9+9) { ++ Console.WriteLine(" sbyte13 s13.f9: got {0} but expected {1}", s13.f9, 9+9); ++ return 9; ++ } ++ if (s13.f10 != 10+9) { ++ Console.WriteLine(" sbyte13 s13.f10: got {0} but expected {1}", s13.f10, 10+9); ++ return 10; ++ } ++ if (s13.f11 != 11+9) { ++ Console.WriteLine(" sbyte13 s13.f11: got {0} but expected {1}", s13.f11, 11+9); ++ return 11; ++ } ++ if (s13.f12 != 12+9) { ++ Console.WriteLine(" sbyte13 s13.f12: got {0} but expected {1}", s13.f12, 12+9); ++ return 12; ++ } ++ if (s13.f13 != 13+9) { ++ Console.WriteLine(" sbyte13 s13.f13: got {0} but expected {1}", s13.f13, 13+9); ++ return 13; ++ } + + sbyte14 s14; + s14.f1 = 1; +@@ -340,11 +653,63 @@ public class Test_sbyte { + s14.f12 = 12; + s14.f13 = 13; + s14.f14 = 14; +- sbyte retval14 = mono_return_sbyte14(s14, 9); +- if (retval14 != 2*9) { +- Console.WriteLine(" sbyte14 retval14: got {0} but expected {1}", retval14, 2*9); ++ s14 = mono_return_sbyte14(s14, 9); ++ if (s14.f1 != 1+9) { ++ Console.WriteLine(" sbyte14 s14.f1: got {0} but expected {1}", s14.f1, 1+9); + return 1; + } ++ if (s14.f2 != 2+9) { ++ Console.WriteLine(" sbyte14 s14.f2: got {0} but expected {1}", s14.f2, 2+9); ++ return 2; ++ } ++ if (s14.f3 != 3+9) { ++ Console.WriteLine(" sbyte14 s14.f3: got {0} but expected {1}", s14.f3, 3+9); ++ return 3; ++ } ++ if (s14.f4 != 4+9) { ++ Console.WriteLine(" sbyte14 s14.f4: got {0} but expected {1}", s14.f4, 4+9); ++ return 4; ++ } ++ if (s14.f5 != 5+9) { ++ Console.WriteLine(" sbyte14 s14.f5: got {0} but expected {1}", s14.f5, 5+9); ++ return 5; ++ } ++ if (s14.f6 != 6+9) { ++ Console.WriteLine(" sbyte14 s14.f6: got {0} but expected {1}", s14.f6, 6+9); ++ return 6; ++ } ++ if (s14.f7 != 7+9) { ++ Console.WriteLine(" sbyte14 s14.f7: got {0} but expected {1}", s14.f7, 7+9); ++ return 7; ++ } ++ if (s14.f8 != 8+9) { ++ Console.WriteLine(" sbyte14 s14.f8: got {0} but expected {1}", s14.f8, 8+9); ++ return 8; ++ } ++ if (s14.f9 != 9+9) { ++ Console.WriteLine(" sbyte14 s14.f9: got {0} but expected {1}", s14.f9, 9+9); ++ return 9; ++ } ++ if (s14.f10 != 10+9) { ++ Console.WriteLine(" sbyte14 s14.f10: got {0} but expected {1}", s14.f10, 10+9); ++ return 10; ++ } ++ if (s14.f11 != 11+9) { ++ Console.WriteLine(" sbyte14 s14.f11: got {0} but expected {1}", s14.f11, 11+9); ++ return 11; ++ } ++ if (s14.f12 != 12+9) { ++ Console.WriteLine(" sbyte14 s14.f12: got {0} but expected {1}", s14.f12, 12+9); ++ return 12; ++ } ++ if (s14.f13 != 13+9) { ++ Console.WriteLine(" sbyte14 s14.f13: got {0} but expected {1}", s14.f13, 13+9); ++ return 13; ++ } ++ if (s14.f14 != 14+9) { ++ Console.WriteLine(" sbyte14 s14.f14: got {0} but expected {1}", s14.f14, 14+9); ++ return 14; ++ } + + sbyte15 s15; + s15.f1 = 1; +@@ -362,11 +727,67 @@ public class Test_sbyte { + s15.f13 = 13; + s15.f14 = 14; + s15.f15 = 15; +- sbyte retval15 = mono_return_sbyte15(s15, 9); +- if (retval15 != 2*9) { +- Console.WriteLine(" sbyte15 retval15: got {0} but expected {1}", retval15, 2*9); ++ s15 = mono_return_sbyte15(s15, 9); ++ if (s15.f1 != 1+9) { ++ Console.WriteLine(" sbyte15 s15.f1: got {0} but expected {1}", s15.f1, 1+9); + return 1; + } ++ if (s15.f2 != 2+9) { ++ Console.WriteLine(" sbyte15 s15.f2: got {0} but expected {1}", s15.f2, 2+9); ++ return 2; ++ } ++ if (s15.f3 != 3+9) { ++ Console.WriteLine(" sbyte15 s15.f3: got {0} but expected {1}", s15.f3, 3+9); ++ return 3; ++ } ++ if (s15.f4 != 4+9) { ++ Console.WriteLine(" sbyte15 s15.f4: got {0} but expected {1}", s15.f4, 4+9); ++ return 4; ++ } ++ if (s15.f5 != 5+9) { ++ Console.WriteLine(" sbyte15 s15.f5: got {0} but expected {1}", s15.f5, 5+9); ++ return 5; ++ } ++ if (s15.f6 != 6+9) { ++ Console.WriteLine(" sbyte15 s15.f6: got {0} but expected {1}", s15.f6, 6+9); ++ return 6; ++ } ++ if (s15.f7 != 7+9) { ++ Console.WriteLine(" sbyte15 s15.f7: got {0} but expected {1}", s15.f7, 7+9); ++ return 7; ++ } ++ if (s15.f8 != 8+9) { ++ Console.WriteLine(" sbyte15 s15.f8: got {0} but expected {1}", s15.f8, 8+9); ++ return 8; ++ } ++ if (s15.f9 != 9+9) { ++ Console.WriteLine(" sbyte15 s15.f9: got {0} but expected {1}", s15.f9, 9+9); ++ return 9; ++ } ++ if (s15.f10 != 10+9) { ++ Console.WriteLine(" sbyte15 s15.f10: got {0} but expected {1}", s15.f10, 10+9); ++ return 10; ++ } ++ if (s15.f11 != 11+9) { ++ Console.WriteLine(" sbyte15 s15.f11: got {0} but expected {1}", s15.f11, 11+9); ++ return 11; ++ } ++ if (s15.f12 != 12+9) { ++ Console.WriteLine(" sbyte15 s15.f12: got {0} but expected {1}", s15.f12, 12+9); ++ return 12; ++ } ++ if (s15.f13 != 13+9) { ++ Console.WriteLine(" sbyte15 s15.f13: got {0} but expected {1}", s15.f13, 13+9); ++ return 13; ++ } ++ if (s15.f14 != 14+9) { ++ Console.WriteLine(" sbyte15 s15.f14: got {0} but expected {1}", s15.f14, 14+9); ++ return 14; ++ } ++ if (s15.f15 != 15+9) { ++ Console.WriteLine(" sbyte15 s15.f15: got {0} but expected {1}", s15.f15, 15+9); ++ return 15; ++ } + + sbyte16 s16; + s16.f1 = 1; +@@ -385,11 +806,71 @@ public class Test_sbyte { + s16.f14 = 14; + s16.f15 = 15; + s16.f16 = 16; +- sbyte retval16 = mono_return_sbyte16(s16, 9); +- if (retval16 != 2*9) { +- Console.WriteLine(" sbyte16 retval16: got {0} but expected {1}", retval16, 2*9); ++ s16 = mono_return_sbyte16(s16, 9); ++ if (s16.f1 != 1+9) { ++ Console.WriteLine(" sbyte16 s16.f1: got {0} but expected {1}", s16.f1, 1+9); + return 1; + } ++ if (s16.f2 != 2+9) { ++ Console.WriteLine(" sbyte16 s16.f2: got {0} but expected {1}", s16.f2, 2+9); ++ return 2; ++ } ++ if (s16.f3 != 3+9) { ++ Console.WriteLine(" sbyte16 s16.f3: got {0} but expected {1}", s16.f3, 3+9); ++ return 3; ++ } ++ if (s16.f4 != 4+9) { ++ Console.WriteLine(" sbyte16 s16.f4: got {0} but expected {1}", s16.f4, 4+9); ++ return 4; ++ } ++ if (s16.f5 != 5+9) { ++ Console.WriteLine(" sbyte16 s16.f5: got {0} but expected {1}", s16.f5, 5+9); ++ return 5; ++ } ++ if (s16.f6 != 6+9) { ++ Console.WriteLine(" sbyte16 s16.f6: got {0} but expected {1}", s16.f6, 6+9); ++ return 6; ++ } ++ if (s16.f7 != 7+9) { ++ Console.WriteLine(" sbyte16 s16.f7: got {0} but expected {1}", s16.f7, 7+9); ++ return 7; ++ } ++ if (s16.f8 != 8+9) { ++ Console.WriteLine(" sbyte16 s16.f8: got {0} but expected {1}", s16.f8, 8+9); ++ return 8; ++ } ++ if (s16.f9 != 9+9) { ++ Console.WriteLine(" sbyte16 s16.f9: got {0} but expected {1}", s16.f9, 9+9); ++ return 9; ++ } ++ if (s16.f10 != 10+9) { ++ Console.WriteLine(" sbyte16 s16.f10: got {0} but expected {1}", s16.f10, 10+9); ++ return 10; ++ } ++ if (s16.f11 != 11+9) { ++ Console.WriteLine(" sbyte16 s16.f11: got {0} but expected {1}", s16.f11, 11+9); ++ return 11; ++ } ++ if (s16.f12 != 12+9) { ++ Console.WriteLine(" sbyte16 s16.f12: got {0} but expected {1}", s16.f12, 12+9); ++ return 12; ++ } ++ if (s16.f13 != 13+9) { ++ Console.WriteLine(" sbyte16 s16.f13: got {0} but expected {1}", s16.f13, 13+9); ++ return 13; ++ } ++ if (s16.f14 != 14+9) { ++ Console.WriteLine(" sbyte16 s16.f14: got {0} but expected {1}", s16.f14, 14+9); ++ return 14; ++ } ++ if (s16.f15 != 15+9) { ++ Console.WriteLine(" sbyte16 s16.f15: got {0} but expected {1}", s16.f15, 15+9); ++ return 15; ++ } ++ if (s16.f16 != 16+9) { ++ Console.WriteLine(" sbyte16 s16.f16: got {0} but expected {1}", s16.f16, 16+9); ++ return 16; ++ } + + sbyte17 s17; + s17.f1 = 1; +@@ -409,18 +890,161 @@ public class Test_sbyte { + s17.f15 = 15; + s17.f16 = 16; + s17.f17 = 17; +- sbyte retval17 = mono_return_sbyte17(s17, 9); +- if (retval17 != 2*9) { +- Console.WriteLine(" sbyte17 retval17: got {0} but expected {1}", retval17, 2*9); ++ s17 = mono_return_sbyte17(s17, 9); ++ if (s17.f1 != 1+9) { ++ Console.WriteLine(" sbyte17 s17.f1: got {0} but expected {1}", s17.f1, 1+9); + return 1; + } ++ if (s17.f2 != 2+9) { ++ Console.WriteLine(" sbyte17 s17.f2: got {0} but expected {1}", s17.f2, 2+9); ++ return 2; ++ } ++ if (s17.f3 != 3+9) { ++ Console.WriteLine(" sbyte17 s17.f3: got {0} but expected {1}", s17.f3, 3+9); ++ return 3; ++ } ++ if (s17.f4 != 4+9) { ++ Console.WriteLine(" sbyte17 s17.f4: got {0} but expected {1}", s17.f4, 4+9); ++ return 4; ++ } ++ if (s17.f5 != 5+9) { ++ Console.WriteLine(" sbyte17 s17.f5: got {0} but expected {1}", s17.f5, 5+9); ++ return 5; ++ } ++ if (s17.f6 != 6+9) { ++ Console.WriteLine(" sbyte17 s17.f6: got {0} but expected {1}", s17.f6, 6+9); ++ return 6; ++ } ++ if (s17.f7 != 7+9) { ++ Console.WriteLine(" sbyte17 s17.f7: got {0} but expected {1}", s17.f7, 7+9); ++ return 7; ++ } ++ if (s17.f8 != 8+9) { ++ Console.WriteLine(" sbyte17 s17.f8: got {0} but expected {1}", s17.f8, 8+9); ++ return 8; ++ } ++ if (s17.f9 != 9+9) { ++ Console.WriteLine(" sbyte17 s17.f9: got {0} but expected {1}", s17.f9, 9+9); ++ return 9; ++ } ++ if (s17.f10 != 10+9) { ++ Console.WriteLine(" sbyte17 s17.f10: got {0} but expected {1}", s17.f10, 10+9); ++ return 10; ++ } ++ if (s17.f11 != 11+9) { ++ Console.WriteLine(" sbyte17 s17.f11: got {0} but expected {1}", s17.f11, 11+9); ++ return 11; ++ } ++ if (s17.f12 != 12+9) { ++ Console.WriteLine(" sbyte17 s17.f12: got {0} but expected {1}", s17.f12, 12+9); ++ return 12; ++ } ++ if (s17.f13 != 13+9) { ++ Console.WriteLine(" sbyte17 s17.f13: got {0} but expected {1}", s17.f13, 13+9); ++ return 13; ++ } ++ if (s17.f14 != 14+9) { ++ Console.WriteLine(" sbyte17 s17.f14: got {0} but expected {1}", s17.f14, 14+9); ++ return 14; ++ } ++ if (s17.f15 != 15+9) { ++ Console.WriteLine(" sbyte17 s17.f15: got {0} but expected {1}", s17.f15, 15+9); ++ return 15; ++ } ++ if (s17.f16 != 16+9) { ++ Console.WriteLine(" sbyte17 s17.f16: got {0} but expected {1}", s17.f16, 16+9); ++ return 16; ++ } ++ if (s17.f17 != 17+9) { ++ Console.WriteLine(" sbyte17 s17.f17: got {0} but expected {1}", s17.f17, 17+9); ++ return 17; ++ } + + ++ sbyte16_nested sn16; ++ sn16.nested1.f1 = 1; ++ sn16.f2 = 2; ++ sn16.f3 = 3; ++ sn16.f4 = 4; ++ sn16.f5 = 5; ++ sn16.f6 = 6; ++ sn16.f7 = 7; ++ sn16.f8 = 8; ++ sn16.f9 = 9; ++ sn16.f10 = 10; ++ sn16.f11 = 11; ++ sn16.f12 = 12; ++ sn16.f13 = 13; ++ sn16.f14 = 14; ++ sn16.f15 = 15; ++ sn16.nested2.f16 = 16; ++ sn16 = mono_return_sbyte16_nested(sn16, 9); ++ if (sn16.nested1.f1 != 1+9) { ++ Console.WriteLine(" sbyte16_nested sn16.nested1.f1: got {0} but expected {1}", sn16.nested1.f1, 1+9); ++ return 1; ++ } ++ if (sn16.f2 != 2+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f2: got {0} but expected {1}", sn16.f2, 2+9); ++ return 2; ++ } ++ if (sn16.f3 != 3+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f3: got {0} but expected {1}", sn16.f3, 3+9); ++ return 3; ++ } ++ if (sn16.f4 != 4+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f4: got {0} but expected {1}", sn16.f4, 4+9); ++ return 4; ++ } ++ if (sn16.f5 != 5+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f5: got {0} but expected {1}", sn16.f5, 5+9); ++ return 5; ++ } ++ if (sn16.f6 != 6+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f6: got {0} but expected {1}", sn16.f6, 6+9); ++ return 6; ++ } ++ if (sn16.f7 != 7+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f7: got {0} but expected {1}", sn16.f7, 7+9); ++ return 7; ++ } ++ if (sn16.f8 != 8+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f8: got {0} but expected {1}", sn16.f8, 8+9); ++ return 8; ++ } ++ if (sn16.f9 != 9+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f9: got {0} but expected {1}", sn16.f9, 9+9); ++ return 9; ++ } ++ if (sn16.f10 != 10+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f10: got {0} but expected {1}", sn16.f10, 10+9); ++ return 10; ++ } ++ if (sn16.f11 != 11+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f11: got {0} but expected {1}", sn16.f11, 11+9); ++ return 11; ++ } ++ if (sn16.f12 != 12+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f12: got {0} but expected {1}", sn16.f12, 12+9); ++ return 12; ++ } ++ if (sn16.f13 != 13+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f13: got {0} but expected {1}", sn16.f13, 13+9); ++ return 13; ++ } ++ if (sn16.f14 != 14+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f14: got {0} but expected {1}", sn16.f14, 14+9); ++ return 14; ++ } ++ if (sn16.f15 != 15+9) { ++ Console.WriteLine(" sbyte16_nested sn16.f15: got {0} but expected {1}", sn16.f15, 15+9); ++ return 15; ++ } ++ if (sn16.nested2.f16 != 16+9) { ++ Console.WriteLine(" sbyte16_nested sn16.nested2.f16: got {0} but expected {1}", sn16.nested2.f16, 16+9); ++ return 16; ++ } ++ + return 0; + } // end Main + } // end class Test_sbyte + +- +- +- +- +Index: mono-4.2.1/mono/tests/pinvoke_ppcd.cs +=================================================================== +--- mono-4.2.1.orig/mono/tests/pinvoke_ppcd.cs ++++ mono-4.2.1/mono/tests/pinvoke_ppcd.cs +@@ -20,13 +20,13 @@ using System.Runtime.InteropServices; + public class Test_double { + + [DllImport ("libtest", EntryPoint="mono_return_double1")] +- public static extern double mono_return_double1 (double1 s, int addend); ++ public static extern double1 mono_return_double1 (double1 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct double1 { + public double f1; + } + [DllImport ("libtest", EntryPoint="mono_return_double2")] +- public static extern double mono_return_double2 (double2 s, int addend); ++ public static extern double2 mono_return_double2 (double2 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct double2 { + public double f1,f2; +@@ -34,37 +34,37 @@ public class Test_double { + // This structure is 1 element too large to use the special return + // rules. + [DllImport ("libtest", EntryPoint="mono_return_double3")] +- public static extern double mono_return_double3 (double3 s, int addend); ++ public static extern double3 mono_return_double3 (double3 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct double3 { + public double f1,f2,f3; + } + [DllImport ("libtest", EntryPoint="mono_return_double4")] +- public static extern double mono_return_double4 (double4 s, int addend); ++ public static extern double4 mono_return_double4 (double4 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct double4 { + public double f1,f2,f3,f4; + } + [DllImport ("libtest", EntryPoint="mono_return_double5")] +- public static extern double mono_return_double5 (double5 s, int addend); ++ public static extern double5 mono_return_double5 (double5 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct double5 { + public double f1,f2,f3,f4,f5; + } + [DllImport ("libtest", EntryPoint="mono_return_double6")] +- public static extern double mono_return_double6 (double6 s, int addend); ++ public static extern double6 mono_return_double6 (double6 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct double6 { + public double f1,f2,f3,f4,f5,f6; + } + [DllImport ("libtest", EntryPoint="mono_return_double7")] +- public static extern double mono_return_double7 (double7 s, int addend); ++ public static extern double7 mono_return_double7 (double7 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct double7 { + public double f1,f2,f3,f4,f5,f6,f7; + } + [DllImport ("libtest", EntryPoint="mono_return_double8")] +- public static extern double mono_return_double8 (double8 s, int addend); ++ public static extern double8 mono_return_double8 (double8 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct double8 { + public double f1,f2,f3,f4,f5,f6,f7,f8; +@@ -72,7 +72,7 @@ public class Test_double { + // This structure is 1 element too large to use the special parameter + // passing rules. + [DllImport ("libtest", EntryPoint="mono_return_double9")] +- public static extern double mono_return_double9 (double9 s, int addend); ++ public static extern double9 mono_return_double9 (double9 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct double9 { + public double f1,f2,f3,f4,f5,f6,f7,f8,f9; +@@ -94,45 +94,76 @@ public class Test_double { + public double2_nested2 nested2; + } + +- public static int Main (string[] args) { ++ [DllImport ("libtest", EntryPoint="mono_return_double_array4")] ++ public static extern double_array4 mono_return_double_array4 (double_array4 s, int addend); ++ [StructLayout(LayoutKind.Sequential)] ++ public unsafe struct double_array4 { ++ public fixed double f1[4]; ++ } ++ + ++ public static int Main (string[] args) { + double1 s1; + s1.f1 = 1; +- double retval1 = mono_return_double1(s1, 9); +- if (retval1 != 2*9) { +- Console.WriteLine(" double1 retval1: got {0} but expected {1}", retval1, 2*9); ++ s1 = mono_return_double1(s1, 9); ++ if (s1.f1 != 1+9) { ++ Console.WriteLine(" double1 s1.f1: got {0} but expected {1}", s1.f1, 1+9); + return 1; + } + + double2 s2; + s2.f1 = 1; + s2.f2 = 2; +- double retval2 = mono_return_double2(s2, 9); +- if (retval2 != 2*9) { +- Console.WriteLine(" double2 retval2: got {0} but expected {1}", retval2, 2*9); ++ s2 = mono_return_double2(s2, 9); ++ if (s2.f1 != 1+9) { ++ Console.WriteLine(" double2 s2.f1: got {0} but expected {1}", s2.f1, 1+9); + return 1; + } ++ if (s2.f2 != 2+9) { ++ Console.WriteLine(" double2 s2.f2: got {0} but expected {1}", s2.f2, 2+9); ++ return 2; ++ } + + double3 s3; + s3.f1 = 1; + s3.f2 = 2; + s3.f3 = 3; +- double retval3 = mono_return_double3(s3, 9); +- if (retval3 != 2*9) { +- Console.WriteLine(" double3 retval3: got {0} but expected {1}", retval3, 2*9); ++ s3 = mono_return_double3(s3, 9); ++ if (s3.f1 != 1+9) { ++ Console.WriteLine(" double3 s3.f1: got {0} but expected {1}", s3.f1, 1+9); + return 1; + } ++ if (s3.f2 != 2+9) { ++ Console.WriteLine(" double3 s3.f2: got {0} but expected {1}", s3.f2, 2+9); ++ return 2; ++ } ++ if (s3.f3 != 3+9) { ++ Console.WriteLine(" double3 s3.f3: got {0} but expected {1}", s3.f3, 3+9); ++ return 3; ++ } + + double4 s4; + s4.f1 = 1; + s4.f2 = 2; + s4.f3 = 3; + s4.f4 = 4; +- double retval4 = mono_return_double4(s4, 9); +- if (retval4 != 2*9) { +- Console.WriteLine(" double4 retval4: got {0} but expected {1}", retval4, 2*9); ++ s4 = mono_return_double4(s4, 9); ++ if (s4.f1 != 1+9) { ++ Console.WriteLine(" double4 s4.f1: got {0} but expected {1}", s4.f1, 1+9); + return 1; + } ++ if (s4.f2 != 2+9) { ++ Console.WriteLine(" double4 s4.f2: got {0} but expected {1}", s4.f2, 2+9); ++ return 2; ++ } ++ if (s4.f3 != 3+9) { ++ Console.WriteLine(" double4 s4.f3: got {0} but expected {1}", s4.f3, 3+9); ++ return 3; ++ } ++ if (s4.f4 != 4+9) { ++ Console.WriteLine(" double4 s4.f4: got {0} but expected {1}", s4.f4, 4+9); ++ return 4; ++ } + + double5 s5; + s5.f1 = 1; +@@ -140,11 +171,27 @@ public class Test_double { + s5.f3 = 3; + s5.f4 = 4; + s5.f5 = 5; +- double retval5 = mono_return_double5(s5, 9); +- if (retval5 != 2*9) { +- Console.WriteLine(" double5 retval5: got {0} but expected {1}", retval5, 2*9); ++ s5 = mono_return_double5(s5, 9); ++ if (s5.f1 != 1+9) { ++ Console.WriteLine(" double5 s5.f1: got {0} but expected {1}", s5.f1, 1+9); + return 1; + } ++ if (s5.f2 != 2+9) { ++ Console.WriteLine(" double5 s5.f2: got {0} but expected {1}", s5.f2, 2+9); ++ return 2; ++ } ++ if (s5.f3 != 3+9) { ++ Console.WriteLine(" double5 s5.f3: got {0} but expected {1}", s5.f3, 3+9); ++ return 3; ++ } ++ if (s5.f4 != 4+9) { ++ Console.WriteLine(" double5 s5.f4: got {0} but expected {1}", s5.f4, 4+9); ++ return 4; ++ } ++ if (s5.f5 != 5+9) { ++ Console.WriteLine(" double5 s5.f5: got {0} but expected {1}", s5.f5, 5+9); ++ return 5; ++ } + + double6 s6; + s6.f1 = 1; +@@ -153,11 +200,31 @@ public class Test_double { + s6.f4 = 4; + s6.f5 = 5; + s6.f6 = 6; +- double retval6 = mono_return_double6(s6, 9); +- if (retval6 != 2*9) { +- Console.WriteLine(" double6 retval6: got {0} but expected {1}", retval6, 2*9); ++ s6 = mono_return_double6(s6, 9); ++ if (s6.f1 != 1+9) { ++ Console.WriteLine(" double6 s6.f1: got {0} but expected {1}", s6.f1, 1+9); + return 1; + } ++ if (s6.f2 != 2+9) { ++ Console.WriteLine(" double6 s6.f2: got {0} but expected {1}", s6.f2, 2+9); ++ return 2; ++ } ++ if (s6.f3 != 3+9) { ++ Console.WriteLine(" double6 s6.f3: got {0} but expected {1}", s6.f3, 3+9); ++ return 3; ++ } ++ if (s6.f4 != 4+9) { ++ Console.WriteLine(" double6 s6.f4: got {0} but expected {1}", s6.f4, 4+9); ++ return 4; ++ } ++ if (s6.f5 != 5+9) { ++ Console.WriteLine(" double6 s6.f5: got {0} but expected {1}", s6.f5, 5+9); ++ return 5; ++ } ++ if (s6.f6 != 6+9) { ++ Console.WriteLine(" double6 s6.f6: got {0} but expected {1}", s6.f6, 6+9); ++ return 6; ++ } + + double7 s7; + s7.f1 = 1; +@@ -167,11 +234,35 @@ public class Test_double { + s7.f5 = 5; + s7.f6 = 6; + s7.f7 = 7; +- double retval7 = mono_return_double7(s7, 9); +- if (retval7 != 2*9) { +- Console.WriteLine(" double7 retval7: got {0} but expected {1}", retval7, 2*9); ++ s7 = mono_return_double7(s7, 9); ++ if (s7.f1 != 1+9) { ++ Console.WriteLine(" double7 s7.f1: got {0} but expected {1}", s7.f1, 1+9); + return 1; + } ++ if (s7.f2 != 2+9) { ++ Console.WriteLine(" double7 s7.f2: got {0} but expected {1}", s7.f2, 2+9); ++ return 2; ++ } ++ if (s7.f3 != 3+9) { ++ Console.WriteLine(" double7 s7.f3: got {0} but expected {1}", s7.f3, 3+9); ++ return 3; ++ } ++ if (s7.f4 != 4+9) { ++ Console.WriteLine(" double7 s7.f4: got {0} but expected {1}", s7.f4, 4+9); ++ return 4; ++ } ++ if (s7.f5 != 5+9) { ++ Console.WriteLine(" double7 s7.f5: got {0} but expected {1}", s7.f5, 5+9); ++ return 5; ++ } ++ if (s7.f6 != 6+9) { ++ Console.WriteLine(" double7 s7.f6: got {0} but expected {1}", s7.f6, 6+9); ++ return 6; ++ } ++ if (s7.f7 != 7+9) { ++ Console.WriteLine(" double7 s7.f7: got {0} but expected {1}", s7.f7, 7+9); ++ return 7; ++ } + + double8 s8; + s8.f1 = 1; +@@ -182,11 +273,39 @@ public class Test_double { + s8.f6 = 6; + s8.f7 = 7; + s8.f8 = 8; +- double retval8 = mono_return_double8(s8, 9); +- if (retval8 != 2*9) { +- Console.WriteLine(" double8 retval8: got {0} but expected {1}", retval8, 2*9); ++ s8 = mono_return_double8(s8, 9); ++ if (s8.f1 != 1+9) { ++ Console.WriteLine(" double8 s8.f1: got {0} but expected {1}", s8.f1, 1+9); + return 1; + } ++ if (s8.f2 != 2+9) { ++ Console.WriteLine(" double8 s8.f2: got {0} but expected {1}", s8.f2, 2+9); ++ return 2; ++ } ++ if (s8.f3 != 3+9) { ++ Console.WriteLine(" double8 s8.f3: got {0} but expected {1}", s8.f3, 3+9); ++ return 3; ++ } ++ if (s8.f4 != 4+9) { ++ Console.WriteLine(" double8 s8.f4: got {0} but expected {1}", s8.f4, 4+9); ++ return 4; ++ } ++ if (s8.f5 != 5+9) { ++ Console.WriteLine(" double8 s8.f5: got {0} but expected {1}", s8.f5, 5+9); ++ return 5; ++ } ++ if (s8.f6 != 6+9) { ++ Console.WriteLine(" double8 s8.f6: got {0} but expected {1}", s8.f6, 6+9); ++ return 6; ++ } ++ if (s8.f7 != 7+9) { ++ Console.WriteLine(" double8 s8.f7: got {0} but expected {1}", s8.f7, 7+9); ++ return 7; ++ } ++ if (s8.f8 != 8+9) { ++ Console.WriteLine(" double8 s8.f8: got {0} but expected {1}", s8.f8, 8+9); ++ return 8; ++ } + + double9 s9; + s9.f1 = 1; +@@ -198,18 +317,86 @@ public class Test_double { + s9.f7 = 7; + s9.f8 = 8; + s9.f9 = 9; +- double retval9 = mono_return_double9(s9, 9); +- if (retval9 != 2*9) { +- Console.WriteLine(" double9 retval9: got {0} but expected {1}", retval9, 2*9); ++ s9 = mono_return_double9(s9, 9); ++ if (s9.f1 != 1+9) { ++ Console.WriteLine(" double9 s9.f1: got {0} but expected {1}", s9.f1, 1+9); ++ return 1; ++ } ++ if (s9.f2 != 2+9) { ++ Console.WriteLine(" double9 s9.f2: got {0} but expected {1}", s9.f2, 2+9); ++ return 2; ++ } ++ if (s9.f3 != 3+9) { ++ Console.WriteLine(" double9 s9.f3: got {0} but expected {1}", s9.f3, 3+9); ++ return 3; ++ } ++ if (s9.f4 != 4+9) { ++ Console.WriteLine(" double9 s9.f4: got {0} but expected {1}", s9.f4, 4+9); ++ return 4; ++ } ++ if (s9.f5 != 5+9) { ++ Console.WriteLine(" double9 s9.f5: got {0} but expected {1}", s9.f5, 5+9); ++ return 5; ++ } ++ if (s9.f6 != 6+9) { ++ Console.WriteLine(" double9 s9.f6: got {0} but expected {1}", s9.f6, 6+9); ++ return 6; ++ } ++ if (s9.f7 != 7+9) { ++ Console.WriteLine(" double9 s9.f7: got {0} but expected {1}", s9.f7, 7+9); ++ return 7; ++ } ++ if (s9.f8 != 8+9) { ++ Console.WriteLine(" double9 s9.f8: got {0} but expected {1}", s9.f8, 8+9); ++ return 8; ++ } ++ if (s9.f9 != 9+9) { ++ Console.WriteLine(" double9 s9.f9: got {0} but expected {1}", s9.f9, 9+9); ++ return 9; ++ } ++ ++ ++ double2_nested sn2; ++ sn2.nested1.f1 = 1; ++ sn2.nested2.f2 = 2; ++ sn2 = mono_return_double2_nested(sn2, 9); ++ if (sn2.nested1.f1 != 1+9) { ++ Console.WriteLine(" double2_nested sn2.nested1.f1: got {0} but expected {1}", sn2.nested1.f1, 1+9); + return 1; + } ++ if (sn2.nested2.f2 != 2+9) { ++ Console.WriteLine(" double2_nested sn2.nested2.f2: got {0} but expected {1}", sn2.nested2.f2, 2+9); ++ return 2; ++ } + ++/* ++// NOTE: this test does not work properly because mini_type_is_hfa in mini-codegen.c does not handle arrays. ++// Uncomment this when mini_type_is_hfa is fixed. ++ unsafe { ++ double_array4 sa4; ++ sa4.f1[0] = 1; ++ sa4.f1[1] = 2; ++ sa4 = mono_return_double_array4(sa4, 9); ++ if (sa4.f1[0] != 1+9) { ++ Console.WriteLine(" double_array4 sa4.f1[0]: got {0} but expected {1}", sa4.f1[0], 1+9); ++ return 1; ++ } ++ if (sa4.f1[1] != 2+9) { ++ Console.WriteLine(" double_array4 sa4.f1[1]: got {0} but expected {1}", sa4.f1[1], 2+9); ++ return 2; ++ } ++ if (sa4.f1[2] != 3+9) { ++ Console.WriteLine(" double_array4 sa4.f1[2]: got {0} but expected {1}", sa4.f1[2], 3+9); ++ return 3; ++ } ++ if (sa4.f1[3] != 4+9) { ++ Console.WriteLine(" double_array4 sa4.f1[3]: got {0} but expected {1}", sa4.f1[3], 4+9); ++ return 4; ++ } ++ } ++*/ + + return 0; + } // end Main + } // end class Test_double + +- +- +- +- +Index: mono-4.2.1/mono/tests/pinvoke_ppcf.cs +=================================================================== +--- mono-4.2.1.orig/mono/tests/pinvoke_ppcf.cs ++++ mono-4.2.1/mono/tests/pinvoke_ppcf.cs +@@ -20,25 +20,25 @@ using System.Runtime.InteropServices; + public class Test_float { + + [DllImport ("libtest", EntryPoint="mono_return_float1")] +- public static extern float mono_return_float1 (float1 s, int addend); ++ public static extern float1 mono_return_float1 (float1 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct float1 { + public float f1; + } + [DllImport ("libtest", EntryPoint="mono_return_float2")] +- public static extern float mono_return_float2 (float2 s, int addend); ++ public static extern float2 mono_return_float2 (float2 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct float2 { + public float f1,f2; + } + [DllImport ("libtest", EntryPoint="mono_return_float3")] +- public static extern float mono_return_float3 (float3 s, int addend); ++ public static extern float3 mono_return_float3 (float3 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct float3 { + public float f1,f2,f3; + } + [DllImport ("libtest", EntryPoint="mono_return_float4")] +- public static extern float mono_return_float4 (float4 s, int addend); ++ public static extern float4 mono_return_float4 (float4 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct float4 { + public float f1,f2,f3,f4; +@@ -46,25 +46,25 @@ public class Test_float { + // This structure is 1 element too large to use the special return + // rules. + [DllImport ("libtest", EntryPoint="mono_return_float5")] +- public static extern float mono_return_float5 (float5 s, int addend); ++ public static extern float5 mono_return_float5 (float5 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct float5 { + public float f1,f2,f3,f4,f5; + } + [DllImport ("libtest", EntryPoint="mono_return_float6")] +- public static extern float mono_return_float6 (float6 s, int addend); ++ public static extern float6 mono_return_float6 (float6 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct float6 { + public float f1,f2,f3,f4,f5,f6; + } + [DllImport ("libtest", EntryPoint="mono_return_float7")] +- public static extern float mono_return_float7 (float7 s, int addend); ++ public static extern float7 mono_return_float7 (float7 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct float7 { + public float f1,f2,f3,f4,f5,f6,f7; + } + [DllImport ("libtest", EntryPoint="mono_return_float8")] +- public static extern float mono_return_float8 (float8 s, int addend); ++ public static extern float8 mono_return_float8 (float8 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct float8 { + public float f1,f2,f3,f4,f5,f6,f7,f8; +@@ -72,7 +72,7 @@ public class Test_float { + // This structure is 1 element too large to use the special parameter + // passing rules. + [DllImport ("libtest", EntryPoint="mono_return_float9")] +- public static extern float mono_return_float9 (float9 s, int addend); ++ public static extern float9 mono_return_float9 (float9 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct float9 { + public float f1,f2,f3,f4,f5,f6,f7,f8,f9; +@@ -99,41 +99,65 @@ public class Test_float { + + float1 s1; + s1.f1 = 1; +- float retval1 = mono_return_float1(s1, 906); +- if (retval1 != 2*906) { +- Console.WriteLine(" float1 retval1: got {0} but expected {1}", retval1, 2*906); ++ s1 = mono_return_float1(s1, 906); ++ if (s1.f1 != 1+906) { ++ Console.WriteLine(" float1 s1.f1: got {0} but expected {1}", s1.f1, 1+906); + return 1; + } + + float2 s2; + s2.f1 = 1; + s2.f2 = 2; +- float retval2 = mono_return_float2(s2, 906); +- if (retval2 != 2*906) { +- Console.WriteLine(" float2 retval2: got {0} but expected {1}", retval2, 2*906); ++ s2 = mono_return_float2(s2, 906); ++ if (s2.f1 != 1+906) { ++ Console.WriteLine(" float2 s2.f1: got {0} but expected {1}", s2.f1, 1+906); + return 1; + } ++ if (s2.f2 != 2+906) { ++ Console.WriteLine(" float2 s2.f2: got {0} but expected {1}", s2.f2, 2+906); ++ return 2; ++ } + + float3 s3; + s3.f1 = 1; + s3.f2 = 2; + s3.f3 = 3; +- float retval3 = mono_return_float3(s3, 906); +- if (retval3 != 2*906) { +- Console.WriteLine(" float3 retval3: got {0} but expected {1}", retval3, 2*906); ++ s3 = mono_return_float3(s3, 906); ++ if (s3.f1 != 1+906) { ++ Console.WriteLine(" float3 s3.f1: got {0} but expected {1}", s3.f1, 1+906); + return 1; + } ++ if (s3.f2 != 2+906) { ++ Console.WriteLine(" float3 s3.f2: got {0} but expected {1}", s3.f2, 2+906); ++ return 2; ++ } ++ if (s3.f3 != 3+906) { ++ Console.WriteLine(" float3 s3.f3: got {0} but expected {1}", s3.f3, 3+906); ++ return 3; ++ } + + float4 s4; + s4.f1 = 1; + s4.f2 = 2; + s4.f3 = 3; + s4.f4 = 4; +- float retval4 = mono_return_float4(s4, 906); +- if (retval4 != 2*906) { +- Console.WriteLine(" float4 retval4: got {0} but expected {1}", retval4, 2*906); ++ s4 = mono_return_float4(s4, 906); ++ if (s4.f1 != 1+906) { ++ Console.WriteLine(" float4 s4.f1: got {0} but expected {1}", s4.f1, 1+906); + return 1; + } ++ if (s4.f2 != 2+906) { ++ Console.WriteLine(" float4 s4.f2: got {0} but expected {1}", s4.f2, 2+906); ++ return 2; ++ } ++ if (s4.f3 != 3+906) { ++ Console.WriteLine(" float4 s4.f3: got {0} but expected {1}", s4.f3, 3+906); ++ return 3; ++ } ++ if (s4.f4 != 4+906) { ++ Console.WriteLine(" float4 s4.f4: got {0} but expected {1}", s4.f4, 4+906); ++ return 4; ++ } + + float5 s5; + s5.f1 = 1; +@@ -141,11 +165,27 @@ public class Test_float { + s5.f3 = 3; + s5.f4 = 4; + s5.f5 = 5; +- float retval5 = mono_return_float5(s5, 906); +- if (retval5 != 2*906) { +- Console.WriteLine(" float5 retval5: got {0} but expected {1}", retval5, 2*906); ++ s5 = mono_return_float5(s5, 906); ++ if (s5.f1 != 1+906) { ++ Console.WriteLine(" float5 s5.f1: got {0} but expected {1}", s5.f1, 1+906); + return 1; + } ++ if (s5.f2 != 2+906) { ++ Console.WriteLine(" float5 s5.f2: got {0} but expected {1}", s5.f2, 2+906); ++ return 2; ++ } ++ if (s5.f3 != 3+906) { ++ Console.WriteLine(" float5 s5.f3: got {0} but expected {1}", s5.f3, 3+906); ++ return 3; ++ } ++ if (s5.f4 != 4+906) { ++ Console.WriteLine(" float5 s5.f4: got {0} but expected {1}", s5.f4, 4+906); ++ return 4; ++ } ++ if (s5.f5 != 5+906) { ++ Console.WriteLine(" float5 s5.f5: got {0} but expected {1}", s5.f5, 5+906); ++ return 5; ++ } + + float6 s6; + s6.f1 = 1; +@@ -154,11 +194,31 @@ public class Test_float { + s6.f4 = 4; + s6.f5 = 5; + s6.f6 = 6; +- float retval6 = mono_return_float6(s6, 906); +- if (retval6 != 2*906) { +- Console.WriteLine(" float6 retval6: got {0} but expected {1}", retval6, 2*906); ++ s6 = mono_return_float6(s6, 906); ++ if (s6.f1 != 1+906) { ++ Console.WriteLine(" float6 s6.f1: got {0} but expected {1}", s6.f1, 1+906); + return 1; + } ++ if (s6.f2 != 2+906) { ++ Console.WriteLine(" float6 s6.f2: got {0} but expected {1}", s6.f2, 2+906); ++ return 2; ++ } ++ if (s6.f3 != 3+906) { ++ Console.WriteLine(" float6 s6.f3: got {0} but expected {1}", s6.f3, 3+906); ++ return 3; ++ } ++ if (s6.f4 != 4+906) { ++ Console.WriteLine(" float6 s6.f4: got {0} but expected {1}", s6.f4, 4+906); ++ return 4; ++ } ++ if (s6.f5 != 5+906) { ++ Console.WriteLine(" float6 s6.f5: got {0} but expected {1}", s6.f5, 5+906); ++ return 5; ++ } ++ if (s6.f6 != 6+906) { ++ Console.WriteLine(" float6 s6.f6: got {0} but expected {1}", s6.f6, 6+906); ++ return 6; ++ } + + float7 s7; + s7.f1 = 1; +@@ -168,11 +228,35 @@ public class Test_float { + s7.f5 = 5; + s7.f6 = 6; + s7.f7 = 7; +- float retval7 = mono_return_float7(s7, 906); +- if (retval7 != 2*906) { +- Console.WriteLine(" float7 retval7: got {0} but expected {1}", retval7, 2*906); ++ s7 = mono_return_float7(s7, 906); ++ if (s7.f1 != 1+906) { ++ Console.WriteLine(" float7 s7.f1: got {0} but expected {1}", s7.f1, 1+906); + return 1; + } ++ if (s7.f2 != 2+906) { ++ Console.WriteLine(" float7 s7.f2: got {0} but expected {1}", s7.f2, 2+906); ++ return 2; ++ } ++ if (s7.f3 != 3+906) { ++ Console.WriteLine(" float7 s7.f3: got {0} but expected {1}", s7.f3, 3+906); ++ return 3; ++ } ++ if (s7.f4 != 4+906) { ++ Console.WriteLine(" float7 s7.f4: got {0} but expected {1}", s7.f4, 4+906); ++ return 4; ++ } ++ if (s7.f5 != 5+906) { ++ Console.WriteLine(" float7 s7.f5: got {0} but expected {1}", s7.f5, 5+906); ++ return 5; ++ } ++ if (s7.f6 != 6+906) { ++ Console.WriteLine(" float7 s7.f6: got {0} but expected {1}", s7.f6, 6+906); ++ return 6; ++ } ++ if (s7.f7 != 7+906) { ++ Console.WriteLine(" float7 s7.f7: got {0} but expected {1}", s7.f7, 7+906); ++ return 7; ++ } + + float8 s8; + s8.f1 = 1; +@@ -183,11 +267,39 @@ public class Test_float { + s8.f6 = 6; + s8.f7 = 7; + s8.f8 = 8; +- float retval8 = mono_return_float8(s8, 906); +- if (retval8 != 2*906) { +- Console.WriteLine(" float8 retval8: got {0} but expected {1}", retval8, 2*906); ++ s8 = mono_return_float8(s8, 906); ++ if (s8.f1 != 1+906) { ++ Console.WriteLine(" float8 s8.f1: got {0} but expected {1}", s8.f1, 1+906); + return 1; + } ++ if (s8.f2 != 2+906) { ++ Console.WriteLine(" float8 s8.f2: got {0} but expected {1}", s8.f2, 2+906); ++ return 2; ++ } ++ if (s8.f3 != 3+906) { ++ Console.WriteLine(" float8 s8.f3: got {0} but expected {1}", s8.f3, 3+906); ++ return 3; ++ } ++ if (s8.f4 != 4+906) { ++ Console.WriteLine(" float8 s8.f4: got {0} but expected {1}", s8.f4, 4+906); ++ return 4; ++ } ++ if (s8.f5 != 5+906) { ++ Console.WriteLine(" float8 s8.f5: got {0} but expected {1}", s8.f5, 5+906); ++ return 5; ++ } ++ if (s8.f6 != 6+906) { ++ Console.WriteLine(" float8 s8.f6: got {0} but expected {1}", s8.f6, 6+906); ++ return 6; ++ } ++ if (s8.f7 != 7+906) { ++ Console.WriteLine(" float8 s8.f7: got {0} but expected {1}", s8.f7, 7+906); ++ return 7; ++ } ++ if (s8.f8 != 8+906) { ++ Console.WriteLine(" float8 s8.f8: got {0} but expected {1}", s8.f8, 8+906); ++ return 8; ++ } + + float9 s9; + s9.f1 = 1; +@@ -199,18 +311,69 @@ public class Test_float { + s9.f7 = 7; + s9.f8 = 8; + s9.f9 = 9; +- float retval9 = mono_return_float9(s9, 906); +- if (retval9 != 2*906) { +- Console.WriteLine(" float9 retval9: got {0} but expected {1}", retval9, 2*906); ++ s9 = mono_return_float9(s9, 906); ++ if (s9.f1 != 1+906) { ++ Console.WriteLine(" float9 s9.f1: got {0} but expected {1}", s9.f1, 1+906); + return 1; + } ++ if (s9.f2 != 2+906) { ++ Console.WriteLine(" float9 s9.f2: got {0} but expected {1}", s9.f2, 2+906); ++ return 2; ++ } ++ if (s9.f3 != 3+906) { ++ Console.WriteLine(" float9 s9.f3: got {0} but expected {1}", s9.f3, 3+906); ++ return 3; ++ } ++ if (s9.f4 != 4+906) { ++ Console.WriteLine(" float9 s9.f4: got {0} but expected {1}", s9.f4, 4+906); ++ return 4; ++ } ++ if (s9.f5 != 5+906) { ++ Console.WriteLine(" float9 s9.f5: got {0} but expected {1}", s9.f5, 5+906); ++ return 5; ++ } ++ if (s9.f6 != 6+906) { ++ Console.WriteLine(" float9 s9.f6: got {0} but expected {1}", s9.f6, 6+906); ++ return 6; ++ } ++ if (s9.f7 != 7+906) { ++ Console.WriteLine(" float9 s9.f7: got {0} but expected {1}", s9.f7, 7+906); ++ return 7; ++ } ++ if (s9.f8 != 8+906) { ++ Console.WriteLine(" float9 s9.f8: got {0} but expected {1}", s9.f8, 8+906); ++ return 8; ++ } ++ if (s9.f9 != 9+906) { ++ Console.WriteLine(" float9 s9.f9: got {0} but expected {1}", s9.f9, 9+906); ++ return 9; ++ } + + ++ float4_nested sn4; ++ sn4.nested1.f1 = 1; ++ sn4.f2 = 2; ++ sn4.f3 = 3; ++ sn4.nested2.f4 = 4; ++ sn4 = mono_return_float4_nested(sn4, 906); ++ if (sn4.nested1.f1 != 1+906) { ++ Console.WriteLine(" float4_nested sn4.nested1.f1: got {0} but expected {1}", sn4.nested1.f1, 1+906); ++ return 1; ++ } ++ if (sn4.f2 != 2+906) { ++ Console.WriteLine(" float4_nested sn4.f2: got {0} but expected {1}", sn4.f2, 2+906); ++ return 2; ++ } ++ if (sn4.f3 != 3+906) { ++ Console.WriteLine(" float4_nested sn4.f3: got {0} but expected {1}", sn4.f3, 3+906); ++ return 3; ++ } ++ if (sn4.nested2.f4 != 4+906) { ++ Console.WriteLine(" float4_nested sn4.nested2.f4: got {0} but expected {1}", sn4.nested2.f4, 4+906); ++ return 4; ++ } ++ + return 0; + } // end Main + } // end class Test_float + +- +- +- +- +Index: mono-4.2.1/mono/tests/pinvoke_ppci.cs +=================================================================== +--- mono-4.2.1.orig/mono/tests/pinvoke_ppci.cs ++++ mono-4.2.1/mono/tests/pinvoke_ppci.cs +@@ -20,25 +20,25 @@ using System.Runtime.InteropServices; + public class Test_int { + + [DllImport ("libtest", EntryPoint="mono_return_int1")] +- public static extern int mono_return_int1 (int1 s, int addend); ++ public static extern int1 mono_return_int1 (int1 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct int1 { + public int f1; + } + [DllImport ("libtest", EntryPoint="mono_return_int2")] +- public static extern int mono_return_int2 (int2 s, int addend); ++ public static extern int2 mono_return_int2 (int2 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct int2 { + public int f1,f2; + } + [DllImport ("libtest", EntryPoint="mono_return_int3")] +- public static extern int mono_return_int3 (int3 s, int addend); ++ public static extern int3 mono_return_int3 (int3 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct int3 { + public int f1,f2,f3; + } + [DllImport ("libtest", EntryPoint="mono_return_int4")] +- public static extern int mono_return_int4 (int4 s, int addend); ++ public static extern int4 mono_return_int4 (int4 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct int4 { + public int f1,f2,f3,f4; +@@ -46,7 +46,7 @@ public class Test_int { + // This structure is 1 element too large to use the special return + // rules. + [DllImport ("libtest", EntryPoint="mono_return_int5")] +- public static extern int mono_return_int5 (int5 s, int addend); ++ public static extern int5 mono_return_int5 (int5 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct int5 { + public int f1,f2,f3,f4,f5; +@@ -73,41 +73,65 @@ public class Test_int { + + int1 s1; + s1.f1 = 1; +- int retval1 = mono_return_int1(s1, 906); +- if (retval1 != 2*906) { +- Console.WriteLine(" int1 retval1: got {0} but expected {1}", retval1, 2*906); ++ s1 = mono_return_int1(s1, 906); ++ if (s1.f1 != 1+906) { ++ Console.WriteLine(" int1 s1.f1: got {0} but expected {1}", s1.f1, 1+906); + return 1; + } + + int2 s2; + s2.f1 = 1; + s2.f2 = 2; +- int retval2 = mono_return_int2(s2, 906); +- if (retval2 != 2*906) { +- Console.WriteLine(" int2 retval2: got {0} but expected {1}", retval2, 2*906); ++ s2 = mono_return_int2(s2, 906); ++ if (s2.f1 != 1+906) { ++ Console.WriteLine(" int2 s2.f1: got {0} but expected {1}", s2.f1, 1+906); + return 1; + } ++ if (s2.f2 != 2+906) { ++ Console.WriteLine(" int2 s2.f2: got {0} but expected {1}", s2.f2, 2+906); ++ return 2; ++ } + + int3 s3; + s3.f1 = 1; + s3.f2 = 2; + s3.f3 = 3; +- int retval3 = mono_return_int3(s3, 906); +- if (retval3 != 2*906) { +- Console.WriteLine(" int3 retval3: got {0} but expected {1}", retval3, 2*906); ++ s3 = mono_return_int3(s3, 906); ++ if (s3.f1 != 1+906) { ++ Console.WriteLine(" int3 s3.f1: got {0} but expected {1}", s3.f1, 1+906); + return 1; + } ++ if (s3.f2 != 2+906) { ++ Console.WriteLine(" int3 s3.f2: got {0} but expected {1}", s3.f2, 2+906); ++ return 2; ++ } ++ if (s3.f3 != 3+906) { ++ Console.WriteLine(" int3 s3.f3: got {0} but expected {1}", s3.f3, 3+906); ++ return 3; ++ } + + int4 s4; + s4.f1 = 1; + s4.f2 = 2; + s4.f3 = 3; + s4.f4 = 4; +- int retval4 = mono_return_int4(s4, 906); +- if (retval4 != 2*906) { +- Console.WriteLine(" int4 retval4: got {0} but expected {1}", retval4, 2*906); ++ s4 = mono_return_int4(s4, 906); ++ if (s4.f1 != 1+906) { ++ Console.WriteLine(" int4 s4.f1: got {0} but expected {1}", s4.f1, 1+906); + return 1; + } ++ if (s4.f2 != 2+906) { ++ Console.WriteLine(" int4 s4.f2: got {0} but expected {1}", s4.f2, 2+906); ++ return 2; ++ } ++ if (s4.f3 != 3+906) { ++ Console.WriteLine(" int4 s4.f3: got {0} but expected {1}", s4.f3, 3+906); ++ return 3; ++ } ++ if (s4.f4 != 4+906) { ++ Console.WriteLine(" int4 s4.f4: got {0} but expected {1}", s4.f4, 4+906); ++ return 4; ++ } + + int5 s5; + s5.f1 = 1; +@@ -115,18 +139,53 @@ public class Test_int { + s5.f3 = 3; + s5.f4 = 4; + s5.f5 = 5; +- int retval5 = mono_return_int5(s5, 906); +- if (retval5 != 2*906) { +- Console.WriteLine(" int5 retval5: got {0} but expected {1}", retval5, 2*906); ++ s5 = mono_return_int5(s5, 906); ++ if (s5.f1 != 1+906) { ++ Console.WriteLine(" int5 s5.f1: got {0} but expected {1}", s5.f1, 1+906); + return 1; + } ++ if (s5.f2 != 2+906) { ++ Console.WriteLine(" int5 s5.f2: got {0} but expected {1}", s5.f2, 2+906); ++ return 2; ++ } ++ if (s5.f3 != 3+906) { ++ Console.WriteLine(" int5 s5.f3: got {0} but expected {1}", s5.f3, 3+906); ++ return 3; ++ } ++ if (s5.f4 != 4+906) { ++ Console.WriteLine(" int5 s5.f4: got {0} but expected {1}", s5.f4, 4+906); ++ return 4; ++ } ++ if (s5.f5 != 5+906) { ++ Console.WriteLine(" int5 s5.f5: got {0} but expected {1}", s5.f5, 5+906); ++ return 5; ++ } + + ++ int4_nested sn4; ++ sn4.nested1.f1 = 1; ++ sn4.f2 = 2; ++ sn4.f3 = 3; ++ sn4.nested2.f4 = 4; ++ sn4 = mono_return_int4_nested(sn4, 906); ++ if (sn4.nested1.f1 != 1+906) { ++ Console.WriteLine(" int4_nested sn4.nested1.f1: got {0} but expected {1}", sn4.nested1.f1, 1+906); ++ return 1; ++ } ++ if (sn4.f2 != 2+906) { ++ Console.WriteLine(" int4_nested sn4.f2: got {0} but expected {1}", sn4.f2, 2+906); ++ return 2; ++ } ++ if (sn4.f3 != 3+906) { ++ Console.WriteLine(" int4_nested sn4.f3: got {0} but expected {1}", sn4.f3, 3+906); ++ return 3; ++ } ++ if (sn4.nested2.f4 != 4+906) { ++ Console.WriteLine(" int4_nested sn4.nested2.f4: got {0} but expected {1}", sn4.nested2.f4, 4+906); ++ return 4; ++ } ++ + return 0; + } // end Main + } // end class Test_int + +- +- +- +- +Index: mono-4.2.1/mono/tests/pinvoke_ppcs.cs +=================================================================== +--- mono-4.2.1.orig/mono/tests/pinvoke_ppcs.cs ++++ mono-4.2.1/mono/tests/pinvoke_ppcs.cs +@@ -20,49 +20,49 @@ using System.Runtime.InteropServices; + public class Test_short { + + [DllImport ("libtest", EntryPoint="mono_return_short1")] +- public static extern short mono_return_short1 (short1 s, int addend); ++ public static extern short1 mono_return_short1 (short1 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct short1 { + public short f1; + } + [DllImport ("libtest", EntryPoint="mono_return_short2")] +- public static extern short mono_return_short2 (short2 s, int addend); ++ public static extern short2 mono_return_short2 (short2 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct short2 { + public short f1,f2; + } + [DllImport ("libtest", EntryPoint="mono_return_short3")] +- public static extern short mono_return_short3 (short3 s, int addend); ++ public static extern short3 mono_return_short3 (short3 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct short3 { + public short f1,f2,f3; + } + [DllImport ("libtest", EntryPoint="mono_return_short4")] +- public static extern short mono_return_short4 (short4 s, int addend); ++ public static extern short4 mono_return_short4 (short4 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct short4 { + public short f1,f2,f3,f4; + } + [DllImport ("libtest", EntryPoint="mono_return_short5")] +- public static extern short mono_return_short5 (short5 s, int addend); ++ public static extern short5 mono_return_short5 (short5 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct short5 { + public short f1,f2,f3,f4,f5; + } + [DllImport ("libtest", EntryPoint="mono_return_short6")] +- public static extern short mono_return_short6 (short6 s, int addend); ++ public static extern short6 mono_return_short6 (short6 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct short6 { + public short f1,f2,f3,f4,f5,f6; + } + [DllImport ("libtest", EntryPoint="mono_return_short7")] +- public static extern short mono_return_short7 (short7 s, int addend); ++ public static extern short7 mono_return_short7 (short7 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct short7 { + public short f1,f2,f3,f4,f5,f6,f7; + } + [DllImport ("libtest", EntryPoint="mono_return_short8")] +- public static extern short mono_return_short8 (short8 s, int addend); ++ public static extern short8 mono_return_short8 (short8 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct short8 { + public short f1,f2,f3,f4,f5,f6,f7,f8; +@@ -70,7 +70,7 @@ public class Test_short { + // This structure is 1 element too large to use the special return + // rules. + [DllImport ("libtest", EntryPoint="mono_return_short9")] +- public static extern short mono_return_short9 (short9 s, int addend); ++ public static extern short9 mono_return_short9 (short9 s, int addend); + [StructLayout(LayoutKind.Sequential)] + public struct short9 { + public short f1,f2,f3,f4,f5,f6,f7,f8,f9; +@@ -97,41 +97,65 @@ public class Test_short { + + short1 s1; + s1.f1 = 1; +- short retval1 = mono_return_short1(s1, 90); +- if (retval1 != 2*90) { +- Console.WriteLine(" short1 retval1: got {0} but expected {1}", retval1, 2*90); ++ s1 = mono_return_short1(s1, 90); ++ if (s1.f1 != 1+90) { ++ Console.WriteLine(" short1 s1.f1: got {0} but expected {1}", s1.f1, 1+90); + return 1; + } + + short2 s2; + s2.f1 = 1; + s2.f2 = 2; +- short retval2 = mono_return_short2(s2, 90); +- if (retval2 != 2*90) { +- Console.WriteLine(" short2 retval2: got {0} but expected {1}", retval2, 2*90); ++ s2 = mono_return_short2(s2, 90); ++ if (s2.f1 != 1+90) { ++ Console.WriteLine(" short2 s2.f1: got {0} but expected {1}", s2.f1, 1+90); + return 1; + } ++ if (s2.f2 != 2+90) { ++ Console.WriteLine(" short2 s2.f2: got {0} but expected {1}", s2.f2, 2+90); ++ return 2; ++ } + + short3 s3; + s3.f1 = 1; + s3.f2 = 2; + s3.f3 = 3; +- short retval3 = mono_return_short3(s3, 90); +- if (retval3 != 2*90) { +- Console.WriteLine(" short3 retval3: got {0} but expected {1}", retval3, 2*90); ++ s3 = mono_return_short3(s3, 90); ++ if (s3.f1 != 1+90) { ++ Console.WriteLine(" short3 s3.f1: got {0} but expected {1}", s3.f1, 1+90); + return 1; + } ++ if (s3.f2 != 2+90) { ++ Console.WriteLine(" short3 s3.f2: got {0} but expected {1}", s3.f2, 2+90); ++ return 2; ++ } ++ if (s3.f3 != 3+90) { ++ Console.WriteLine(" short3 s3.f3: got {0} but expected {1}", s3.f3, 3+90); ++ return 3; ++ } + + short4 s4; + s4.f1 = 1; + s4.f2 = 2; + s4.f3 = 3; + s4.f4 = 4; +- short retval4 = mono_return_short4(s4, 90); +- if (retval4 != 2*90) { +- Console.WriteLine(" short4 retval4: got {0} but expected {1}", retval4, 2*90); ++ s4 = mono_return_short4(s4, 90); ++ if (s4.f1 != 1+90) { ++ Console.WriteLine(" short4 s4.f1: got {0} but expected {1}", s4.f1, 1+90); + return 1; + } ++ if (s4.f2 != 2+90) { ++ Console.WriteLine(" short4 s4.f2: got {0} but expected {1}", s4.f2, 2+90); ++ return 2; ++ } ++ if (s4.f3 != 3+90) { ++ Console.WriteLine(" short4 s4.f3: got {0} but expected {1}", s4.f3, 3+90); ++ return 3; ++ } ++ if (s4.f4 != 4+90) { ++ Console.WriteLine(" short4 s4.f4: got {0} but expected {1}", s4.f4, 4+90); ++ return 4; ++ } + + short5 s5; + s5.f1 = 1; +@@ -139,11 +163,27 @@ public class Test_short { + s5.f3 = 3; + s5.f4 = 4; + s5.f5 = 5; +- short retval5 = mono_return_short5(s5, 90); +- if (retval5 != 2*90) { +- Console.WriteLine(" short5 retval5: got {0} but expected {1}", retval5, 2*90); ++ s5 = mono_return_short5(s5, 90); ++ if (s5.f1 != 1+90) { ++ Console.WriteLine(" short5 s5.f1: got {0} but expected {1}", s5.f1, 1+90); + return 1; + } ++ if (s5.f2 != 2+90) { ++ Console.WriteLine(" short5 s5.f2: got {0} but expected {1}", s5.f2, 2+90); ++ return 2; ++ } ++ if (s5.f3 != 3+90) { ++ Console.WriteLine(" short5 s5.f3: got {0} but expected {1}", s5.f3, 3+90); ++ return 3; ++ } ++ if (s5.f4 != 4+90) { ++ Console.WriteLine(" short5 s5.f4: got {0} but expected {1}", s5.f4, 4+90); ++ return 4; ++ } ++ if (s5.f5 != 5+90) { ++ Console.WriteLine(" short5 s5.f5: got {0} but expected {1}", s5.f5, 5+90); ++ return 5; ++ } + + short6 s6; + s6.f1 = 1; +@@ -152,11 +192,31 @@ public class Test_short { + s6.f4 = 4; + s6.f5 = 5; + s6.f6 = 6; +- short retval6 = mono_return_short6(s6, 90); +- if (retval6 != 2*90) { +- Console.WriteLine(" short6 retval6: got {0} but expected {1}", retval6, 2*90); ++ s6 = mono_return_short6(s6, 90); ++ if (s6.f1 != 1+90) { ++ Console.WriteLine(" short6 s6.f1: got {0} but expected {1}", s6.f1, 1+90); + return 1; + } ++ if (s6.f2 != 2+90) { ++ Console.WriteLine(" short6 s6.f2: got {0} but expected {1}", s6.f2, 2+90); ++ return 2; ++ } ++ if (s6.f3 != 3+90) { ++ Console.WriteLine(" short6 s6.f3: got {0} but expected {1}", s6.f3, 3+90); ++ return 3; ++ } ++ if (s6.f4 != 4+90) { ++ Console.WriteLine(" short6 s6.f4: got {0} but expected {1}", s6.f4, 4+90); ++ return 4; ++ } ++ if (s6.f5 != 5+90) { ++ Console.WriteLine(" short6 s6.f5: got {0} but expected {1}", s6.f5, 5+90); ++ return 5; ++ } ++ if (s6.f6 != 6+90) { ++ Console.WriteLine(" short6 s6.f6: got {0} but expected {1}", s6.f6, 6+90); ++ return 6; ++ } + + short7 s7; + s7.f1 = 1; +@@ -166,11 +226,35 @@ public class Test_short { + s7.f5 = 5; + s7.f6 = 6; + s7.f7 = 7; +- short retval7 = mono_return_short7(s7, 90); +- if (retval7 != 2*90) { +- Console.WriteLine(" short7 retval7: got {0} but expected {1}", retval7, 2*90); ++ s7 = mono_return_short7(s7, 90); ++ if (s7.f1 != 1+90) { ++ Console.WriteLine(" short7 s7.f1: got {0} but expected {1}", s7.f1, 1+90); + return 1; + } ++ if (s7.f2 != 2+90) { ++ Console.WriteLine(" short7 s7.f2: got {0} but expected {1}", s7.f2, 2+90); ++ return 2; ++ } ++ if (s7.f3 != 3+90) { ++ Console.WriteLine(" short7 s7.f3: got {0} but expected {1}", s7.f3, 3+90); ++ return 3; ++ } ++ if (s7.f4 != 4+90) { ++ Console.WriteLine(" short7 s7.f4: got {0} but expected {1}", s7.f4, 4+90); ++ return 4; ++ } ++ if (s7.f5 != 5+90) { ++ Console.WriteLine(" short7 s7.f5: got {0} but expected {1}", s7.f5, 5+90); ++ return 5; ++ } ++ if (s7.f6 != 6+90) { ++ Console.WriteLine(" short7 s7.f6: got {0} but expected {1}", s7.f6, 6+90); ++ return 6; ++ } ++ if (s7.f7 != 7+90) { ++ Console.WriteLine(" short7 s7.f7: got {0} but expected {1}", s7.f7, 7+90); ++ return 7; ++ } + + short8 s8; + s8.f1 = 1; +@@ -181,11 +265,39 @@ public class Test_short { + s8.f6 = 6; + s8.f7 = 7; + s8.f8 = 8; +- short retval8 = mono_return_short8(s8, 90); +- if (retval8 != 2*90) { +- Console.WriteLine(" short8 retval8: got {0} but expected {1}", retval8, 2*90); ++ s8 = mono_return_short8(s8, 90); ++ if (s8.f1 != 1+90) { ++ Console.WriteLine(" short8 s8.f1: got {0} but expected {1}", s8.f1, 1+90); + return 1; + } ++ if (s8.f2 != 2+90) { ++ Console.WriteLine(" short8 s8.f2: got {0} but expected {1}", s8.f2, 2+90); ++ return 2; ++ } ++ if (s8.f3 != 3+90) { ++ Console.WriteLine(" short8 s8.f3: got {0} but expected {1}", s8.f3, 3+90); ++ return 3; ++ } ++ if (s8.f4 != 4+90) { ++ Console.WriteLine(" short8 s8.f4: got {0} but expected {1}", s8.f4, 4+90); ++ return 4; ++ } ++ if (s8.f5 != 5+90) { ++ Console.WriteLine(" short8 s8.f5: got {0} but expected {1}", s8.f5, 5+90); ++ return 5; ++ } ++ if (s8.f6 != 6+90) { ++ Console.WriteLine(" short8 s8.f6: got {0} but expected {1}", s8.f6, 6+90); ++ return 6; ++ } ++ if (s8.f7 != 7+90) { ++ Console.WriteLine(" short8 s8.f7: got {0} but expected {1}", s8.f7, 7+90); ++ return 7; ++ } ++ if (s8.f8 != 8+90) { ++ Console.WriteLine(" short8 s8.f8: got {0} but expected {1}", s8.f8, 8+90); ++ return 8; ++ } + + short9 s9; + s9.f1 = 1; +@@ -197,18 +309,89 @@ public class Test_short { + s9.f7 = 7; + s9.f8 = 8; + s9.f9 = 9; +- short retval9 = mono_return_short9(s9, 90); +- if (retval9 != 2*90) { +- Console.WriteLine(" short9 retval9: got {0} but expected {1}", retval9, 2*90); ++ s9 = mono_return_short9(s9, 90); ++ if (s9.f1 != 1+90) { ++ Console.WriteLine(" short9 s9.f1: got {0} but expected {1}", s9.f1, 1+90); + return 1; + } ++ if (s9.f2 != 2+90) { ++ Console.WriteLine(" short9 s9.f2: got {0} but expected {1}", s9.f2, 2+90); ++ return 2; ++ } ++ if (s9.f3 != 3+90) { ++ Console.WriteLine(" short9 s9.f3: got {0} but expected {1}", s9.f3, 3+90); ++ return 3; ++ } ++ if (s9.f4 != 4+90) { ++ Console.WriteLine(" short9 s9.f4: got {0} but expected {1}", s9.f4, 4+90); ++ return 4; ++ } ++ if (s9.f5 != 5+90) { ++ Console.WriteLine(" short9 s9.f5: got {0} but expected {1}", s9.f5, 5+90); ++ return 5; ++ } ++ if (s9.f6 != 6+90) { ++ Console.WriteLine(" short9 s9.f6: got {0} but expected {1}", s9.f6, 6+90); ++ return 6; ++ } ++ if (s9.f7 != 7+90) { ++ Console.WriteLine(" short9 s9.f7: got {0} but expected {1}", s9.f7, 7+90); ++ return 7; ++ } ++ if (s9.f8 != 8+90) { ++ Console.WriteLine(" short9 s9.f8: got {0} but expected {1}", s9.f8, 8+90); ++ return 8; ++ } ++ if (s9.f9 != 9+90) { ++ Console.WriteLine(" short9 s9.f9: got {0} but expected {1}", s9.f9, 9+90); ++ return 9; ++ } + + ++ short8_nested sn8; ++ sn8.nested1.f1 = 1; ++ sn8.f2 = 2; ++ sn8.f3 = 3; ++ sn8.f4 = 4; ++ sn8.f5 = 5; ++ sn8.f6 = 6; ++ sn8.f7 = 7; ++ sn8.nested2.f8 = 8; ++ sn8 = mono_return_short8_nested(sn8, 90); ++ if (sn8.nested1.f1 != 1+90) { ++ Console.WriteLine(" short8_nested sn8.nested1.f1: got {0} but expected {1}", sn8.nested1.f1, 1+90); ++ return 1; ++ } ++ if (sn8.f2 != 2+90) { ++ Console.WriteLine(" short8_nested sn8.f2: got {0} but expected {1}", sn8.f2, 2+90); ++ return 2; ++ } ++ if (sn8.f3 != 3+90) { ++ Console.WriteLine(" short8_nested sn8.f3: got {0} but expected {1}", sn8.f3, 3+90); ++ return 3; ++ } ++ if (sn8.f4 != 4+90) { ++ Console.WriteLine(" short8_nested sn8.f4: got {0} but expected {1}", sn8.f4, 4+90); ++ return 4; ++ } ++ if (sn8.f5 != 5+90) { ++ Console.WriteLine(" short8_nested sn8.f5: got {0} but expected {1}", sn8.f5, 5+90); ++ return 5; ++ } ++ if (sn8.f6 != 6+90) { ++ Console.WriteLine(" short8_nested sn8.f6: got {0} but expected {1}", sn8.f6, 6+90); ++ return 6; ++ } ++ if (sn8.f7 != 7+90) { ++ Console.WriteLine(" short8_nested sn8.f7: got {0} but expected {1}", sn8.f7, 7+90); ++ return 7; ++ } ++ if (sn8.nested2.f8 != 8+90) { ++ Console.WriteLine(" short8_nested sn8.nested2.f8: got {0} but expected {1}", sn8.nested2.f8, 8+90); ++ return 8; ++ } ++ + return 0; + } // end Main + } // end class Test_short + +- +- +- +-