Nuke translator-x64-vector.cpp
Most of it was dead code. The few helpers that are still used were moved to translator.cpp.
Esse commit está contido em:
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -7443,12 +7443,6 @@ void TranslatorX64::translateContStopped(const Tracelet& t,
|
||||
a. store_imm8_disp_reg(0x0, CONTOFF(m_running), r(rCont));
|
||||
}
|
||||
|
||||
void TranslatorX64::translateContHandle(const Tracelet& t,
|
||||
const NormalizedInstruction& i) {
|
||||
// Always interpreted
|
||||
not_reached();
|
||||
}
|
||||
|
||||
void TranslatorX64::analyzeStrlen(Tracelet& t,
|
||||
NormalizedInstruction& i) {
|
||||
switch (i.inputs[0]->rtt.valueType()) {
|
||||
@@ -7509,11 +7503,6 @@ void TranslatorX64::translateIncStat(const Tracelet& t,
|
||||
Stats::emitInc(a, Stats::StatCounter(counter), value);
|
||||
}
|
||||
|
||||
void TranslatorX64::translateArrayIdx(const Tracelet& t,
|
||||
const NormalizedInstruction& i) {
|
||||
not_reached();
|
||||
}
|
||||
|
||||
static void analyzeClassExistsImpl(NormalizedInstruction& i) {
|
||||
const int nameIdx = 1;
|
||||
const int autoIdx = 0;
|
||||
@@ -11311,8 +11300,7 @@ TranslatorX64::TranslatorX64()
|
||||
m_curNI(0),
|
||||
m_curFile(nullptr),
|
||||
m_curLine(0),
|
||||
m_curFunc(nullptr),
|
||||
m_vecState(nullptr)
|
||||
m_curFunc(nullptr)
|
||||
{
|
||||
static const size_t kRoundUp = 2 << 20;
|
||||
const size_t kAHotSize = RuntimeOption::VMTranslAHotSize;
|
||||
@@ -12034,7 +12022,11 @@ bool TranslatorX64::dumpTCData() {
|
||||
#define NATIVE_OP(X) PLAN(X, Native)
|
||||
#define SUPPORTED_OP(X) PLAN(X, Supported)
|
||||
#define SIMPLE_OP(X) PLAN(X, Simple)
|
||||
#define INTERP_OP(X) PLAN(X, Interp)
|
||||
#define INTERP_OP(X) PLAN(X, Interp) \
|
||||
void TranslatorX64::translate##X(const Tracelet&, \
|
||||
const NormalizedInstruction&) { \
|
||||
not_reached(); \
|
||||
}
|
||||
|
||||
#define SUPPORTED_OPS() \
|
||||
/*
|
||||
@@ -12094,6 +12086,16 @@ bool TranslatorX64::dumpTCData() {
|
||||
*/ \
|
||||
INTERP_OP(ContHandle) \
|
||||
INTERP_OP(ArrayIdx) \
|
||||
INTERP_OP(CGetM) \
|
||||
INTERP_OP(FPassM) \
|
||||
INTERP_OP(VGetM) \
|
||||
INTERP_OP(IssetM) \
|
||||
INTERP_OP(EmptyM) \
|
||||
INTERP_OP(SetM) \
|
||||
INTERP_OP(SetOpM) \
|
||||
INTERP_OP(IncDecM) \
|
||||
INTERP_OP(BindM) \
|
||||
INTERP_OP(UnsetM)
|
||||
|
||||
|
||||
// Define the trivial analyze methods
|
||||
|
||||
@@ -426,117 +426,9 @@ private:
|
||||
const int* args);
|
||||
|
||||
private:
|
||||
|
||||
MVecTransState* m_vecState;
|
||||
void invalidateOutStack(const NormalizedInstruction& ni);
|
||||
void cleanOutLocal(const NormalizedInstruction& ni);
|
||||
void invalidateOutLocal(const NormalizedInstruction& ni);
|
||||
int mResultStackOffset(const NormalizedInstruction& ni) const;
|
||||
bool generateMVal(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii) const;
|
||||
int firstDecrefInput(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii) const;
|
||||
bool inputIsLiveForFinalOp(const NormalizedInstruction& ni, unsigned i,
|
||||
const MInstrInfo& mii) const;
|
||||
bool logicalTeleportMVal(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii) const;
|
||||
bool teleportMVal(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii) const;
|
||||
bool useTvResult(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii) const;
|
||||
bool forceMValIncDec(const NormalizedInstruction& ni, const DynLocation& base,
|
||||
const DynLocation& val) const;
|
||||
bool forceMValIncDec(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii) const;
|
||||
void emitBaseLCR(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned iInd, LazyScratchReg& rBase);
|
||||
void emitBaseH(unsigned iInd, LazyScratchReg& rBase);
|
||||
void emitBaseN(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned iInd, LazyScratchReg& rBase);
|
||||
void emitBaseG(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned iInd, LazyScratchReg& rBase);
|
||||
void emitBaseS(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
unsigned iInd, LazyScratchReg& rBase);
|
||||
void emitBaseOp(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned iInd,
|
||||
LazyScratchReg& rBase);
|
||||
void emitHphpArrayGetIntKey(const NormalizedInstruction& i,
|
||||
PhysReg rBase,
|
||||
const DynLocation& keyLoc,
|
||||
Location outLoc,
|
||||
void* fallbackFunc);
|
||||
void emitElem(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd, unsigned iInd,
|
||||
LazyScratchReg& rBase);
|
||||
void emitProp(const MInstrInfo& mii, unsigned mInd,
|
||||
unsigned iInd, LazyScratchReg& rBase);
|
||||
void emitPropGeneric(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd,
|
||||
unsigned iInd, LazyScratchReg& rBase);
|
||||
void emitPropSpecialized(MInstrAttr, const Class*,
|
||||
int propOffset, unsigned mInd, unsigned iInd,
|
||||
LazyScratchReg& rBase);
|
||||
void emitNewElem(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
unsigned mInd, LazyScratchReg& rBase);
|
||||
void emitIntermediateOp(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd,
|
||||
unsigned& iInd, LazyScratchReg& rBase);
|
||||
bool needFirstRatchet(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii) const;
|
||||
bool needFinalRatchet(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii) const;
|
||||
unsigned nLogicalRatchets(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii) const;
|
||||
int ratchetInd(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd) const;
|
||||
void emitRatchetRefs(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd,
|
||||
PhysReg rBase);
|
||||
template <bool useEmpty>
|
||||
void emitIssetEmptyElem(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd, unsigned iInd,
|
||||
PhysReg rBase);
|
||||
template <bool useEmpty>
|
||||
void emitIssetEmptyProp(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd,
|
||||
unsigned iInd, PhysReg rBase);
|
||||
void emitVGetNewElem(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd, unsigned iInd,
|
||||
PhysReg rBase);
|
||||
void emitSetNewElem(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd, unsigned iInd,
|
||||
PhysReg rBase);
|
||||
void emitSetOpNewElem(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd, unsigned iInd,
|
||||
PhysReg rBase);
|
||||
void emitIncDecNewElem(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd, unsigned iInd,
|
||||
PhysReg rBase);
|
||||
void emitBindNewElem(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd, unsigned iInd,
|
||||
PhysReg rBase);
|
||||
void emitNotSuppNewElem(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd, unsigned iInd,
|
||||
PhysReg rBase);
|
||||
bool needMInstrCtx(const Tracelet& t, const NormalizedInstruction& ni) const;
|
||||
void emitMPre(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned& mInd,
|
||||
unsigned& iInd, LazyScratchReg& rBase);
|
||||
void emitMPost(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii);
|
||||
void translateMInstr(Op op);
|
||||
void emitFinalMOp(const Tracelet& t, const NormalizedInstruction& ni,
|
||||
const MInstrInfo& mii, unsigned mInd, unsigned iInd,
|
||||
LazyScratchReg& rBase);
|
||||
#define MII(instr, attrs, bS, iS, vC, fN) \
|
||||
void emit##instr##Elem(const Tracelet& t, const NormalizedInstruction& ni, \
|
||||
const MInstrInfo& mii, unsigned mInd, unsigned iInd, \
|
||||
PhysReg rBase); \
|
||||
void emit##instr##Prop(const Tracelet& t, const NormalizedInstruction& ni, \
|
||||
const MInstrInfo& mii, unsigned mInd, \
|
||||
unsigned iInd, LazyScratchReg& rBase);
|
||||
MINSTRS
|
||||
#undef MII
|
||||
|
||||
#define INSTRS \
|
||||
CASE(PopC) \
|
||||
@@ -1195,8 +1087,6 @@ PropInfo getFinalPropertyOffset(const NormalizedInstruction&,
|
||||
Class* contextClass,
|
||||
const MInstrInfo&);
|
||||
|
||||
bool isSupportedCGetM_LE(const NormalizedInstruction& i);
|
||||
bool isSupportedCGetM_RE(const NormalizedInstruction& i);
|
||||
bool isSupportedCGetM(const NormalizedInstruction& i);
|
||||
TXFlags planInstrAdd_Int(const NormalizedInstruction& i);
|
||||
TXFlags planInstrAdd_Array(const NormalizedInstruction& i);
|
||||
|
||||
@@ -558,6 +558,106 @@ static uint32_t get_random()
|
||||
static const int kTooPolyPred = 2;
|
||||
static const int kTooPolyRet = 6;
|
||||
|
||||
bool
|
||||
isNormalPropertyAccess(const NormalizedInstruction& i,
|
||||
int propInput,
|
||||
int objInput) {
|
||||
const LocationCode lcode = i.immVec.locationCode();
|
||||
return
|
||||
i.immVecM.size() == 1 &&
|
||||
(lcode == LC || lcode == LL || lcode == LR || lcode == LH) &&
|
||||
mcodeMaybePropName(i.immVecM[0]) &&
|
||||
i.inputs[propInput]->isString() &&
|
||||
i.inputs[objInput]->valueType() == KindOfObject;
|
||||
}
|
||||
|
||||
bool
|
||||
mInstrHasUnknownOffsets(const NormalizedInstruction& ni, Class* context) {
|
||||
const MInstrInfo& mii = getMInstrInfo(ni.mInstrOp());
|
||||
unsigned mi = 0;
|
||||
unsigned ii = mii.valCount() + 1;
|
||||
for (; mi < ni.immVecM.size(); ++mi) {
|
||||
MemberCode mc = ni.immVecM[mi];
|
||||
if (mcodeMaybePropName(mc)) {
|
||||
const Class* cls = nullptr;
|
||||
if (getPropertyOffset(ni, context, cls, mii, mi, ii).offset == -1) {
|
||||
return true;
|
||||
}
|
||||
++ii;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
PropInfo getPropertyOffset(const NormalizedInstruction& ni,
|
||||
Class* ctx,
|
||||
const Class*& baseClass,
|
||||
const MInstrInfo& mii,
|
||||
unsigned mInd, unsigned iInd) {
|
||||
if (mInd == 0) {
|
||||
auto const baseIndex = mii.valCount();
|
||||
baseClass = ni.inputs[baseIndex]->rtt.isObject()
|
||||
? ni.inputs[baseIndex]->rtt.valueClass()
|
||||
: nullptr;
|
||||
} else {
|
||||
baseClass = ni.immVecClasses[mInd - 1];
|
||||
}
|
||||
if (!baseClass) return PropInfo();
|
||||
|
||||
if (!ni.inputs[iInd]->rtt.isString()) {
|
||||
return PropInfo();
|
||||
}
|
||||
auto* const name = ni.inputs[iInd]->rtt.valueString();
|
||||
if (!name) return PropInfo();
|
||||
|
||||
bool accessible;
|
||||
// If we are not in repo-authoriative mode, we need to check that
|
||||
// baseClass cannot change in between requests
|
||||
if (!RuntimeOption::RepoAuthoritative ||
|
||||
!(baseClass->preClass()->attrs() & AttrUnique)) {
|
||||
if (!ctx) return PropInfo();
|
||||
if (!ctx->classof(baseClass)) {
|
||||
if (baseClass->classof(ctx)) {
|
||||
// baseClass can change on us in between requests, but since
|
||||
// ctx is an ancestor of baseClass we can make the weaker
|
||||
// assumption that the object is an instance of ctx
|
||||
baseClass = ctx;
|
||||
} else {
|
||||
// baseClass can change on us in between requests and it is
|
||||
// not related to ctx, so bail out
|
||||
return PropInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Lookup the index of the property based on ctx and baseClass
|
||||
Slot idx = baseClass->getDeclPropIndex(ctx, name, accessible);
|
||||
// If we couldn't find a property that is accessible in the current
|
||||
// context, bail out
|
||||
if (idx == kInvalidSlot || !accessible) {
|
||||
return PropInfo();
|
||||
}
|
||||
// If it's a declared property we're good to go: even if a subclass
|
||||
// redefines an accessible property with the same name it's guaranteed
|
||||
// to be at the same offset
|
||||
return PropInfo(
|
||||
baseClass->declPropOffset(idx),
|
||||
baseClass->declPropHphpcType(idx)
|
||||
);
|
||||
}
|
||||
|
||||
PropInfo getFinalPropertyOffset(const NormalizedInstruction& ni,
|
||||
Class* context,
|
||||
const MInstrInfo& mii) {
|
||||
unsigned mInd = ni.immVecM.size() - 1;
|
||||
unsigned iInd = mii.valCount() + 1 + mInd;
|
||||
|
||||
const Class* cls = nullptr;
|
||||
return getPropertyOffset(ni, context, cls, mii, mInd, iInd);
|
||||
}
|
||||
|
||||
static std::pair<DataType,double>
|
||||
predictMVec(const NormalizedInstruction* ni) {
|
||||
auto info = getFinalPropertyOffset(*ni,
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário