Skip to content

fix issue where SIMD is using address of object from wrong process #5866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/Backend/LowerMDSharedSimd128.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,8 @@ IR::Instr* LowererMD::Simd128LowerNeg(IR::Instr *instr)
IR::Opnd* dst = instr->GetDst();
IR::Opnd* src1 = instr->GetSrc1();
Js::OpCode addOpcode = Js::OpCode::PADDD;
void * allOnes = (void*)&X86_ALL_ONES_I4;
ThreadContextInfo* threadContextInfo = m_func->GetThreadContextInfo();
intptr_t allOnes = threadContextInfo->GetX86AllOnesI4Addr();

Assert(dst->IsRegOpnd() && dst->IsSimd128());
Assert(src1->IsRegOpnd() && src1->IsSimd128());
Expand All @@ -946,12 +947,12 @@ IR::Instr* LowererMD::Simd128LowerNeg(IR::Instr *instr)
case Js::OpCode::Simd128_Neg_I8:
case Js::OpCode::Simd128_Neg_U8:
addOpcode = Js::OpCode::PADDW;
allOnes = (void*)&X86_ALL_ONES_I8;
allOnes = threadContextInfo->GetX86AllOnesI8Addr();
break;
case Js::OpCode::Simd128_Neg_I16:
case Js::OpCode::Simd128_Neg_U16:
addOpcode = Js::OpCode::PADDB;
allOnes = (void*)&X86_ALL_ONES_I16;
allOnes = threadContextInfo->GetX86AllOnesI16Addr();
break;
default:
Assert(UNREACHED);
Expand All @@ -962,7 +963,7 @@ IR::Instr* LowererMD::Simd128LowerNeg(IR::Instr *instr)
instr->InsertBefore(pInstr);

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

Expand Down
18 changes: 18 additions & 0 deletions lib/Runtime/Base/ThreadContextInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,24 @@ ThreadContextInfo::GetX86AllOnesF4Addr() const
return ShiftAddr(this, &X86_ALL_ONES_F4);
}

intptr_t
ThreadContextInfo::GetX86AllOnesI4Addr() const
{
return ShiftAddr(this, &X86_ALL_ONES_I4);
}

intptr_t
ThreadContextInfo::GetX86AllOnesI8Addr() const
{
return ShiftAddr(this, &X86_ALL_ONES_I8);
}

intptr_t
ThreadContextInfo::GetX86AllOnesI16Addr() const
{
return ShiftAddr(this, &X86_ALL_ONES_I16);
}

intptr_t
ThreadContextInfo::GetX86LowBytesMaskAddr() const
{
Expand Down
3 changes: 3 additions & 0 deletions lib/Runtime/Base/ThreadContextInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class ThreadContextInfo
intptr_t GetX86AllNegOnesF4Addr() const;
intptr_t GetX86AllZerosAddr() const;
intptr_t GetX86AllOnesF4Addr() const;
intptr_t GetX86AllOnesI4Addr() const;
intptr_t GetX86AllOnesI8Addr() const;
intptr_t GetX86AllOnesI16Addr() const;
intptr_t GetX86LowBytesMaskAddr() const;
intptr_t GetX86HighBytesMaskAddr() const;
intptr_t GetX86DoubleWordSignBitsAddr() const;
Expand Down