Skip to content
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

Fix for CheckFixedFld hoisting bug OS:6773420 #787

Merged
merged 3 commits into from
Apr 13, 2016
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
37 changes: 37 additions & 0 deletions lib/Backend/GlobOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6303,6 +6303,32 @@ GlobOpt::CopyPropReplaceOpnd(IR::Instr * instr, IR::Opnd * opnd, StackSym * copy
Assert(!propertySymOpnd->IsTypeChecked());
checkObjTypeInstr = this->SetTypeCheckBailOut(checkObjTypeOpnd, checkObjTypeInstr, nullptr);
Assert(checkObjTypeInstr->HasBailOutInfo());

if (this->currentBlock->loop && !this->IsLoopPrePass())
{
// Try hoisting this checkObjType.
// But since this isn't the current instr being optimized, we need to play tricks with
// the byteCodeUse fields...
BVSparse<JitArenaAllocator> *currentBytecodeUses = this->byteCodeUses;
PropertySym * currentPropertySymUse = this->propertySymUse;
PropertySym * tempPropertySymUse = NULL;
this->byteCodeUses = NULL;
BVSparse<JitArenaAllocator> *tempByteCodeUse = JitAnew(this->tempAlloc, BVSparse<JitArenaAllocator>, this->tempAlloc);
#if DBG
BVSparse<JitArenaAllocator> *currentBytecodeUsesBeforeOpt = this->byteCodeUsesBeforeOpt;
this->byteCodeUsesBeforeOpt = tempByteCodeUse;
#endif
this->propertySymUse = NULL;
GlobOpt::TrackByteCodeSymUsed(checkObjTypeInstr, tempByteCodeUse, &tempPropertySymUse);

TryHoistInvariant(checkObjTypeInstr, this->currentBlock, NULL, this->FindValue(copySym), NULL, true);

this->byteCodeUses = currentBytecodeUses;
this->propertySymUse = currentPropertySymUse;
#if DBG
this->byteCodeUsesBeforeOpt = currentBytecodeUsesBeforeOpt;
#endif
}
}
}

Expand Down Expand Up @@ -18147,6 +18173,17 @@ GlobOpt::OptIsInvariant(IR::Opnd *src, BasicBlock *block, Loop *loop, Value *src

case IR::OpndKindSym:
sym = src->AsSymOpnd()->m_sym;
if (src->AsSymOpnd()->IsPropertySymOpnd())
{
if (src->AsSymOpnd()->AsPropertySymOpnd()->IsTypeChecked())
{
// We do not handle hoisting these yet. We might be hoisting this across the instr with the type check protecting this one.
// And somehow, the dead-store pass now removes the type check on that instr later on...
// For CheckFixedFld, there is no benefit hoisting these if they don't have a type check as they won't generate code.
return false;
}
}

break;

case IR::OpndKindHelperCall:
Expand Down
2 changes: 1 addition & 1 deletion lib/Runtime/ByteCode/OpCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ MACRO_BACKEND_ONLY( InlineRegExpExec, Empty, OpSideEffect|OpInli
MACRO_BACKEND_ONLY( CallIFixed, Empty, OpSideEffect|OpUseAllFields|OpCallInstr|OpInlineCallInstr)
MACRO_BACKEND_ONLY( CheckFixedFld, Empty, OpFastFldInstr|OpTempObjectSources|OpCanCSE)
MACRO_BACKEND_ONLY( CheckPropertyGuardAndLoadType, Empty, OpFastFldInstr|OpTempObjectSources|OpDoNotTransfer)
MACRO_BACKEND_ONLY( CheckObjType, Empty, OpFastFldInstr|OpTempObjectSources)
MACRO_BACKEND_ONLY( CheckObjType, Empty, OpFastFldInstr|OpTempObjectSources|OpCanCSE)
MACRO_BACKEND_ONLY( AdjustObjType, Empty, OpSideEffect)

// Edge inline built-ins
Expand Down