Skip to content

Commit 0ede3da

Browse files
committed
[MERGE #5866 @MikeHolman] fix issue where SIMD is using address of object from wrong process
Merge pull request #5866 from MikeHolman:fixsimdaddr
2 parents bf52dfc + a08581f commit 0ede3da

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

lib/Backend/LowerMDSharedSimd128.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,8 @@ IR::Instr* LowererMD::Simd128LowerNeg(IR::Instr *instr)
932932
IR::Opnd* dst = instr->GetDst();
933933
IR::Opnd* src1 = instr->GetSrc1();
934934
Js::OpCode addOpcode = Js::OpCode::PADDD;
935-
void * allOnes = (void*)&X86_ALL_ONES_I4;
935+
ThreadContextInfo* threadContextInfo = m_func->GetThreadContextInfo();
936+
intptr_t allOnes = threadContextInfo->GetX86AllOnesI4Addr();
936937

937938
Assert(dst->IsRegOpnd() && dst->IsSimd128());
938939
Assert(src1->IsRegOpnd() && src1->IsSimd128());
@@ -946,12 +947,12 @@ IR::Instr* LowererMD::Simd128LowerNeg(IR::Instr *instr)
946947
case Js::OpCode::Simd128_Neg_I8:
947948
case Js::OpCode::Simd128_Neg_U8:
948949
addOpcode = Js::OpCode::PADDW;
949-
allOnes = (void*)&X86_ALL_ONES_I8;
950+
allOnes = threadContextInfo->GetX86AllOnesI8Addr();
950951
break;
951952
case Js::OpCode::Simd128_Neg_I16:
952953
case Js::OpCode::Simd128_Neg_U16:
953954
addOpcode = Js::OpCode::PADDB;
954-
allOnes = (void*)&X86_ALL_ONES_I16;
955+
allOnes = threadContextInfo->GetX86AllOnesI16Addr();
955956
break;
956957
default:
957958
Assert(UNREACHED);
@@ -962,7 +963,7 @@ IR::Instr* LowererMD::Simd128LowerNeg(IR::Instr *instr)
962963
instr->InsertBefore(pInstr);
963964

964965
// PANDN dst, dst, 0xfff...f
965-
pInstr = IR::Instr::New(Js::OpCode::PANDN, dst, dst, IR::MemRefOpnd::New(m_func->GetThreadContextInfo()->GetX86AllNegOnesAddr(), src1->GetType(), m_func), m_func);
966+
pInstr = IR::Instr::New(Js::OpCode::PANDN, dst, dst, IR::MemRefOpnd::New(threadContextInfo->GetX86AllNegOnesAddr(), src1->GetType(), m_func), m_func);
966967
instr->InsertBefore(pInstr);
967968
Legalize(pInstr);
968969

lib/Runtime/Base/ThreadContextInfo.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,24 @@ ThreadContextInfo::GetX86AllOnesF4Addr() const
276276
return ShiftAddr(this, &X86_ALL_ONES_F4);
277277
}
278278

279+
intptr_t
280+
ThreadContextInfo::GetX86AllOnesI4Addr() const
281+
{
282+
return ShiftAddr(this, &X86_ALL_ONES_I4);
283+
}
284+
285+
intptr_t
286+
ThreadContextInfo::GetX86AllOnesI8Addr() const
287+
{
288+
return ShiftAddr(this, &X86_ALL_ONES_I8);
289+
}
290+
291+
intptr_t
292+
ThreadContextInfo::GetX86AllOnesI16Addr() const
293+
{
294+
return ShiftAddr(this, &X86_ALL_ONES_I16);
295+
}
296+
279297
intptr_t
280298
ThreadContextInfo::GetX86LowBytesMaskAddr() const
281299
{

lib/Runtime/Base/ThreadContextInfo.h

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ class ThreadContextInfo
6868
intptr_t GetX86AllNegOnesF4Addr() const;
6969
intptr_t GetX86AllZerosAddr() const;
7070
intptr_t GetX86AllOnesF4Addr() const;
71+
intptr_t GetX86AllOnesI4Addr() const;
72+
intptr_t GetX86AllOnesI8Addr() const;
73+
intptr_t GetX86AllOnesI16Addr() const;
7174
intptr_t GetX86LowBytesMaskAddr() const;
7275
intptr_t GetX86HighBytesMaskAddr() const;
7376
intptr_t GetX86DoubleWordSignBitsAddr() const;

0 commit comments

Comments
 (0)