Skip to content

Commit fe8be02

Browse files
committed
Do not emit safe point for TLS_GET_ADDR calls into native runtime.
1 parent 5686f6a commit fe8be02

14 files changed

+36
-20
lines changed

src/coreclr/jit/codegen.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,8 @@ class CodeGen final : public CodeGenInterface
506506
MULTIREG_HAS_SECOND_GC_RET_ONLY_ARG(emitAttr secondRetSize),
507507
const DebugInfo& di,
508508
regNumber base,
509-
bool isJump);
509+
bool isJump,
510+
bool isNoGCframe = false);
510511
// clang-format on
511512

512513
// clang-format off

src/coreclr/jit/codegenarmarch.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3599,6 +3599,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
35993599
// We just need to emit "call reg" in this case.
36003600
//
36013601
assert(genIsValidIntReg(target->GetRegNum()));
3602+
bool isNoGCframe = false;
36023603

36033604
#ifdef TARGET_ARM64
36043605
bool isTlsHandleTarget =
@@ -3612,6 +3613,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
36123613
GenTreeIntCon* iconNode = target->AsIntCon();
36133614
methHnd = (CORINFO_METHOD_HANDLE)iconNode->gtIconVal;
36143615
retSize = EA_SET_FLG(retSize, EA_CNS_TLSGD_RELOC);
3616+
isNoGCframe = true;
36153617

36163618
// For NativeAOT, linux/arm64, linker wants the following pattern, so we will generate
36173619
// it as part of the call. Generating individual instructions is tricky to get it
@@ -3647,7 +3649,8 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
36473649
MULTIREG_HAS_SECOND_GC_RET_ONLY_ARG(secondRetSize),
36483650
di,
36493651
target->GetRegNum(),
3650-
call->IsFastTailCall());
3652+
call->IsFastTailCall(),
3653+
isNoGCframe);
36513654

36523655
#ifdef TARGET_ARM64
36533656
if (isTlsHandleTarget)

src/coreclr/jit/codegenlinear.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,7 +2257,8 @@ void CodeGen::genEmitCall(int callType,
22572257
MULTIREG_HAS_SECOND_GC_RET_ONLY_ARG(emitAttr secondRetSize),
22582258
const DebugInfo& di,
22592259
regNumber base,
2260-
bool isJump)
2260+
bool isJump,
2261+
bool isNoGCframe)
22612262
{
22622263
#if !defined(TARGET_X86)
22632264
int argSize = 0;
@@ -2277,7 +2278,7 @@ void CodeGen::genEmitCall(int callType,
22772278
gcInfo.gcVarPtrSetCur,
22782279
gcInfo.gcRegGCrefSetCur,
22792280
gcInfo.gcRegByrefSetCur,
2280-
di, base, REG_NA, 0, 0, isJump);
2281+
di, base, REG_NA, 0, 0, isJump, isNoGCframe);
22812282
}
22822283
// clang-format on
22832284

src/coreclr/jit/codegenxarch.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6396,7 +6396,8 @@ void CodeGen::genCallInstruction(GenTreeCall* call X86_ARG(target_ssize_t stackA
63966396
MULTIREG_HAS_SECOND_GC_RET_ONLY_ARG(secondRetSize),
63976397
di,
63986398
target->GetRegNum(),
6399-
call->IsFastTailCall());
6399+
call->IsFastTailCall(),
6400+
true); // isNoGCframe
64006401
// clang-format on
64016402
}
64026403
}

