Skip to content

Commit cc7edab

Browse files
Implementation of opcode OP_GC_SAFE_POINT for ppc64le (#72997)
* Avoid transformation from multiplication to left shift in case of 64 bit value * Fixed System.Collections.Concurrent.Tests timeout issue
1 parent 1c055bb commit cc7edab

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/mono/mono/mini/cpu-ppc.mdesc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,4 @@ atomic_cas_i4: src1:b src2:i src3:i dest:i len:38
348348

349349
liverange_start: len:0
350350
liverange_end: len:0
351-
gc_safe_point: len:0
351+
gc_safe_point: clob:c src1:i len:40

src/mono/mono/mini/cpu-ppc64.mdesc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,4 +417,4 @@ atomic_cas_i8: src1:b src2:i src3:i dest:i len:38
417417

418418
liverange_start: len:0
419419
liverange_end: len:0
420-
gc_safe_point: len:0
420+
gc_safe_point: clob:c src1:i len:40

src/mono/mono/mini/mini-ppc.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4574,9 +4574,24 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
45744574
MONO_VARINFO (cfg, ins->inst_c0)->live_range_end = code - cfg->native_code;
45754575
break;
45764576
}
4577-
case OP_GC_SAFE_POINT:
4577+
case OP_GC_SAFE_POINT: {
4578+
guint8 *br;
4579+
ppc_ldr (code, ppc_r0, 0, ins->sreg1);
4580+
ppc_cmpi (code, 0, 0, ppc_r0, 0);
4581+
br = code;
4582+
ppc_bc (code, PPC_BR_TRUE, PPC_BR_EQ, 0);
4583+
mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_JIT_ICALL_ID,
4584+
GUINT_TO_POINTER (MONO_JIT_ICALL_mono_threads_state_poll));
4585+
if ((FORCE_INDIR_CALL || cfg->method->dynamic) && !cfg->compile_aot) {
4586+
ppc_load_func (code, PPC_CALL_REG, 0);
4587+
ppc_mtlr (code, PPC_CALL_REG);
4588+
ppc_blrl (code);
4589+
} else {
4590+
ppc_bl (code, 0);
4591+
}
4592+
ppc_patch (br, code);
45784593
break;
4579-
4594+
}
45804595
default:
45814596
g_warning ("unknown opcode %s in %s()\n", mono_inst_name (ins->opcode), __FUNCTION__);
45824597
g_assert_not_reached ();

0 commit comments

Comments
 (0)