Blame SOURCES/runtime-77270-ppc64le-fsharp-crash.patch

c51fa4
From 14749457ff716cebd043b4e41aad622f9ac89586 Mon Sep 17 00:00:00 2001
c51fa4
From: Alhad Deshpande <Alhad.Deshpande1@ibm.com>
c51fa4
Date: Wed, 19 Oct 2022 06:29:54 +0000
c51fa4
Subject: [PATCH] Fixed FSharp crash issue
c51fa4
c51fa4
---
c51fa4
 src/mono/mono/mini/mini-ppc.c | 24 ++++++++++++------------
c51fa4
 1 file changed, 12 insertions(+), 12 deletions(-)
c51fa4
c51fa4
diff --git a/src/runtime/src/mono/mono/mini/mini-ppc.c b/src/runtime/src/mono/mono/mini/mini-ppc.c
c51fa4
index bc97b497af93a..3df60c6a925f6 100644
c51fa4
--- a/src/runtime/src/mono/mono/mini/mini-ppc.c
c51fa4
+++ b/src/runtime/src/mono/mono/mini/mini-ppc.c
c51fa4
@@ -3782,23 +3782,11 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
c51fa4
 				ppc_addis (code, ppc_r12, cfg->frame_reg, ppc_ha(cfg->stack_usage));
c51fa4
 				ppc_addi (code, ppc_r12, ppc_r12, cfg->stack_usage);
c51fa4
 			}
c51fa4
-			if (!cfg->method->save_lmf) {
c51fa4
-				pos = 0;
c51fa4
-				for (i = 31; i >= 13; --i) {
c51fa4
-					if (cfg->used_int_regs & (1 << i)) {
c51fa4
-						pos += sizeof (target_mgreg_t);
c51fa4
-						ppc_ldptr (code, i, -pos, ppc_r12);
c51fa4
-					}
c51fa4
-				}
c51fa4
-			} else {
c51fa4
-				/* FIXME restore from MonoLMF: though this can't happen yet */
c51fa4
-			}
c51fa4
 
c51fa4
 			/* Copy arguments on the stack to our argument area */
c51fa4
 			if (call->stack_usage) {
c51fa4
 				code = emit_memcpy (code, call->stack_usage, ppc_r12, PPC_STACK_PARAM_OFFSET, ppc_sp, PPC_STACK_PARAM_OFFSET);
c51fa4
 				/* r12 was clobbered */
c51fa4
-				g_assert (cfg->frame_reg == ppc_sp);
c51fa4
 				if (ppc_is_imm16 (cfg->stack_usage)) {
c51fa4
 					ppc_addi (code, ppc_r12, cfg->frame_reg, cfg->stack_usage);
c51fa4
 				} else {
c51fa4
@@ -3809,6 +3797,18 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
c51fa4
 				}
c51fa4
 			}
c51fa4
 
c51fa4
+			if (!cfg->method->save_lmf) {
c51fa4
+                                pos = 0;
c51fa4
+                                for (i = 31; i >= 13; --i) {
c51fa4
+                                        if (cfg->used_int_regs & (1 << i)) {
c51fa4
+                                                pos += sizeof (target_mgreg_t);
c51fa4
+                                                ppc_ldptr (code, i, -pos, ppc_r12);
c51fa4
+                                        }
c51fa4
+                                }
c51fa4
+                        } else {
c51fa4
+                                /* FIXME restore from MonoLMF: though this can't happen yet */
c51fa4
+                        }
c51fa4
+
c51fa4
 			ppc_mr (code, ppc_sp, ppc_r12);
c51fa4
 			mono_add_patch_info (cfg, (guint8*) code - cfg->native_code, MONO_PATCH_INFO_METHOD_JUMP, call->method);
c51fa4
 			cfg->thunk_area += THUNK_SIZE;