Skip to content

Commit

Permalink
[RISC-V] Disable ThreadStaticAccess Optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
clamp03 committed Sep 3, 2024
1 parent 5fcc9ff commit deeffb6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/coreclr/vm/threadstatics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ void* GetThreadLocalStaticBase(TLSIndex index)
if (gcBaseAddresses.pTLSBaseAddress == (TADDR)NULL)
{
// Now we need to actually allocate the TLS data block
struct
struct
{
PTRARRAYREF ptrRef;
OBJECTREF tlsEntry;
Expand Down Expand Up @@ -719,9 +719,9 @@ void GetTLSIndexForThreadStatic(MethodTable* pMT, bool gcStatic, TLSIndex* pInde
alignment = 4;
else if (bytesNeeded >= 2)
alignment = 2;
else
else
alignment = 1;

uint32_t actualIndexOffset = AlignDown(indexOffsetWithoutAlignment, alignment);
uint32_t alignmentAdjust = indexOffsetWithoutAlignment - actualIndexOffset;
if (alignmentAdjust <= newBytesAvailable)
Expand Down Expand Up @@ -801,6 +801,8 @@ bool CanJITOptimizeTLSAccess()
// Optimization is disabled for linux musl arm64
#elif defined(TARGET_FREEBSD) && defined(TARGET_ARM64)
// Optimization is disabled for FreeBSD/arm64
#elif defined(TARGET_RISCV64)
// Optimization is disabled for riscv64
#elif defined(FEATURE_INTERPRETER)
// Optimization is disabled when interpreter may be used
#elif !defined(TARGET_OSX) && defined(TARGET_UNIX) && defined(TARGET_ARM64)
Expand Down

0 comments on commit deeffb6

Please sign in to comment.