src/coreclr/jit/emitarm.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4677,7 +4677,8 @@ void emitter::emitIns_Call(EmitCallType callType,
46774677
regNumber xreg /* = REG_NA */,
46784678
unsigned xmul /* = 0 */,
46794679
ssize_t disp /* = 0 */,
4680-
bool isJump /* = false */)
4680+
bool isJump /* = false */,
4681+
bool isNoGCframe /* = false */)
46814682
{
46824683
/* Sanity check the arguments depending on callType */
46834684

@@ -4769,7 +4770,7 @@ void emitter::emitIns_Call(EmitCallType callType,
47694770
emitThisByrefRegs = byrefRegs;
47704771

47714772
// for the purpose of GC safepointing tail-calls are not real calls
4772-
id->idSetIsNoGC(isJump || emitNoGChelper(methHnd));
4773+
id->idSetIsNoGC(isJump || isNoGCframe || emitNoGChelper(methHnd));
47734774

47744775
/* Set the instruction - special case jumping a function */
47754776
instruction ins;

src/coreclr/jit/emitarm.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ void emitIns_Call(EmitCallType callType,
335335
regNumber xreg = REG_NA,
336336
unsigned xmul = 0,
337337
ssize_t disp = 0,
338-
bool isJump = false);
338+
bool isJump = false,
339+
bool isNoGCframe = false);
339340

340341
/*****************************************************************************
341342
*

src/coreclr/jit/emitarm64.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8985,7 +8985,8 @@ void emitter::emitIns_Call(EmitCallType callType,
89858985
regNumber xreg /* = REG_NA */,
89868986
unsigned xmul /* = 0 */,
89878987
ssize_t disp /* = 0 */,
8988-
bool isJump /* = false */)
8988+
bool isJump /* = false */,
8989+
bool isNoGCframe /* = false */)
89898990
{
89908991
/* Sanity check the arguments depending on callType */
89918992

@@ -9079,7 +9080,7 @@ void emitter::emitIns_Call(EmitCallType callType,
90799080
emitThisByrefRegs = byrefRegs;
90809081

90819082
// for the purpose of GC safepointing tail-calls are not real calls
9082-
id->idSetIsNoGC(isJump || emitNoGChelper(methHnd));
9083+
id->idSetIsNoGC(isJump || isNoGCframe || emitNoGChelper(methHnd));
90839084

90849085
/* Set the instruction - special case jumping a function */
90859086
instruction ins;

src/coreclr/jit/emitarm64.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,8 @@ void emitIns_Call(EmitCallType callType,
17451745
regNumber xreg,
17461746
unsigned xmul,
17471747
ssize_t disp,
1748-
bool isJump);
1748+
bool isJump,
1749+
bool isNoGCframe = false);
17491750

17501751
BYTE* emitOutputLJ(insGroup* ig, BYTE* dst, instrDesc* i);
17511752
unsigned emitOutputCall(insGroup* ig, BYTE* dst, instrDesc* i, code_t code);

src/coreclr/jit/emitloongarch64.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,7 +2392,8 @@ void emitter::emitIns_Call(EmitCallType callType,
23922392
regNumber xreg /* = REG_NA */,
23932393
unsigned xmul /* = 0 */,
23942394
ssize_t disp /* = 0 */,
2395-
bool isJump /* = false */)
2395+
bool isJump /* = false */,
2396+
bool isNoGCframe /* = false */)
23962397
{
23972398
/* Sanity check the arguments depending on callType */
23982399

@@ -2489,7 +2490,7 @@ void emitter::emitIns_Call(EmitCallType callType,
24892490
emitThisByrefRegs = byrefRegs;
24902491

24912492
// for the purpose of GC safepointing tail-calls are not real calls
2492-
id->idSetIsNoGC(isJump || emitNoGChelper(methHnd));
2493+
id->idSetIsNoGC(isJump || isNoGCframe || emitNoGChelper(methHnd));
24932494

24942495
/* Set the instruction - special case jumping a function */
24952496
instruction ins;

src/coreclr/jit/emitloongarch64.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ void emitIns_Call(EmitCallType callType,
349349
regNumber xreg = REG_NA,
350350
unsigned xmul = 0,
351351
ssize_t disp = 0,
352-
bool isJump = false);
352+
bool isJump = false,
353+
bool isNoGCframe = false);
353354

354355
unsigned emitOutputCall(insGroup* ig, BYTE* dst, instrDesc* id, code_t code);
355356

src/coreclr/jit/emitriscv64.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,8 @@ void emitter::emitIns_Call(EmitCallType callType,
13031303
regNumber xreg /* = REG_NA */,
13041304
unsigned xmul /* = 0 */,
13051305
ssize_t disp /* = 0 */,
1306-
bool isJump /* = false */)
1306+
bool isJump /* = false */,
1307+
bool isNoGCframe /* = false */)
13071308
{
13081309
/* Sanity check the arguments depending on callType */
13091310

@@ -1400,7 +1401,7 @@ void emitter::emitIns_Call(EmitCallType callType,
14001401
emitThisByrefRegs = byrefRegs;
14011402

14021403
// for the purpose of GC safepointing tail-calls are not real calls
1403-
id->idSetIsNoGC(isJump || emitNoGChelper(methHnd));
1404+
id->idSetIsNoGC(isJump || isNoGCframe || emitNoGChelper(methHnd));
14041405

14051406
/* Set the instruction - special case jumping a function */
14061407
instruction ins;

src/coreclr/jit/emitriscv64.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ void emitIns_Call(EmitCallType callType,
335335
regNumber xreg = REG_NA,
336336
unsigned xmul = 0,
337337
ssize_t disp = 0,
338-
bool isJump = false);
338+
bool isJump = false,
339+
bool isNoGCframe = false);
339340

340341
unsigned emitOutputCall(const insGroup* ig, BYTE* dst, instrDesc* id, code_t code);
341342

src/coreclr/jit/emitxarch.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9664,7 +9664,8 @@ void emitter::emitIns_Call(EmitCallType callType,
96649664
regNumber xreg,
96659665
unsigned xmul,
96669666
ssize_t disp,
9667-
bool isJump)
9667+
bool isJump,
9668+
bool isNoGCframe)
96689669
// clang-format on
96699670
{
96709671
/* Sanity check the arguments depending on callType */
@@ -9790,7 +9791,7 @@ void emitter::emitIns_Call(EmitCallType callType,
97909791
id->idIns(ins);
97919792

97929793
// for the purpose of GC safepointing tail-calls are not real calls
9793-
id->idSetIsNoGC(isJump || emitNoGChelper(methHnd));
9794+
id->idSetIsNoGC(isJump || isNoGCframe || emitNoGChelper(methHnd));
97949795

97959796
UNATIVE_OFFSET sz;
97969797

src/coreclr/jit/emitxarch.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,8 @@ void emitIns_Call(EmitCallType callType,
10171017
regNumber xreg = REG_NA,
10181018
unsigned xmul = 0,
10191019
ssize_t disp = 0,
1020-
bool isJump = false);
1020+
bool isJump = false,
1021+
bool isNoGCframe = false);
10211022
// clang-format on
10221023

10231024
#ifdef TARGET_AMD64

0 commit comments

Comments
 (0)