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

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