diff --git a/hphp/runtime/vm/translator/hopt/block.h b/hphp/runtime/vm/translator/hopt/block.h index b9240bc30..13820abe1 100644 --- a/hphp/runtime/vm/translator/hopt/block.h +++ b/hphp/runtime/vm/translator/hopt/block.h @@ -51,16 +51,16 @@ struct Block : boost::noncopyable { push_back(label); } - IRInstruction* getLabel() const { + IRInstruction* label() const { assert(front()->op() == DefLabel); return front(); } uint32_t id() const { return m_id; } - Trace* getTrace() const { return m_trace; } + Trace* trace() const { return m_trace; } void setTrace(Trace* t) { m_trace = t; } + Hint hint() const { return m_hint; } void setHint(Hint hint) { m_hint = hint; } - Hint getHint() const { return m_hint; } void addEdge(IRInstruction* jmp); void removeEdge(IRInstruction* jmp); @@ -80,7 +80,7 @@ struct Block : boost::noncopyable { bool isMain() const; /* - * Returns: !getTaken() && !getNext(). + * Returns: !taken() && !next(). */ bool isExit() const; @@ -105,12 +105,12 @@ struct Block : boost::noncopyable { // return the fallthrough block. Should be nullptr if the last // instruction is a Terminal. - Block* getNext() const { return m_next.to(); } + Block* next() const { return m_next.to(); } void setNext(Block* b) { m_next.setTo(b); } // return the target block if the last instruction is a branch. - Block* getTaken() const { - return back()->getTaken(); + Block* taken() const { + return back()->taken(); } // return the postorder number of this block. (updated each time @@ -138,7 +138,7 @@ struct Block : boost::noncopyable { // return an iterator to a specific instruction iterator iteratorTo(IRInstruction* inst) { - assert(inst->getBlock() == this); + assert(inst->block() == this); return m_instrs.iterator_to(*inst); } @@ -163,7 +163,7 @@ struct Block : boost::noncopyable { void forEachSrc(unsigned i, L body) { for (Edge& e : m_preds) { IRInstruction* jmp = e.from()->back(); - assert(jmp->op() == Jmp_ && jmp->getTaken() == this); + assert(jmp->op() == Jmp_ && jmp->taken() == this); body(jmp, jmp->src(i)); } } @@ -190,7 +190,7 @@ struct Block : boost::noncopyable { // list-compatible interface; these delegate to m_instrs but also update // inst.m_block - InstructionList& getInstrs() { return m_instrs; } + InstructionList& instrs() { return m_instrs; } bool empty() const { return m_instrs.empty(); } iterator begin() { return m_instrs.begin(); } iterator end() { return m_instrs.end(); } @@ -204,7 +204,7 @@ struct Block : boost::noncopyable { void splice(iterator pos, Block* from, iterator begin, iterator end) { assert(from != this); for (auto i = begin; i != end; ++i) (*i).setBlock(this); - m_instrs.splice(pos, from->getInstrs(), begin, end); + m_instrs.splice(pos, from->instrs(), begin, end); } void push_back(IRInstruction* inst) { inst->setBlock(this); diff --git a/hphp/runtime/vm/translator/hopt/cfg.h b/hphp/runtime/vm/translator/hopt/cfg.h index 6ae43f06d..e96ad1ce6 100644 --- a/hphp/runtime/vm/translator/hopt/cfg.h +++ b/hphp/runtime/vm/translator/hopt/cfg.h @@ -41,12 +41,12 @@ struct PostorderSort { assert(!block->empty()); if (m_visited.test(block->id())) return; m_visited.set(block->id()); - Block* taken = block->getTaken(); - if (taken && taken->getTrace()->isMain() != block->getTrace()->isMain()) { + Block* taken = block->taken(); + if (taken && taken->trace()->isMain() != block->trace()->isMain()) { walk(taken); taken = nullptr; } - if (Block* next = block->getNext()) walk(next); + if (Block* next = block->next()) walk(next); if (taken) walk(taken); m_visitor(block); } @@ -154,11 +154,11 @@ void forEachTrace(Trace* main, Body body) { */ template void forEachTraceBlock(Trace* main, Body body) { - for (Block* block : main->getBlocks()) { + for (Block* block : main->blocks()) { body(block); } for (Trace* exit : main->getExitTraces()) { - for (Block* block : exit->getBlocks()) { + for (Block* block : exit->blocks()) { body(block); } } @@ -178,7 +178,7 @@ void forEachInst(const BlockList& blocks, Body body) { template void forEachInst(Trace* trace, Body body) { - forEachInst(trace->getBlocks(), body); + forEachInst(trace->blocks(), body); } /* diff --git a/hphp/runtime/vm/translator/hopt/check.cpp b/hphp/runtime/vm/translator/hopt/check.cpp index 67813363e..e5dcc8b18 100644 --- a/hphp/runtime/vm/translator/hopt/check.cpp +++ b/hphp/runtime/vm/translator/hopt/check.cpp @@ -71,15 +71,15 @@ bool checkBlock(Block* b) { if (b->skipLabel() != b->end()) { assert(b->skipLabel()->op() == Marker); } - if (b->back()->isTerminal()) assert(!b->getNext()); - if (b->getTaken()) { + if (b->back()->isTerminal()) assert(!b->next()); + if (b->taken()) { // only Jmp_ can branch to a join block expecting values. assert(b->back()->op() == Jmp_ || - b->getTaken()->front()->numDsts() == 0); + b->taken()->front()->numDsts() == 0); } - if (b->getNext()) { + if (b->next()) { // cannot fall-through to join block expecting values - assert(b->getNext()->front()->numDsts() == 0); + assert(b->next()->front()->numDsts() == 0); } { @@ -91,15 +91,15 @@ bool checkBlock(Block* b) { assert(!inst.isBlockEnd()); } for (DEBUG_ONLY IRInstruction& inst : *b) { - assert(inst.getBlock() == b); + assert(inst.block() == b); } } for (int i = 0; i < b->front()->numDsts(); ++i) { - auto const traceBlocks = b->getTrace()->getBlocks(); + auto const traceBlocks = b->trace()->blocks(); b->forEachSrc(i, [&](IRInstruction* inst, SSATmp*) { assert(std::find(traceBlocks.begin(), traceBlocks.end(), - inst->getBlock()) != traceBlocks.end()); + inst->block()) != traceBlocks.end()); }); } diff --git a/hphp/runtime/vm/translator/hopt/codegen.cpp b/hphp/runtime/vm/translator/hopt/codegen.cpp index 0c0738b35..ba8621d55 100644 --- a/hphp/runtime/vm/translator/hopt/codegen.cpp +++ b/hphp/runtime/vm/translator/hopt/codegen.cpp @@ -778,14 +778,14 @@ void CodeGenerator::emitReqBindJcc(ConditionCode cc, void CodeGenerator::cgJcc(IRInstruction* inst) { emitCompare(inst->src(0), inst->src(1)); - emitFwdJcc(opToConditionCode(inst->op()), inst->getTaken()); + emitFwdJcc(opToConditionCode(inst->op()), inst->taken()); } void CodeGenerator::cgReqBindJcc(IRInstruction* inst) { // TODO(#2404427): prepareForTestAndSmash? emitCompare(inst->src(0), inst->src(1)); emitReqBindJcc(opToConditionCode(inst->op()), - inst->getExtra()); + inst->extra()); } #define X(x) \ @@ -1094,7 +1094,7 @@ void CodeGenerator::cgCallHelper(Asm& a, * bytecode offset. */ void CodeGenerator::cgMarker(IRInstruction* inst) { - m_curBcOff = inst->getExtra()->bcOff; + m_curBcOff = inst->extra()->bcOff; } void CodeGenerator::cgMov(IRInstruction* inst) { @@ -1706,10 +1706,10 @@ void CodeGenerator::emitIsTypeTest(IRInstruction* inst, JmpFn doJcc) { auto const src = inst->src(0); // punt if specialized object for now - if (inst->getTypeParam().strictSubtypeOf(Type::Obj)) { + if (inst->typeParam().strictSubtypeOf(Type::Obj)) { CG_PUNT(IsType-SpecializedUnsupported); } - if (inst->getTypeParam().equals(Type::Obj)) { + if (inst->typeParam().equals(Type::Obj)) { auto const srcReg = m_regs[src].getReg(); if (src->isA(Type::PtrToGen)) { emitTestTVType(m_as, KindOfObject, srcReg[TVOFF(m_type)]); @@ -1737,7 +1737,7 @@ void CodeGenerator::emitIsTypeTest(IRInstruction* inst, JmpFn doJcc) { if (src->isA(Type::PtrToGen)) { PhysReg base = m_regs[src].getReg(); - emitTypeTest(inst->getTypeParam(), base[TVOFF(m_type)], + emitTypeTest(inst->typeParam(), base[TVOFF(m_type)], base[TVOFF(m_data)], [&](ConditionCode cc) { doJcc(cc); }); return; @@ -1750,7 +1750,7 @@ void CodeGenerator::emitIsTypeTest(IRInstruction* inst, JmpFn doJcc) { CG_PUNT(IsType-KnownType); } PhysReg dataSrcReg = m_regs[src].getReg(); // data register - emitTypeTest(inst->getTypeParam(), typeSrcReg, dataSrcReg, + emitTypeTest(inst->typeParam(), typeSrcReg, dataSrcReg, [&](ConditionCode cc) { doJcc(cc); }); } @@ -1802,7 +1802,7 @@ void CodeGenerator::cgIsTypeCommon(IRInstruction* inst, bool negate) { void CodeGenerator::cgJmpIsTypeCommon(IRInstruction* inst, bool negate) { emitIsTypeTest(inst, [&](ConditionCode cc) { - emitFwdJcc(negate ? ccNegate(cc) : cc, inst->getTaken()); + emitFwdJcc(negate ? ccNegate(cc) : cc, inst->taken()); }); } @@ -1883,24 +1883,24 @@ void CodeGenerator::cgNInstanceOfBitmask(IRInstruction* inst) { void CodeGenerator::cgJmpInstanceOfBitmask(IRInstruction* inst) { emitInstanceBitmaskCheck(inst); - emitFwdJcc(CC_NZ, inst->getTaken()); + emitFwdJcc(CC_NZ, inst->taken()); } void CodeGenerator::cgJmpNInstanceOfBitmask(IRInstruction* inst) { emitInstanceBitmaskCheck(inst); - emitFwdJcc(CC_Z, inst->getTaken()); + emitFwdJcc(CC_Z, inst->taken()); } void CodeGenerator::cgReqBindJmpInstanceOfBitmask(IRInstruction* inst) { emitInstanceBitmaskCheck(inst); emitReqBindJcc(opToConditionCode(inst->op()), - inst->getExtra()); + inst->extra()); } void CodeGenerator::cgReqBindJmpNInstanceOfBitmask(IRInstruction* inst) { emitInstanceBitmaskCheck(inst); emitReqBindJcc(opToConditionCode(inst->op()), - inst->getExtra()); + inst->extra()); } /* @@ -2145,7 +2145,7 @@ void CodeGenerator::cgLdFuncCached(IRInstruction* inst) { void CodeGenerator::cgLdFuncCachedSafe(IRInstruction* inst) { cgLdFuncCachedCommon(inst); - if (Block* taken = inst->getTaken()) { + if (Block* taken = inst->taken()) { emitFwdJcc(m_as, CC_Z, taken); } } @@ -2298,7 +2298,7 @@ void CodeGenerator::emitReqBindAddr(const Func* func, } void CodeGenerator::cgJmpSwitchDest(IRInstruction* inst) { - JmpSwitchData* data = inst->getExtra(); + JmpSwitchData* data = inst->extra(); SSATmp* index = inst->src(0); auto indexReg = m_regs[index].getReg(); @@ -2349,7 +2349,7 @@ static TCA sswitchHelperFast(const StringData* val, } void CodeGenerator::cgLdSSwitchDestFast(IRInstruction* inst) { - auto data = inst->getExtra(); + auto data = inst->extra(); auto table = m_tx64->m_globalData.alloc(64); table->init(data->numCases); @@ -2383,7 +2383,7 @@ static TCA sswitchHelperSlow(TypedValue typedVal, } void CodeGenerator::cgLdSSwitchDestSlow(IRInstruction* inst) { - auto data = inst->getExtra(); + auto data = inst->extra(); auto strtab = m_tx64->m_globalData.alloc( sizeof(const StringData*), data->numCases); @@ -2419,7 +2419,7 @@ void CodeGenerator::cgLdSSwitchDestSlow(IRInstruction* inst) { void CodeGenerator::cgDefInlineFP(IRInstruction* inst) { auto const fp = m_regs[inst->src(0)].getReg(); auto const fakeRet = m_tx64->getRetFromInlinedFrame(); - auto const retBCOff = inst->getExtra()->retBCOff; + auto const retBCOff = inst->extra()->retBCOff; m_as. storeq (fakeRet, fp[AROFF(m_savedRip)]); m_as. storel (retBCOff, fp[AROFF(m_soff)]); @@ -2440,7 +2440,7 @@ void CodeGenerator::cgReDefSP(IRInstruction* inst) { // a DefGeneratorSP or something similar. auto fp = m_regs[inst->src(0)].getReg(); auto dst = m_regs[inst->dst()].getReg(); - auto off = -inst->getExtra()->offset * sizeof(Cell); + auto off = -inst->extra()->offset * sizeof(Cell); emitLea(m_as, fp[off], dst); } @@ -2566,14 +2566,14 @@ int CodeGenerator::getIterOffset(SSATmp* tmp) { void CodeGenerator::cgStLoc(IRInstruction* inst) { cgStore(m_regs[inst->src(0)].getReg(), - getLocalOffset(inst->getExtra()->locId), + getLocalOffset(inst->extra()->locId), inst->src(1), true /* store type */); } void CodeGenerator::cgStLocNT(IRInstruction* inst) { cgStore(m_regs[inst->src(0)].getReg(), - getLocalOffset(inst->getExtra()->locId), + getLocalOffset(inst->extra()->locId), inst->src(1), false /* store type */); } @@ -2586,7 +2586,7 @@ void CodeGenerator::cgSyncABIRegs(IRInstruction* inst) { void CodeGenerator::cgReqBindJmp(IRInstruction* inst) { m_tx64->emitBindJmp( m_as, - SrcKey(getCurFunc(), inst->getExtra()->offset) + SrcKey(getCurFunc(), inst->extra()->offset) ); } @@ -2616,14 +2616,14 @@ static void emitExitNoIRStats(Asm& a, void CodeGenerator::cgReqBindJmpNoIR(IRInstruction* inst) { auto const dest = SrcKey(getCurFunc(), - inst->getExtra()->offset); + inst->extra()->offset); emitExitNoIRStats(m_as, m_tx64, getCurFunc(), dest); m_tx64->emitBindJmp(m_as, dest, REQ_BIND_JMP_NO_IR); } void CodeGenerator::cgReqRetranslateNoIR(IRInstruction* inst) { auto const dest = SrcKey(getCurFunc(), - inst->getExtra()->offset); + inst->extra()->offset); emitExitNoIRStats(m_as, m_tx64, getCurFunc(), dest); m_tx64->emitReqRetransNoIR(m_as, dest); } @@ -2687,15 +2687,15 @@ void CodeGenerator::cgIncRef(IRInstruction* inst) { } void CodeGenerator::cgDecRefStack(IRInstruction* inst) { - cgDecRefMem(inst->getTypeParam(), + cgDecRefMem(inst->typeParam(), m_regs[inst->src(0)].getReg(), - cellsToBytes(inst->getExtra()->offset), + cellsToBytes(inst->extra()->offset), nullptr); } void CodeGenerator::cgDecRefThis(IRInstruction* inst) { SSATmp* fp = inst->src(0); - Block* exit = inst->getTaken(); + Block* exit = inst->taken(); auto fpReg = m_regs[fp].getReg(); auto scratchReg = m_rScratch; @@ -2725,10 +2725,10 @@ void CodeGenerator::cgDecRefThis(IRInstruction* inst) { } void CodeGenerator::cgDecRefLoc(IRInstruction* inst) { - cgDecRefMem(inst->getTypeParam(), + cgDecRefMem(inst->typeParam(), m_regs[inst->src(0)].getReg(), - getLocalOffset(inst->getExtra()->locId), - inst->getTaken()); + getLocalOffset(inst->extra()->locId), + inst->taken()); } void CodeGenerator::cgGenericRetDecRefs(IRInstruction* inst) { @@ -3100,16 +3100,16 @@ void CodeGenerator::cgDecRefMem(Type type, void CodeGenerator::cgDecRefMem(IRInstruction* inst) { assert(inst->src(0)->type().isPtr()); - cgDecRefMem(inst->getTypeParam(), + cgDecRefMem(inst->typeParam(), m_regs[inst->src(0)].getReg(), inst->src(1)->getValInt(), - inst->getTaken()); + inst->taken()); } void CodeGenerator::cgDecRefWork(IRInstruction* inst, bool genZeroCheck) { SSATmp* src = inst->src(0); if (!isRefCounted(src)) return; - Block* exit = inst->getTaken(); + Block* exit = inst->taken(); Type type = src->type(); if (type.isKnownDataType()) { cgDecRefStaticType(type, m_regs[src].getReg(), exit, genZeroCheck); @@ -3124,19 +3124,19 @@ void CodeGenerator::cgDecRefWork(IRInstruction* inst, bool genZeroCheck) { void CodeGenerator::cgDecRef(IRInstruction *inst) { // DecRef may bring the count to zero, and run the destructor. // Generate code for this. - assert(!inst->getTaken()); + assert(!inst->taken()); cgDecRefWork(inst, true); } void CodeGenerator::cgDecRefNZ(IRInstruction* inst) { // DecRefNZ cannot bring the count to zero. // Therefore, we don't generate zero-checking code. - assert(!inst->getTaken()); + assert(!inst->taken()); cgDecRefWork(inst, false); } void CodeGenerator::cgDecRefNZOrBranch(IRInstruction* inst) { - assert(inst->getTaken()); + assert(inst->taken()); cgDecRefWork(inst, true); } @@ -3145,8 +3145,8 @@ void CodeGenerator::cgSpillFrame(IRInstruction* inst) { auto const fp = inst->src(1); auto const func = inst->src(2); auto const objOrCls = inst->src(3); - auto const magicName = inst->getExtra()->invName; - auto const nArgs = inst->getExtra()->numArgs; + auto const magicName = inst->extra()->invName; + auto const nArgs = inst->extra()->numArgs; const int64_t spOffset = -kNumActRecCells * sizeof(Cell); @@ -3375,7 +3375,7 @@ void CodeGenerator::cgAllocObjFast(IRInstruction* inst) { } void CodeGenerator::cgInlineCreateCont(IRInstruction* inst) { - auto const& data = *inst->getExtra(); + auto const& data = *inst->extra(); auto const helper = data.origFunc->isMethod() ? &VMExecutionContext::createContinuationHelper : &VMExecutionContext::createContinuationHelper; @@ -3401,8 +3401,8 @@ void CodeGenerator::cgInlineCreateCont(IRInstruction* inst) { } void CodeGenerator::cgCallArray(IRInstruction* inst) { - Offset pc = inst->getExtra()->pc; - Offset after = inst->getExtra()->after; + Offset pc = inst->extra()->pc; + Offset after = inst->extra()->after; ArgGroup args(m_regs); args.imm(pc).imm(after); @@ -3448,9 +3448,9 @@ void CodeGenerator::cgCall(IRInstruction* inst) { } void CodeGenerator::cgCastStk(IRInstruction *inst) { - Type type = inst->getTypeParam(); + Type type = inst->typeParam(); SSATmp* sp = inst->src(0); - uint32_t offset = inst->getExtra()->offset; + uint32_t offset = inst->extra()->offset; PhysReg spReg = m_regs[sp].getReg(); ArgGroup args(m_regs); @@ -3485,7 +3485,7 @@ void CodeGenerator::cgCallBuiltin(IRInstruction* inst) { SSATmp* dst = inst->dst(); auto dstReg = m_regs[dst].getReg(0); auto dstType = m_regs[dst].getReg(1); - Type returnType = inst->getTypeParam(); + Type returnType = inst->typeParam(); const Func* func = f->getValFunc(); DataType funcReturnType = func->returnType(); @@ -3600,7 +3600,7 @@ void CodeGenerator::cgSpillStack(IRInstruction* inst) { // If our value came from a LdStack on the same sp and offset, // we don't need to spill it. if (inst->op() == LdStack && inst->src(0) == sp && - inst->getExtra()->offset * sizeof(Cell) == offset) { + inst->extra()->offset * sizeof(Cell) == offset) { FTRACE(6, "{}: Not spilling spill value {} from {}\n", __func__, i, inst->toString()); } else { @@ -3645,7 +3645,7 @@ void CodeGenerator::cgNativeImpl(IRInstruction* inst) { void CodeGenerator::cgLdThis(IRInstruction* inst) { SSATmp* dst = inst->dst(); SSATmp* src = inst->src(0); - Block* label = inst->getTaken(); + Block* label = inst->taken(); // mov dst, [fp + 0x20] auto dstReg = m_regs[dst].getReg(); @@ -3706,7 +3706,7 @@ void CodeGenerator::cgLdCctx(IRInstruction* inst) { void CodeGenerator::cgLdConst(IRInstruction* inst) { auto const dstReg = m_regs[inst->dst()].getReg(); - auto const val = inst->getExtra()->as(); + auto const val = inst->extra()->as(); if (dstReg == InvalidReg) return; emitLoadImm(m_as, val, dstReg); } @@ -3819,7 +3819,7 @@ void CodeGenerator::cgLdStaticLocCached(IRInstruction* inst) { m_as.loadq (rVmTl[ch], outReg); m_as.testq (outReg, outReg); - emitFwdJcc(m_as, CC_Z, inst->getTaken()); + emitFwdJcc(m_as, CC_Z, inst->taken()); } // If label is set and type is not Gen, this method generates a check @@ -3827,8 +3827,8 @@ void CodeGenerator::cgLdStaticLocCached(IRInstruction* inst) { void CodeGenerator::cgLoadTypedValue(PhysReg base, int64_t off, IRInstruction* inst) { - Block* label = inst->getTaken(); - Type type = inst->getTypeParam(); + Block* label = inst->taken(); + Type type = inst->typeParam(); SSATmp* dst = inst->dst(); assert(type == dst->type()); @@ -3859,14 +3859,14 @@ void CodeGenerator::cgLoadTypedValue(PhysReg base, if (typeDstReg != InvalidReg) { emitLoadTVType(m_as, base[off + TVOFF(m_type)], typeDstReg); if (label) { - emitTypeCheck(inst->getTypeParam(), typeDstReg, - valueDstReg, inst->getTaken()); + emitTypeCheck(inst->typeParam(), typeDstReg, + valueDstReg, inst->taken()); } } else if (label) { - emitTypeCheck(inst->getTypeParam(), + emitTypeCheck(inst->typeParam(), base[off + TVOFF(m_type)], base[off + TVOFF(m_data)], - inst->getTaken()); + inst->taken()); } // Load value if it's not dead @@ -3931,16 +3931,16 @@ void CodeGenerator::cgStore(PhysReg base, void CodeGenerator::cgLoad(PhysReg base, int64_t off, IRInstruction* inst) { - Type type = inst->getTypeParam(); + Type type = inst->typeParam(); if (type.needsReg()) { return cgLoadTypedValue(base, off, inst); } - Block* label = inst->getTaken(); + Block* label = inst->taken(); if (label != NULL) { - emitTypeCheck(inst->getTypeParam(), + emitTypeCheck(inst->typeParam(), base[off + TVOFF(m_type)], base[off + TVOFF(m_data)], - inst->getTaken()); + inst->taken()); } if (type.isNull()) return; // these are constants auto dstReg = m_regs[inst->dst()].getReg(); @@ -3996,13 +3996,13 @@ void CodeGenerator::cgLdAddr(IRInstruction* inst) { void CodeGenerator::cgLdLoc(IRInstruction* inst) { cgLoad(m_regs[inst->src(0)].getReg(), - getLocalOffset(inst->getExtra()->locId), + getLocalOffset(inst->extra()->locId), inst); } void CodeGenerator::cgLdLocAddr(IRInstruction* inst) { auto const fpReg = m_regs[inst->src(0)].getReg(); - auto const offset = getLocalOffset(inst->getExtra()->locId); + auto const offset = getLocalOffset(inst->extra()->locId); if (m_regs[inst->dst()].hasReg()) { m_as.lea(fpReg[offset], m_regs[inst->dst()].getReg()); } @@ -4010,45 +4010,45 @@ void CodeGenerator::cgLdLocAddr(IRInstruction* inst) { void CodeGenerator::cgLdStackAddr(IRInstruction* inst) { auto const base = m_regs[inst->src(0)].getReg(); - auto const offset = cellsToBytes(inst->getExtra()->offset); + auto const offset = cellsToBytes(inst->extra()->offset); m_as.lea (base[offset], m_regs[inst->dst()].getReg()); } void CodeGenerator::cgLdStack(IRInstruction* inst) { - assert(inst->getTaken() == nullptr); + assert(inst->taken() == nullptr); cgLoad(m_regs[inst->src(0)].getReg(), - cellsToBytes(inst->getExtra()->offset), + cellsToBytes(inst->extra()->offset), inst); } void CodeGenerator::cgGuardStk(IRInstruction* inst) { auto const rSP = m_regs[inst->src(0)].getReg(); - auto const baseOff = cellsToBytes(inst->getExtra()->offset); - emitTypeGuard(inst->getTypeParam(), + auto const baseOff = cellsToBytes(inst->extra()->offset); + emitTypeGuard(inst->typeParam(), rSP[baseOff + TVOFF(m_type)], rSP[baseOff + TVOFF(m_data)]); } void CodeGenerator::cgCheckStk(IRInstruction* inst) { auto const rbase = m_regs[inst->src(0)].getReg(); - auto const baseOff = cellsToBytes(inst->getExtra()->offset); - emitTypeCheck(inst->getTypeParam(), rbase[baseOff + TVOFF(m_type)], - rbase[baseOff + TVOFF(m_data)], inst->getTaken()); + auto const baseOff = cellsToBytes(inst->extra()->offset); + emitTypeCheck(inst->typeParam(), rbase[baseOff + TVOFF(m_type)], + rbase[baseOff + TVOFF(m_data)], inst->taken()); } void CodeGenerator::cgGuardLoc(IRInstruction* inst) { auto const rFP = m_regs[inst->src(0)].getReg(); - auto const baseOff = getLocalOffset(inst->getExtra()->locId); - emitTypeGuard(inst->getTypeParam(), + auto const baseOff = getLocalOffset(inst->extra()->locId); + emitTypeGuard(inst->typeParam(), rFP[baseOff + TVOFF(m_type)], rFP[baseOff + TVOFF(m_data)]); } void CodeGenerator::cgCheckLoc(IRInstruction* inst) { auto const rbase = m_regs[inst->src(0)].getReg(); - auto const baseOff = getLocalOffset(inst->getExtra()->locId); - emitTypeCheck(inst->getTypeParam(), rbase[baseOff + TVOFF(m_type)], - rbase[baseOff + TVOFF(m_data)], inst->getTaken()); + auto const baseOff = getLocalOffset(inst->extra()->locId); + emitTypeCheck(inst->typeParam(), rbase[baseOff + TVOFF(m_type)], + rbase[baseOff + TVOFF(m_data)], inst->taken()); } template @@ -4065,8 +4065,8 @@ void CodeGenerator::emitSideExitGuard(Type type, void CodeGenerator::cgSideExitGuardLoc(IRInstruction* inst) { auto const fp = m_regs[inst->src(0)].getReg(); - auto const extra = inst->getExtra(); - emitSideExitGuard(inst->getTypeParam(), + auto const extra = inst->extra(); + emitSideExitGuard(inst->typeParam(), fp[getLocalOffset(extra->checkedSlot) + TVOFF(m_type)], fp[getLocalOffset(extra->checkedSlot) + TVOFF(m_data)], extra->taken); @@ -4074,8 +4074,8 @@ void CodeGenerator::cgSideExitGuardLoc(IRInstruction* inst) { void CodeGenerator::cgSideExitGuardStk(IRInstruction* inst) { auto const sp = m_regs[inst->src(0)].getReg(); - auto const extra = inst->getExtra(); - emitSideExitGuard(inst->getTypeParam(), + auto const extra = inst->extra(); + emitSideExitGuard(inst->typeParam(), sp[cellsToBytes(extra->checkedSlot) + TVOFF(m_type)], sp[cellsToBytes(extra->checkedSlot) + TVOFF(m_data)], extra->taken); @@ -4091,9 +4091,9 @@ void CodeGenerator::cgCheckType(IRInstruction* inst) { auto const rData = m_regs[src].getReg(0); auto const rType = m_regs[src].getReg(1); - emitTypeTest(inst->getTypeParam(), rType, rData, + emitTypeTest(inst->typeParam(), rType, rData, [&](ConditionCode cc) { - emitFwdJcc(ccNegate(cc), inst->getTaken()); + emitFwdJcc(ccNegate(cc), inst->taken()); auto const dstReg = m_regs[inst->dst()].getReg(); if (dstReg != InvalidReg) { @@ -4104,8 +4104,8 @@ void CodeGenerator::cgCheckType(IRInstruction* inst) { void CodeGenerator::cgCheckTypeMem(IRInstruction* inst) { auto const reg = m_regs[inst->src(0)].getReg(); - emitTypeCheck(inst->getTypeParam(), reg[TVOFF(m_type)], - reg[TVOFF(m_data)], inst->getTaken()); + emitTypeCheck(inst->typeParam(), reg[TVOFF(m_type)], + reg[TVOFF(m_data)], inst->taken()); } void CodeGenerator::cgGuardRefs(IRInstruction* inst) { @@ -4235,7 +4235,7 @@ void CodeGenerator::cgLdClsMethodCache(IRInstruction* inst) { SSATmp* className = inst->src(0); SSATmp* methodName = inst->src(1); SSATmp* baseClass = inst->src(2); - Block* label = inst->getTaken(); + Block* label = inst->taken(); // Stats::emitInc(a, Stats::TgtCache_StaticMethodHit); const StringData* cls = className->getValStr(); @@ -4356,7 +4356,7 @@ void CodeGenerator::cgLdClsMethodFCache(IRInstruction* inst) { const StringData* methName = inst->src(1)->getValStr(); SSATmp* srcCtxTmp = inst->src(2); PhysReg srcCtxReg = m_regs[srcCtxTmp].getReg(0); - Block* exitLabel = inst->getTaken(); + Block* exitLabel = inst->taken(); const StringData* clsName = cls->name(); CacheHandle ch = StaticMethodFCache::alloc(clsName, methName, getContextName(getCurClass())); @@ -4416,7 +4416,7 @@ void CodeGenerator::cgLdClsPropAddrCached(IRInstruction* inst) { SSATmp* propName = inst->src(1); SSATmp* clsName = inst->src(2); SSATmp* cxt = inst->src(3); - Block* target = inst->getTaken(); + Block* target = inst->taken(); const StringData* propNameString = propName->getValStr(); const StringData* clsNameString = clsName->getValStr(); @@ -4461,7 +4461,7 @@ void CodeGenerator::cgLdClsPropAddr(IRInstruction* inst) { SSATmp* cls = inst->src(0); SSATmp* prop = inst->src(1); SSATmp* cxt = inst->src(2); - Block* target = inst->getTaken(); + Block* target = inst->taken(); auto dstReg = m_regs[dst].getReg(); if (dstReg == InvalidReg && target) { // result is unused but this instruction was not eliminated @@ -4511,7 +4511,7 @@ void CodeGenerator::cgLdClsCached(IRInstruction* inst) { void CodeGenerator::cgLdClsCachedSafe(IRInstruction* inst) { cgLdClsCachedCommon(inst); - if (Block* taken = inst->getTaken()) { + if (Block* taken = inst->taken()) { emitFwdJcc(CC_Z, taken); } } @@ -4547,7 +4547,7 @@ void CodeGenerator::cgLookupClsCns(IRInstruction* inst) { SSATmp* cnsName = inst->src(0); SSATmp* cls = inst->src(1); - assert(inst->getTypeParam() == Type::Cell); + assert(inst->typeParam() == Type::Cell); assert(cnsName->isConst() && cnsName->type() == Type::StaticStr); assert(cls->isConst() && cls->type() == Type::StaticStr); @@ -4603,7 +4603,7 @@ static TypedValue lookupCnsHelper(const TypedValue* tv, StringData* nm) { void CodeGenerator::cgLookupCns(IRInstruction* inst) { SSATmp* cnsNameTmp = inst->src(0); - assert(inst->getTypeParam() == Type::Cell); + assert(inst->typeParam() == Type::Cell); assert(cnsNameTmp->isConst() && cnsNameTmp->type() == Type::StaticStr); const StringData* cnsName = cnsNameTmp->getValStr(); @@ -4702,7 +4702,7 @@ void CodeGenerator::cgLdGblAddr(IRInstruction* inst) { cgCallHelper(m_as, (TCA)ldGblAddrHelper, dstReg, kNoSyncPoint, ArgGroup(m_regs).ssa(inst->src(0))); m_as.testq(dstReg, dstReg); - emitFwdJcc(CC_Z, inst->getTaken()); + emitFwdJcc(CC_Z, inst->taken()); } void CodeGenerator::cgLdGblAddrDef(IRInstruction* inst) { @@ -4734,33 +4734,33 @@ void CodeGenerator::emitTestZero(SSATmp* src) { void CodeGenerator::cgJmpZero(IRInstruction* inst) { emitTestZero(inst->src(0)); - emitFwdJcc(CC_Z, inst->getTaken()); + emitFwdJcc(CC_Z, inst->taken()); } void CodeGenerator::cgJmpNZero(IRInstruction* inst) { emitTestZero(inst->src(0)); - emitFwdJcc(CC_NZ, inst->getTaken()); + emitFwdJcc(CC_NZ, inst->taken()); } void CodeGenerator::cgReqBindJmpZero(IRInstruction* inst) { // TODO(#2404427): prepareForTestAndSmash? emitTestZero(inst->src(0)); - emitReqBindJcc(CC_Z, inst->getExtra()); + emitReqBindJcc(CC_Z, inst->extra()); } void CodeGenerator::cgReqBindJmpNZero(IRInstruction* inst) { // TODO(#2404427): prepareForTestAndSmash? emitTestZero(inst->src(0)); - emitReqBindJcc(CC_NZ, inst->getExtra()); + emitReqBindJcc(CC_NZ, inst->extra()); } void CodeGenerator::cgJmp_(IRInstruction* inst) { - assert(inst->numSrcs() == inst->getTaken()->getLabel()->numDsts()); + assert(inst->numSrcs() == inst->taken()->label()->numDsts()); if (unsigned n = inst->numSrcs()) { // Parallel-copy sources to the label's destination registers. // TODO: t2040286: this only works if all destinations fit in registers. SrcRange srcs = inst->srcs(); - DstRange dsts = inst->getTaken()->getLabel()->dsts(); + DstRange dsts = inst->taken()->label()->dsts(); ArgGroup args(m_regs); for (unsigned i = 0, j = 0; i < n; i++) { assert(srcs[i]->type().subtypeOf(dsts[i].type())); @@ -4792,7 +4792,7 @@ void CodeGenerator::cgJmp_(IRInstruction* inst) { shuffleArgs(m_as, args); } if (!m_state.noTerminalJmp_) { - emitFwdJmp(m_as, inst->getTaken(), m_state); + emitFwdJmp(m_as, inst->taken(), m_state); } } @@ -4801,7 +4801,7 @@ void CodeGenerator::cgJmpIndirect(IRInstruction* inst) { } void CodeGenerator::cgCheckInit(IRInstruction* inst) { - Block* label = inst->getTaken(); + Block* label = inst->taken(); assert(label); SSATmp* src = inst->src(0); @@ -4816,7 +4816,7 @@ void CodeGenerator::cgCheckInit(IRInstruction* inst) { } void CodeGenerator::cgCheckInitMem(IRInstruction* inst) { - Block* label = inst->getTaken(); + Block* label = inst->taken(); assert(label); SSATmp* base = inst->src(0); int64_t offset = inst->src(1)->getValInt(); @@ -4828,14 +4828,14 @@ void CodeGenerator::cgCheckInitMem(IRInstruction* inst) { } void CodeGenerator::cgExitWhenSurprised(IRInstruction* inst) { - Block* label = inst->getTaken(); + Block* label = inst->taken(); m_tx64->emitTestSurpriseFlags(m_as); emitFwdJcc(CC_NZ, label); } void CodeGenerator::cgExitOnVarEnv(IRInstruction* inst) { SSATmp* fp = inst->src(0); - Block* label = inst->getTaken(); + Block* label = inst->taken(); assert(!(fp->isConst())); @@ -4845,7 +4845,7 @@ void CodeGenerator::cgExitOnVarEnv(IRInstruction* inst) { } void CodeGenerator::cgReleaseVVOrExit(IRInstruction* inst) { - auto* const label = inst->getTaken(); + auto* const label = inst->taken(); auto const rFp = m_regs[inst->src(0)].getReg(); m_as. cmpq (0, rFp[AROFF(m_varEnv)]); @@ -5024,7 +5024,7 @@ void CodeGenerator::cgContRaiseCheck(IRInstruction* inst) { SSATmp* cont = inst->src(0); m_as.test_imm32_disp_reg32(0x1, CONTOFF(m_should_throw), m_regs[cont].getReg()); - emitFwdJcc(CC_NZ, inst->getTaken()); + emitFwdJcc(CC_NZ, inst->taken()); } void CodeGenerator::cgContPreNext(IRInstruction* inst) { @@ -5035,7 +5035,7 @@ void CodeGenerator::cgContPreNext(IRInstruction* inst) { "m_done should immediately precede m_running"); // Check m_done and m_running at the same time m_as.test_imm32_disp_reg32(0x0101, doneOffset, contReg); - emitFwdJcc(CC_NZ, inst->getTaken()); + emitFwdJcc(CC_NZ, inst->taken()); // ++m_index m_as.add_imm64_disp_reg64(0x1, CONTOFF(m_index), contReg); @@ -5046,7 +5046,7 @@ void CodeGenerator::cgContPreNext(IRInstruction* inst) { void CodeGenerator::cgContStartedCheck(IRInstruction* inst) { m_as.cmp_imm64_disp_reg64(0, CONTOFF(m_index), m_regs[inst->src(0)].getReg()); - emitFwdJcc(CC_L, inst->getTaken()); + emitFwdJcc(CC_L, inst->taken()); } void CodeGenerator::cgIterNextK(IRInstruction* inst) { @@ -5143,7 +5143,7 @@ void traceCallback(ActRec* fp, Cell* sp, int64_t pcOff, void* rip) { } void CodeGenerator::cgDbgAssertType(IRInstruction* inst) { - emitTypeTest(inst->getTypeParam(), + emitTypeTest(inst->typeParam(), m_regs[inst->src(0)].getReg(1), m_regs[inst->src(0)].getReg(0), [&](ConditionCode cc) { @@ -5206,7 +5206,7 @@ void CodeGenerator::cgBlock(Block* block, vector* bcMap) { for (IRInstruction& instr : *block) { IRInstruction* inst = &instr; if (inst->op() == Marker) { - m_state.lastMarker = inst->getExtra(); + m_state.lastMarker = inst->extra(); if (m_tx64 && m_tx64->isTransDBEnabled() && bcMap) { bcMap->push_back((TransBCMapping){Offset(m_state.lastMarker->bcOff), m_as.code.frontier, @@ -5235,8 +5235,8 @@ LiveRegs computeLiveRegs(const IRFactory* factory, const RegAllocInfo& regs, postorderWalk( [&](Block* block) { RegSet& live = liveMap[block]; - if (Block* taken = block->getTaken()) live = liveMap[taken]; - if (Block* next = block->getNext()) live |= liveMap[next]; + if (Block* taken = block->taken()) live = liveMap[taken]; + if (Block* next = block->next()) live |= liveMap[next]; for (auto it = block->end(); it != block->begin(); ) { IRInstruction& inst = *--it; for (const SSATmp& dst : inst.dsts()) { @@ -5290,7 +5290,7 @@ void genCodeForTrace(Trace* trace, // If the block ends with a Jmp_ and the next block is going to be // its target, we don't need to actually emit it. IRInstruction* last = block->back(); - state.noTerminalJmp_ = last->op() == Jmp_ && nextBlock == last->getTaken(); + state.noTerminalJmp_ = last->op() == Jmp_ && nextBlock == last->taken(); CodeGenerator cg(trace, a, astubs, tx64, state); if (state.asmInfo) { @@ -5299,7 +5299,7 @@ void genCodeForTrace(Trace* trace, cg.cgBlock(block, bcMap); state.lastMarker = nullptr; - if (auto next = block->getNext()) { + if (auto next = block->next()) { if (next != nextBlock) { // If there's a fallthrough block and it's not the next thing // going into this assembler, then emit a jump to it. diff --git a/hphp/runtime/vm/translator/hopt/dce.cpp b/hphp/runtime/vm/translator/hopt/dce.cpp index b0a7c11a2..82c71f8d7 100644 --- a/hphp/runtime/vm/translator/hopt/dce.cpp +++ b/hphp/runtime/vm/translator/hopt/dce.cpp @@ -117,7 +117,7 @@ typedef StateVector UseCounts; typedef std::list WorkList; void removeDeadInstructions(Trace* trace, const DceState& state) { - auto &blocks = trace->getBlocks(); + auto &blocks = trace->blocks(); for (auto it = blocks.begin(), end = blocks.end(); it != end;) { auto cur = it; ++it; Block* block = *cur; @@ -187,7 +187,7 @@ BlockList removeUnreachable(Trace* trace, IRFactory* factory) { continue; } FTRACE(5, "erasing block {}\n", (*bit)->id()); - if ((*bit)->getTaken() && (*bit)->back()->op() == Jmp_) { + if ((*bit)->taken() && (*bit)->back()->op() == Jmp_) { needsReflow = true; } bit = t->erase(bit); @@ -212,7 +212,7 @@ initInstructions(const BlockList& blocks, DceState& state) { if (inst.isControlFlowInstruction()) { // mark the destination label so that the destination trace // is marked reachable - state[inst.getTaken()->getLabel()].setLive(); + state[inst.taken()->label()].setLive(); } if (inst.isEssential()) { state[inst].setLive(); @@ -374,10 +374,10 @@ void sinkIncRefs(Trace* trace, IRFactory* irFactory, DceState& state) { toSink.remove(srcInst); } } - if (Block* target = inst->getTaken()) { + if (Block* target = inst->taken()) { if (!pushedTo[target->id()]) { pushedTo[target->id()] = 1; - Trace* exit = target->getTrace(); + Trace* exit = target->trace(); if (exit != trace) processExit(exit); } } @@ -526,7 +526,7 @@ void consumeIncRef(const IRInstruction* consumer, const SSATmp* src, const IRInstruction* srcInst = src->inst(); visitedSrcs.insert(src); if (srcInst->op() == CheckType && - srcInst->getTypeParam().maybeCounted()) { + srcInst->typeParam().maybeCounted()) { // srcInst is a CheckType that guards to a refcounted type. We need to // trace through to its source. If the CheckType guards to a non-refcounted // type then the reference is consumed by CheckType itself. @@ -537,7 +537,7 @@ void consumeIncRef(const IRInstruction* consumer, const SSATmp* src, // providing a value for it. for (unsigned i = 0, n = srcInst->numDsts(); i < n; ++i) { if (srcInst->dst(i) == src) { - srcInst->getBlock()->forEachSrc(i, + srcInst->block()->forEachSrc(i, [&](IRInstruction* jmp, SSATmp* val) { consumeIncRef(consumer, val, state, ssas, visitedSrcs); } @@ -559,7 +559,7 @@ void consumeIncRef(const IRInstruction* consumer, const SSATmp* src, if (srcInst->op() == IncRef) { // consumes which is an IncRef, so we mark as // REFCOUNT_CONSUMED. - if (consumer->getTrace()->isMain() || !srcInst->getTrace()->isMain()) { + if (consumer->trace()->isMain() || !srcInst->trace()->isMain()) { // is consumed from its own trace. state[srcInst].setCountConsumed(); } else { @@ -579,7 +579,7 @@ void consumeIncRef(const IRInstruction* consumer, const SSATmp* src, // Publicly exported functions: void removeDeadInstructions(Trace* trace, const boost::dynamic_bitset<>& live) { - auto &blocks = trace->getBlocks(); + auto &blocks = trace->blocks(); for (auto it = blocks.begin(), end = blocks.end(); it != end;) { auto cur = it; ++it; Block* block = *cur; @@ -594,7 +594,7 @@ void removeDeadInstructions(Trace* trace, const boost::dynamic_bitset<>& live) { void eliminateDeadCode(Trace* trace, IRFactory* irFactory) { auto removeEmptyExitTraces = [&] { trace->getExitTraces().remove_if([](Trace* exit) { - return exit->getBlocks().empty(); + return exit->blocks().empty(); }); }; diff --git a/hphp/runtime/vm/translator/hopt/extradata.h b/hphp/runtime/vm/translator/hopt/extradata.h index 0f2853e3d..57a08cb28 100644 --- a/hphp/runtime/vm/translator/hopt/extradata.h +++ b/hphp/runtime/vm/translator/hopt/extradata.h @@ -312,7 +312,7 @@ X(SideExitGuardStk, SideExitGuardData); template struct AssertExtraTypes { static void doassert() { - assert(!"called getExtra on an opcode without extra data"); + assert(!"called extra on an opcode without extra data"); } }; @@ -320,7 +320,7 @@ template struct AssertExtraTypes { static void doassert() { typedef typename IRExtraDataType::type ExtraType; if (!std::is_same::value) { - assert(!"getExtra was called with an extra data " + assert(!"extra was called with an extra data " "type that doesn't match the opcode type"); } } diff --git a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp index 7a88e79f9..09865bc78 100644 --- a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp @@ -2090,7 +2090,7 @@ SSATmp* HhbcTranslator::emitDecRefLocalsInline(SSATmp* retVal) { * matter. This will need to be revisted then. */ int retValLocId = (!isInlining() && retValSrcLoc && retValSrcOpc == LdLoc) ? - retValSrcLoc->inst()->getExtra()->locId : -1; + retValSrcLoc->inst()->extra()->locId : -1; for (int id = getCurFunc()->numLocals() - 1; id >= 0; --id) { if (retValLocId == id) { gen(DecRef, retVal); @@ -2700,7 +2700,7 @@ void HhbcTranslator::emitBindMem(SSATmp* ptr, SSATmp* src) { pushIncRef(src); gen(StMem, ptr, cns(0), src); if (isRefCounted(src) && src->type().canRunDtor()) { - Block* exitBlock = getExitTrace(getNextSrcKey().offset())->front(); + Block* exitBlock = getExitTrace(nextSrcKey().offset())->front(); Block::iterator markerInst = exitBlock->skipLabel(); exitBlock->insert(++markerInst, m_irFactory.gen(DecRef, prevValue)); gen(DecRefNZOrBranch, exitBlock, prevValue); @@ -2955,7 +2955,7 @@ void HhbcTranslator::emitMod() { // will raise a notice and produce the boolean false. Punch out // here and resume after the Mod instruction; this should be rare. auto const exit = getExitTraceWarn( - getNextSrcKey().offset(), + nextSrcKey().offset(), exitSpillValues, StringData::GetStaticString(Strings::DIVISION_BY_ZERO) ); diff --git a/hphp/runtime/vm/translator/hopt/hhbctranslator.h b/hphp/runtime/vm/translator/hopt/hhbctranslator.h index 8c047b020..5bfac0c77 100644 --- a/hphp/runtime/vm/translator/hopt/hhbctranslator.h +++ b/hphp/runtime/vm/translator/hopt/hhbctranslator.h @@ -107,8 +107,8 @@ struct HhbcTranslator { const Func* func); // Accessors. - Trace* getTrace() const { return m_tb->getTrace(); } - TraceBuilder* getTraceBuilder() const { return m_tb.get(); } + Trace* trace() const { return m_tb->trace(); } + TraceBuilder* traceBuilder() const { return m_tb.get(); } // In between each emit* call, irtranslator indicates the new // bytecode offset (or whether we're finished) using this API. @@ -591,7 +591,7 @@ private: * Return the SrcKey for the next HHBC (whether it is in this * tracelet or not). */ - SrcKey getNextSrcKey() const { + SrcKey nextSrcKey() const { SrcKey srcKey(getCurFunc(), bcOff()); srcKey.advance(getCurFunc()->unit()); return srcKey; diff --git a/hphp/runtime/vm/translator/hopt/ir.cpp b/hphp/runtime/vm/translator/hopt/ir.cpp index 30acd6d21..a261fe947 100644 --- a/hphp/runtime/vm/translator/hopt/ir.cpp +++ b/hphp/runtime/vm/translator/hopt/ir.cpp @@ -303,7 +303,7 @@ IRInstruction::IRInstruction(Arena& arena, const IRInstruction* inst, Id id) : nullptr) { std::copy(inst->m_srcs, inst->m_srcs + inst->m_numSrcs, m_srcs); - setTaken(inst->getTaken()); + setTaken(inst->taken()); } const char* opcodeName(Opcode opcode) { return OpInfo[opcode].name; } @@ -319,8 +319,8 @@ Opcode getStackModifyingOpcode(Opcode opc) { return opc; } -Trace* IRInstruction::getTrace() const { - return getBlock()->getTrace(); +Trace* IRInstruction::trace() const { + return block()->trace(); } bool IRInstruction::hasExtra() const { @@ -378,7 +378,7 @@ bool IRInstruction::consumesReference(int srcNo) const { // to a notCounted type. if (m_op == CheckType) { assert(srcNo == 0); - return src(0)->type().maybeCounted() && getTypeParam().notCounted(); + return src(0)->type().maybeCounted() && typeParam().notCounted(); } // SpillStack consumes inputs 2 and onward if (m_op == SpillStack) return srcNo >= 2; @@ -811,14 +811,14 @@ void IRInstruction::convertToNop() { void IRInstruction::convertToJmp() { assert(isControlFlowInstruction()); - assert(getBlock()->back() == this); + assert(block()->back() == this); m_op = Jmp_; m_typeParam = Type::None; m_numSrcs = 0; m_numDsts = 0; m_srcs = nullptr; m_dst = nullptr; - getBlock()->setNext(nullptr); + block()->setNext(nullptr); } void IRInstruction::convertToMov() { @@ -841,7 +841,7 @@ void IRInstruction::become(IRFactory* factory, IRInstruction* other) { m_extra = other->m_extra ? cloneExtra(m_op, other->m_extra, arena) : nullptr; m_srcs = new (arena) SSATmp*[m_numSrcs]; std::copy(other->m_srcs, other->m_srcs + m_numSrcs, m_srcs); - setTaken(other->getTaken()); + setTaken(other->taken()); } IRInstruction* IRInstruction::clone(IRFactory* factory) const { @@ -867,7 +867,7 @@ bool Block::isMain() const { } bool Block::isExit() const { - return !getTaken() && !getNext(); + return !taken() && !next(); } bool IRInstruction::cseEquals(IRInstruction* inst) const { @@ -947,83 +947,83 @@ int SSATmp::numNeededRegs() const { bool SSATmp::getValBool() const { assert(isConst()); - assert(m_inst->getTypeParam().equals(Type::Bool)); - return m_inst->getExtra()->as(); + assert(m_inst->typeParam().equals(Type::Bool)); + return m_inst->extra()->as(); } int64_t SSATmp::getValInt() const { assert(isConst()); - assert(m_inst->getTypeParam().equals(Type::Int)); - return m_inst->getExtra()->as(); + assert(m_inst->typeParam().equals(Type::Int)); + return m_inst->extra()->as(); } int64_t SSATmp::getValRawInt() const { assert(isConst()); - return m_inst->getExtra()->as(); + return m_inst->extra()->as(); } double SSATmp::getValDbl() const { assert(isConst()); - assert(m_inst->getTypeParam().equals(Type::Dbl)); - return m_inst->getExtra()->as(); + assert(m_inst->typeParam().equals(Type::Dbl)); + return m_inst->extra()->as(); } const StringData* SSATmp::getValStr() const { assert(isConst()); - assert(m_inst->getTypeParam().equals(Type::StaticStr)); - return m_inst->getExtra()->as(); + assert(m_inst->typeParam().equals(Type::StaticStr)); + return m_inst->extra()->as(); } const ArrayData* SSATmp::getValArr() const { assert(isConst()); // TODO: Task #2124292, Reintroduce StaticArr - assert(m_inst->getTypeParam().subtypeOf(Type::Arr)); - return m_inst->getExtra()->as(); + assert(m_inst->typeParam().subtypeOf(Type::Arr)); + return m_inst->extra()->as(); } const Func* SSATmp::getValFunc() const { assert(isConst()); - assert(m_inst->getTypeParam().equals(Type::Func)); - return m_inst->getExtra()->as(); + assert(m_inst->typeParam().equals(Type::Func)); + return m_inst->extra()->as(); } const Class* SSATmp::getValClass() const { assert(isConst()); - assert(m_inst->getTypeParam().equals(Type::Cls)); - return m_inst->getExtra()->as(); + assert(m_inst->typeParam().equals(Type::Cls)); + return m_inst->extra()->as(); } const NamedEntity* SSATmp::getValNamedEntity() const { assert(isConst()); - assert(m_inst->getTypeParam().equals(Type::NamedEntity)); - return m_inst->getExtra()->as(); + assert(m_inst->typeParam().equals(Type::NamedEntity)); + return m_inst->extra()->as(); } uintptr_t SSATmp::getValBits() const { assert(isConst()); - return m_inst->getExtra()->as(); + return m_inst->extra()->as(); } Variant SSATmp::getValVariant() const { - switch (m_inst->getTypeParam().toDataType()) { + switch (m_inst->typeParam().toDataType()) { case KindOfUninit: case KindOfNull: return uninit_null(); case KindOfBoolean: - return m_inst->getExtra()->as(); + return m_inst->extra()->as(); case KindOfInt64: - return m_inst->getExtra()->as(); + return m_inst->extra()->as(); case KindOfDouble: - return m_inst->getExtra()->as(); + return m_inst->extra()->as(); case KindOfString: case KindOfStaticString: - return (litstr)m_inst->getExtra() + return (litstr)m_inst->extra() ->as()->data(); case KindOfArray: - return Array(ArrayData::GetScalarArray(m_inst->getExtra() + return Array(ArrayData::GetScalarArray(m_inst->extra() ->as())); case KindOfObject: - return m_inst->getExtra()->as(); + return m_inst->extra()->as(); default: assert(false); return uninit_null(); @@ -1032,8 +1032,8 @@ Variant SSATmp::getValVariant() const { TCA SSATmp::getValTCA() const { assert(isConst()); - assert(m_inst->getTypeParam().equals(Type::TCA)); - return m_inst->getExtra()->as(); + assert(m_inst->typeParam().equals(Type::TCA)); + return m_inst->extra()->as(); } std::string SSATmp::toString() const { @@ -1165,9 +1165,9 @@ DomChildren findDomChildren(const BlockList& blocks) { } bool hasInternalFlow(Trace* trace) { - for (Block* block : trace->getBlocks()) { - if (Block* taken = block->getTaken()) { - if (taken->getTrace() == trace) return true; + for (Block* block : trace->blocks()) { + if (Block* taken = block->taken()) { + if (taken->trace() == trace) return true; } } return false; diff --git a/hphp/runtime/vm/translator/hopt/irinstruction.h b/hphp/runtime/vm/translator/hopt/irinstruction.h index a2f2cfca1..cbc7c438a 100644 --- a/hphp/runtime/vm/translator/hopt/irinstruction.h +++ b/hphp/runtime/vm/translator/hopt/irinstruction.h @@ -79,15 +79,15 @@ struct IRInstruction { * Pre: op() == opc */ template - const typename IRExtraDataType::type* getExtra() const { - assert(opc == op() && "getExtra type error"); + const typename IRExtraDataType::type* extra() const { + assert(opc == op() && "ExtraData type error"); assert(m_extra != nullptr); return static_cast::type*>(m_extra); } template - typename IRExtraDataType::type* getExtra() { - assert(opc == op() && "getExtra type error"); + typename IRExtraDataType::type* extra() { + assert(opc == op() && "ExtraData type error"); return static_cast::type*>(m_extra); } @@ -100,7 +100,7 @@ struct IRInstruction { * that is supposed to be able to handle multiple opcode types that * share the same kind of extra data. */ - template const T* getExtra() const { + template const T* extra() const { auto opcode = op(); if (debug) assert_opcode_extra(opcode); return static_cast(m_extra); @@ -172,7 +172,7 @@ struct IRInstruction { Opcode op() const { return m_op; } void setOpcode(Opcode newOpc) { m_op = newOpc; } - Type getTypeParam() const { return m_typeParam; } + Type typeParam() const { return m_typeParam; } void setTypeParam(Type t) { m_typeParam = t; } uint32_t numSrcs() const { return m_numSrcs; } void setNumSrcs(uint32_t i) { @@ -223,21 +223,21 @@ struct IRInstruction { * inserting it in any blocks. */ bool isTransient() const { return m_id == kTransient; } - Trace* getTrace() const; + Trace* trace() const; /* - * getBlock() and setBlock() keep track of the block that contains this + * block() and setBlock() keep track of the block that contains this * instruction, as well as where the taken edge is coming from, if there * is a taken edge. */ - Block* getBlock() const { return m_taken.from(); } + Block* block() const { return m_taken.from(); } void setBlock(Block* b) { m_taken.setFrom(b); } /* * Optional control flow edge. If present, this instruction must * be the last one in the block. */ - Block* getTaken() const { return m_taken.to(); } + Block* taken() const { return m_taken.to(); } void setTaken(Block* b) { if (isTransient()) m_taken.setTransientTo(b); else m_taken.setTo(b); diff --git a/hphp/runtime/vm/translator/hopt/irtranslator.cpp b/hphp/runtime/vm/translator/hopt/irtranslator.cpp index 180e101b1..f96e9d3ae 100644 --- a/hphp/runtime/vm/translator/hopt/irtranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/irtranslator.cpp @@ -1869,7 +1869,7 @@ TranslatorX64::irTranslateTracelet(Tracelet& t, StackTraceNoHeap::AddExtraLogging( "Assertion failure", folly::format("{}\n\nActive Trace:\n{}\n", - fa.summary, m_hhbcTrans->getTrace()->toString()).str()); + fa.summary, m_hhbcTrans->trace()->toString()).str()); abort(); } catch (const std::exception& e) { transResult = Failure; @@ -1921,7 +1921,7 @@ void TranslatorX64::hhirTraceEnd() { void TranslatorX64::hhirTraceCodeGen(vector* bcMap) { using namespace JIT; - HPHP::JIT::Trace* trace = m_hhbcTrans->getTrace(); + HPHP::JIT::Trace* trace = m_hhbcTrans->trace(); auto finishPass = [&](const char* msg, int level, const RegAllocInfo* regs = nullptr, const LifetimeInfo* lifetime = nullptr) { @@ -1930,7 +1930,7 @@ void TranslatorX64::hhirTraceCodeGen(vector* bcMap) { }; finishPass(" after initial translation ", kIRLevel); - optimizeTrace(trace, m_hhbcTrans->getTraceBuilder()); + optimizeTrace(trace, m_hhbcTrans->traceBuilder()); finishPass(" after optimizing ", kOptLevel); auto* factory = m_irFactory.get(); diff --git a/hphp/runtime/vm/translator/hopt/jumpopts.cpp b/hphp/runtime/vm/translator/hopt/jumpopts.cpp index 16a8de78d..af9927465 100644 --- a/hphp/runtime/vm/translator/hopt/jumpopts.cpp +++ b/hphp/runtime/vm/translator/hopt/jumpopts.cpp @@ -36,14 +36,14 @@ namespace { void elimUnconditionalJump(Trace* trace, IRFactory* irFactory) { boost::dynamic_bitset<> isJoin(irFactory->numBlocks()); boost::dynamic_bitset<> havePred(irFactory->numBlocks()); - for (Block* block : trace->getBlocks()) { - if (block->getTaken()) { - auto id = block->getTaken()->id(); + for (Block* block : trace->blocks()) { + if (block->taken()) { + auto id = block->taken()->id(); isJoin[id] = havePred[id]; havePred[id] = 1; } - if (block->getNext()) { - auto id = block->getNext()->id(); + if (block->next()) { + auto id = block->next()->id(); isJoin[id] = havePred[id]; havePred[id] = 1; } @@ -51,8 +51,8 @@ void elimUnconditionalJump(Trace* trace, IRFactory* irFactory) { Block* lastBlock = trace->back(); auto lastInst = lastBlock->backIter(); // iterator to last instruction IRInstruction& jmp = *lastInst; - if (jmp.op() == Jmp_ && !isJoin[jmp.getTaken()->id()]) { - Block* target = jmp.getTaken(); + if (jmp.op() == Jmp_ && !isJoin[jmp.taken()->id()]) { + Block* target = jmp.taken(); lastBlock->splice(lastInst, target, target->skipLabel(), target->end()); lastBlock->erase(lastInst); // delete the jmp } @@ -152,14 +152,14 @@ void optimizeCondTraceExit(Trace* trace, IRFactory* irFactory) { opcodeName(jccBlock->back()->op())); auto const jccInst = jccBlock->back(); - auto const jccExitTrace = jccInst->getTaken(); + auto const jccExitTrace = jccInst->taken(); if (!isNormalExit(jccExitTrace)) return; FTRACE(5, "exit trace is side-effect free\n"); auto const newOpcode = jmpToReqBindJmp(jccBlock->back()->op()); ReqBindJccData data; - data.taken = jccExitTrace->back()->getExtra()->offset; - data.notTaken = mainExit->back()->getExtra()->offset; + data.taken = jccExitTrace->back()->extra()->offset; + data.notTaken = mainExit->back()->extra()->offset; FTRACE(5, "replacing {} with {}\n", jccInst->id(), opcodeName(newOpcode)); irFactory->replace( @@ -183,7 +183,7 @@ void optimizeSideExits(Trace* trace, IRFactory* irFactory) { forEachInst(trace, [&] (IRInstruction* inst) { if (inst->op() != CheckStk && inst->op() != CheckLoc) return; - auto const exitBlock = inst->getTaken(); + auto const exitBlock = inst->taken(); if (!isNormalExit(exitBlock)) return; auto const syncABI = &*boost::prior(exitBlock->backIter()); @@ -198,18 +198,18 @@ void optimizeSideExits(Trace* trace, IRFactory* irFactory) { SideExitGuardData data; data.checkedSlot = isStack - ? inst->getExtra()->offset - : inst->getExtra()->locId; - data.taken = exitBlock->back()->getExtra()->offset; + ? inst->extra()->offset + : inst->extra()->locId; + data.taken = exitBlock->back()->extra()->offset; - auto const block = inst->getBlock(); + auto const block = inst->block(); block->insert(block->iteratorTo(inst), irFactory->cloneInstruction(syncABI)); irFactory->replace( inst, isStack ? SideExitGuardStk : SideExitGuardLoc, - inst->getTypeParam(), + inst->typeParam(), data, isStack ? sp : fp ); diff --git a/hphp/runtime/vm/translator/hopt/layout.cpp b/hphp/runtime/vm/translator/hopt/layout.cpp index 3919cbfa6..ab1eb6284 100644 --- a/hphp/runtime/vm/translator/hopt/layout.cpp +++ b/hphp/runtime/vm/translator/hopt/layout.cpp @@ -32,8 +32,8 @@ void postorderWalk(smart::vector& out, Block* block) { if (visited[block]) return; visited[block] = true; - if (auto t = block->getTaken()) postorderWalk(out, visited, t); - if (auto n = block->getNext()) postorderWalk(out, visited, n); + if (auto t = block->taken()) postorderWalk(out, visited, t); + if (auto n = block->next()) postorderWalk(out, visited, n); out.push_back(block); } @@ -57,7 +57,7 @@ smart::vector rpoForCodegen(const IRFactory& factory, Block* head) { */ LayoutInfo layoutBlocks(Trace* trace, const IRFactory& irFactory) { LayoutInfo ret; - ret.blocks = rpoForCodegen(irFactory, trace->getBlocks().front()); + ret.blocks = rpoForCodegen(irFactory, trace->blocks().front()); // Optionally stress test by randomizing the positions. if (RuntimeOption::EvalHHIRStressCodegenBlocks) { @@ -71,7 +71,7 @@ LayoutInfo layoutBlocks(Trace* trace, const IRFactory& irFactory) { ret.astubsIt = std::stable_partition( ret.blocks.begin(), ret.blocks.end(), [&] (Block* b) { - return b->isMain() && b->getHint() != Block::Unlikely; + return b->isMain() && b->hint() != Block::Unlikely; } ); diff --git a/hphp/runtime/vm/translator/hopt/linearscan.cpp b/hphp/runtime/vm/translator/hopt/linearscan.cpp index b1705309b..4fe66a4f6 100644 --- a/hphp/runtime/vm/translator/hopt/linearscan.cpp +++ b/hphp/runtime/vm/translator/hopt/linearscan.cpp @@ -156,8 +156,8 @@ private: RegNumber getJmpPreColor(SSATmp* tmp, uint32_t regIndx, bool isReload); void computePreColoringHint(); void findFullXMMCandidates(); - IRInstruction* getNextNative() const; - uint32_t getNextNativeId() const; + IRInstruction* nextNative() const; + uint32_t nextNativeId() const; void pushFreeReg(RegState* reg); RegState* popFreeReg(smart::list& freeList); @@ -397,7 +397,7 @@ void LinearScan::allocRegToInstruction(InstructionList::iterator it) { // Insert the Reload instruction. SSATmp* spillTmp = m_slots[slotId].spillTmp; IRInstruction* reload = m_irFactory->gen(Reload, spillTmp); - inst->getBlock()->insert(it, reload); + inst->block()->insert(it, reload); // Create which inherits 's slot ID and // 's last use ID. @@ -420,7 +420,7 @@ void LinearScan::allocRegToInstruction(InstructionList::iterator it) { freeRegsAtId(m_linear[inst]); // Update next native. - if (getNextNative() == inst) { + if (nextNative() == inst) { assert(!m_natives.empty()); m_natives.pop_front(); computePreColoringHint(); @@ -498,7 +498,7 @@ void LinearScan::allocRegToInstruction(InstructionList::iterator it) { } bool LinearScan::crossNativeCall(const SSATmp* tmp) const { - return m_uses[tmp].lastUse > getNextNativeId(); + return m_uses[tmp].lastUse > nextNativeId(); } /* @@ -574,7 +574,7 @@ int LinearScan::allocRegToTmp(SSATmp* ssaTmp, uint32_t index) { if (m_spillSlots[ssaTmp] == -1) { createSpillSlot(ssaTmp); } - m_uses[ssaTmp].lastUse = getNextNativeId(); + m_uses[ssaTmp].lastUse = nextNativeId(); } assignRegToTmp(reg, ssaTmp, index); @@ -661,7 +661,7 @@ uint32_t LinearScan::assignSpillLoc() { spillLocManager.setNextSpillLoc(it->second); } for (IRInstruction& inst : *block) { - if (getNextNative() == &inst) { + if (nextNative() == &inst) { assert(!m_natives.empty()); m_natives.pop_front(); } @@ -706,9 +706,9 @@ uint32_t LinearScan::assignSpillLoc() { } uint32_t totalSpillLocs = spillLocManager.getNumSpillLocs(); if (totalSpillLocs > maxSpillLoc) maxSpillLoc = totalSpillLocs; - if (block->getTrace()->isMain()) { - if (Block* taken = block->getTaken()) { - if (!taken->getTrace()->isMain()) { + if (block->trace()->isMain()) { + if (Block* taken = block->taken()) { + if (!taken->trace()->isMain()) { exitLocMap[taken] = totalSpillLocs; } } @@ -724,10 +724,10 @@ void LinearScan::collectInfo(BlockList::iterator it, Trace* trace) { while (it != m_blocks.end()) { Block* block = *it++; - bool offTrace = block->getTrace() != trace; + bool offTrace = block->trace() != trace; if (offTrace) { if (!trace->isMain()) return; - int lastId = block->getTrace()->getData(); + int lastId = block->trace()->getData(); for (IRInstruction& inst : *block) { for (auto* src : inst.srcs()) { if (lastId > m_uses[src].lastUse) { @@ -755,7 +755,7 @@ void LinearScan::collectInfo(BlockList::iterator it, Trace* trace) { void LinearScan::computePreColoringHint() { m_preColoringHint.clear(); - IRInstruction* inst = getNextNative(); + IRInstruction* inst = nextNative(); if (inst == nullptr) { return; } @@ -874,9 +874,9 @@ void LinearScan::computePreColoringHint() { static RegNumber findLabelSrcReg(const RegAllocInfo& regs, IRInstruction* label, unsigned dstIdx, uint32_t regIndex) { assert(label->op() == DefLabel); - SSATmp* withReg = label->getBlock()->findSrc(dstIdx, [&](SSATmp* src) { + SSATmp* withReg = label->block()->findSrc(dstIdx, [&](SSATmp* src) { return regs[src].getReg(regIndex) != InvalidReg && - src->inst()->getBlock()->getHint() != Block::Unlikely; + src->inst()->block()->hint() != Block::Unlikely; }); return withReg ? regs[withReg].getReg(regIndex) : reg::noreg; } @@ -912,7 +912,7 @@ RegNumber LinearScan::getJmpPreColor(SSATmp* tmp, uint32_t regIndex, // block is unreachable. const DEBUG_ONLY bool unreachable = std::find(m_blocks.begin(), m_blocks.end(), - srcInst->getBlock()) == m_blocks.end(); + srcInst->block()) == m_blocks.end(); always_assert(reg != reg::noreg || unreachable); return reg; } @@ -925,7 +925,7 @@ RegNumber LinearScan::getJmpPreColor(SSATmp* tmp, uint32_t regIndex, // same procedure as above. for (unsigned ji = 0, jn = jmps.size(); ji < jn; ++ji) { IRInstruction* jmp = jmps[ji]; - IRInstruction* label = jmp->getTaken()->front(); + IRInstruction* label = jmp->taken()->front(); // Figure out which src of the Jmp_ is tmp for (unsigned si = 0, sn = jmp->numSrcs(); si < sn; ++si) { @@ -984,10 +984,10 @@ void LinearScan::numberInstructions(const BlockList& blocks) { m_uses[tmp].count++; } } - if (block->getTaken() && block->isMain() && !block->getTaken()->isMain()) { + if (block->taken() && block->isMain() && !block->taken()->isMain()) { // reserve a spot for the lastUseId when we're processing the main // trace, if the last use is really in an exit trace. - block->getTaken()->getTrace()->setData(nextId++); + block->taken()->trace()->setData(nextId++); } } } @@ -1005,13 +1005,13 @@ void LinearScan::genSpillStats(Trace* trace, int numSpillLocs) { m_blocks, [&](IRInstruction* inst) { if (inst->op() == Spill) { - if (inst->getBlock()->isMain()) { + if (inst->block()->isMain()) { numMainSpills++; } else { numExitSpills++; } } else if (inst->op() == Reload) { - if (inst->getBlock()->isMain()) { + if (inst->block()->isMain()) { numMainReloads++; } else { numExitReloads++; @@ -1123,7 +1123,7 @@ RegAllocInfo LinearScan::allocRegs(Trace* trace, LifetimeInfo* lifetime) { void LinearScan::allocRegsOneTrace(BlockList::iterator& blockIt, ExitTraceMap& etm) { - auto const trace = (*blockIt)->getTrace(); + auto const trace = (*blockIt)->trace(); collectInfo(blockIt, trace); computePreColoringHint(); @@ -1143,7 +1143,7 @@ void LinearScan::allocRegsOneTrace(BlockList::iterator& blockIt, size_t sz = m_slots.size(); while (blockIt != m_blocks.end()) { Block* block = *blockIt; - if (block->getTrace() != trace) { + if (block->trace() != trace) { if (!isMain) { break; } else { @@ -1158,7 +1158,7 @@ void LinearScan::allocRegsOneTrace(BlockList::iterator& blockIt, // clear remembered reloads that don't dominate this block for (SlotInfo& slot : m_slots) { if (SSATmp* reload = slot.latestReload) { - if (!dominates(reload->inst()->getBlock(), block, m_idoms)) { + if (!dominates(reload->inst()->block(), block, m_idoms)) { slot.latestReload = nullptr; } } @@ -1168,10 +1168,10 @@ void LinearScan::allocRegsOneTrace(BlockList::iterator& blockIt, dumpIR(&*it, "allocated to instruction "); } if (isMain) { - assert(block->getTrace()->isMain()); - if (block->getTaken() && - !block->getTaken()->getTrace()->isMain()) { - etm[block->getTaken()].save(this); + assert(block->trace()->isMain()); + if (block->taken() && + !block->taken()->trace()->isMain()) { + etm[block->taken()].save(this); } } ++blockIt; @@ -1192,18 +1192,18 @@ void LinearScan::allocRegsOneTrace(BlockList::iterator& blockIt, SlotInfo& slot = m_slots[begin++]; IRInstruction* spill = slot.spillTmp->inst(); IRInstruction* inst = spill->src(0)->inst(); - Block* block = inst->getBlock(); - if (!isMain && block->getTrace()->isMain()) { + Block* block = inst->block(); + if (!isMain && block->trace()->isMain()) { // We're on an exit trace, but the def is on the // main trace, so put it at the start of this trace - if (spill->getBlock()) { + if (spill->block()) { // its already been inserted in another exit trace - assert(!spill->getBlock()->getTrace()->isMain()); + assert(!spill->block()->trace()->isMain()); spill = spill->clone(m_irFactory); } - block->getTrace()->front()->prepend(spill); + block->trace()->front()->prepend(spill); } else if (inst->isBlockEnd()) { - block->getNext()->prepend(spill); + block->next()->prepend(spill); } else { auto pos = block->iteratorTo(inst); if (inst->op() == DefLabel) { @@ -1248,7 +1248,7 @@ void LinearScan::allocRegsToTrace() { void LinearScan::rematerialize() { numberInstructions(m_blocks); - dumpTrace(kExtraLevel, m_blocks.front()->getTrace(), + dumpTrace(kExtraLevel, m_blocks.front()->trace(), " before rematerialization ", &m_allocInfo, &m_lifetime); rematerializeAux(); numberInstructions(m_blocks); @@ -1378,7 +1378,7 @@ void LinearScan::rematerializeAux() { newInst->setDst(dst); dst->setInstruction(newInst); assert(outputType(newInst) == oldType); - auto* block = inst.getBlock(); + auto* block = inst.block(); auto newIt = block->insert(it, newInst); block->erase(it); it = newIt; @@ -1392,7 +1392,7 @@ void LinearScan::rematerializeAux() { } if (opc == LdLoc || opc == StLoc || opc == StLocNT) { - setLocal(inst.getExtra()->locId, + setLocal(inst.extra()->locId, opc == LdLoc ? inst.dst() : inst.src(1)); } // Other instructions that may have side effects on locals must @@ -1409,8 +1409,8 @@ void LinearScan::rematerializeAux() { killLocal(inst, 3); } } - if (Block* taken = block->getTaken()) saveState(taken); - if (Block* next = block->getNext()) saveState(next); + if (Block* taken = block->taken()) saveState(taken); + if (Block* next = block->next()) saveState(next); } } @@ -1418,7 +1418,7 @@ void LinearScan::removeUnusedSpills() { for (SlotInfo& slot : m_slots) { IRInstruction* spill = slot.spillTmp->inst(); if (m_uses[spill->dst()].count == 0) { - Block* block = spill->getBlock(); + Block* block = spill->block(); block->erase(block->iteratorTo(spill)); SSATmp* src = spill->src(0); auto uses = m_uses[src].count - 1; @@ -1593,13 +1593,13 @@ uint32_t LinearScan::createSpillSlot(SSATmp* tmp) { return slotId; } -IRInstruction* LinearScan::getNextNative() const { +IRInstruction* LinearScan::nextNative() const { return m_natives.empty() ? nullptr : m_natives.front(); } -uint32_t LinearScan::getNextNativeId() const { - IRInstruction* nextNative = getNextNative(); - return nextNative ? m_linear[nextNative] : -1; +uint32_t LinearScan::nextNativeId() const { + IRInstruction* next = nextNative(); + return next ? m_linear[next] : -1; } SSATmp* LinearScan::getSpilledTmp(SSATmp* tmp) { diff --git a/hphp/runtime/vm/translator/hopt/memelim.cpp b/hphp/runtime/vm/translator/hopt/memelim.cpp index e15386ed0..45fe90326 100644 --- a/hphp/runtime/vm/translator/hopt/memelim.cpp +++ b/hphp/runtime/vm/translator/hopt/memelim.cpp @@ -419,7 +419,7 @@ void MemMap::processInstruction(IRInstruction* inst, bool isPseudoMain) { // access info for any refs that may alias case LdLoc: { - auto id = inst->getExtra()->locId; + auto id = inst->extra()->locId; // locals never alias, so no access info needs to be killed if (m_locs.count(id) > 0) { @@ -497,7 +497,7 @@ void MemMap::processInstruction(IRInstruction* inst, bool isPseudoMain) { case StLoc: case StLocNT: { - storeLocal(inst->getExtra()->locId, inst->src(1)); + storeLocal(inst->extra()->locId, inst->src(1)); break; } case StRef: @@ -675,10 +675,10 @@ void MemMap::optimizeMemoryAccesses(Trace* trace) { const Func* curFunc = nullptr; - for (Block* block : trace->getBlocks()) { + for (Block* block : trace->blocks()) { for (IRInstruction& inst : *block) { if (inst.op() == Marker) { - curFunc = inst.getExtra()->func; + curFunc = inst.extra()->func; } // initialize each instruction as live setLive(inst, true); @@ -702,7 +702,7 @@ void MemMap::optimizeMemoryAccesses(Trace* trace) { // if we see a store, first check if its last available access is a store // if it is, then the last access is a dead store auto access = inst.op() == StLoc || inst.op() == StLocNT - ? lastLocalAccess(inst.getExtra()->locId) + ? lastLocalAccess(inst.extra()->locId) : getLastAccess(inst.src(0), offset); if (access && isStore(access->op())) { // if a dead St* is followed by a St*NT, then the second store needs to @@ -737,7 +737,7 @@ void MemMap::optimizeMemoryAccesses(Trace* trace) { // if the current instruction is guarded, make sure all of our stores that // are not yet dead know about it - if (inst.getTaken()) { + if (inst.taken()) { for (auto& entry : tracking) { if (isLive(entry.first)) { entry.second.push_back(&inst); @@ -759,7 +759,7 @@ void MemMap::optimizeLoad(IRInstruction* inst, int offset) { // check if we still know the value at this memory location. if we do, // then replace the load with a Mov auto value = inst->op() == LdLoc - ? getLocalValue(inst->getExtra()->locId) + ? getLocalValue(inst->extra()->locId) : getValue(inst->src(0), offset); if (value == nullptr) { return; @@ -769,7 +769,7 @@ void MemMap::optimizeLoad(IRInstruction* inst, int offset) { Type valTy = value->type(); // check for loads that have a guard that will definitely fail - if (inst->getTaken() && instTy.not(valTy)) { + if (inst->taken() && instTy.not(valTy)) { return inst->convertToJmp(); } @@ -799,7 +799,7 @@ void MemMap::sinkStores(StoreList& stores) { if (isLive(store)) continue; for (IRInstruction* guard : it->second) { - Block* exit = guard->getTaken(); + Block* exit = guard->taken(); exit->prepend(store->clone(m_factory)); } diff --git a/hphp/runtime/vm/translator/hopt/mutation.cpp b/hphp/runtime/vm/translator/hopt/mutation.cpp index ac2c9c0ac..662aaf9b9 100644 --- a/hphp/runtime/vm/translator/hopt/mutation.cpp +++ b/hphp/runtime/vm/translator/hopt/mutation.cpp @@ -77,7 +77,7 @@ void moveToBlock(Block::iterator const first, Block* const target) { if (first == last) return; - auto const srcBlock = first->getBlock(); + auto const srcBlock = first->block(); auto targetIt = target->skipLabel(); for (auto it = first; it != last;) { @@ -106,7 +106,7 @@ void reflowTypes(Block* const changed, const BlockList& blocks) { */ if (inst->op() == DefLabel) { Type type = Type::Bottom; - inst->getBlock()->forEachSrc(num, [&](IRInstruction*, SSATmp* tmp) { + inst->block()->forEachSrc(num, [&](IRInstruction*, SSATmp* tmp) { type = Type::unionOf(type, tmp->type()); }); ssa->setType(type); diff --git a/hphp/runtime/vm/translator/hopt/opt.cpp b/hphp/runtime/vm/translator/hopt/opt.cpp index 955d6aa2a..5387d1172 100644 --- a/hphp/runtime/vm/translator/hopt/opt.cpp +++ b/hphp/runtime/vm/translator/hopt/opt.cpp @@ -26,7 +26,7 @@ namespace JIT { // insert inst after the point dst is defined static void insertAfter(IRInstruction* definer, IRInstruction* inst) { assert(!definer->isBlockEnd()); - Block* block = definer->getBlock(); + Block* block = definer->block(); auto pos = block->iteratorTo(definer); if (pos->op() == DefLabel) { ++pos; @@ -57,7 +57,7 @@ static void insertRefCountAsserts(IRInstruction& inst, IRFactory* factory) { static void insertSpillStackAsserts(IRInstruction& inst, IRFactory* factory) { SSATmp* sp = inst.dst(); auto const vals = inst.srcs().subpiece(2); - auto* block = inst.getBlock(); + auto* block = inst.block(); auto pos = block->iteratorTo(&inst); ++pos; for (unsigned i = 0, n = vals.size(); i < n; ++i) { Type t = vals[i]->type(); diff --git a/hphp/runtime/vm/translator/hopt/predictionopts.cpp b/hphp/runtime/vm/translator/hopt/predictionopts.cpp index 5d2b1809b..557c12d86 100644 --- a/hphp/runtime/vm/translator/hopt/predictionopts.cpp +++ b/hphp/runtime/vm/translator/hopt/predictionopts.cpp @@ -87,15 +87,15 @@ void optimizePredictions(Trace* const trace, IRFactory* const irFactory) { auto const ldMem = incRef->src(0)->inst(); if (ldMem->op() != LdMem) return; if (ldMem->src(1)->getValInt() != 0) return; - if (!ldMem->getTypeParam().equals(Type::Cell)) return; + if (!ldMem->typeParam().equals(Type::Cell)) return; FTRACE(5, "candidate: {}\n", ldMem->toString()); - auto const mainBlock = ldMem->getBlock(); - auto const exit = checkType->getTaken(); - auto const specialized = checkType->getBlock()->getNext(); + auto const mainBlock = ldMem->block(); + auto const exit = checkType->taken(); + auto const specialized = checkType->block()->next(); - if (mainBlock != checkType->getBlock()) return; + if (mainBlock != checkType->block()) return; if (exit->numPreds() != 1) return; if (exit->isMain()) return; @@ -115,8 +115,8 @@ void optimizePredictions(Trace* const trace, IRFactory* const irFactory) { */ auto const newCheckType = irFactory->gen( CheckTypeMem, - checkType->getTypeParam(), - checkType->getTaken(), + checkType->typeParam(), + checkType->taken(), ldMem->src(0) ); mainBlock->insert(mainBlock->iteratorTo(ldMem), newCheckType); @@ -130,7 +130,7 @@ void optimizePredictions(Trace* const trace, IRFactory* const irFactory) { * generic version to the exit. We'll reflowTypes in a sec to get * everything downstream specialized. */ - ldMem->setTypeParam(checkType->getTypeParam()); + ldMem->setTypeParam(checkType->typeParam()); /* * Replace the old CheckType with a Mov from the result of the @@ -160,7 +160,7 @@ void optimizePredictions(Trace* const trace, IRFactory* const irFactory) { * visiting. */ if (!trace->isMain()) return; - for (Block* b : trace->getBlocks()) { + for (Block* b : trace->blocks()) { IRInstruction* lastMarker = nullptr; for (auto& inst : *b) { if (inst.op() == Marker) { diff --git a/hphp/runtime/vm/translator/hopt/print.cpp b/hphp/runtime/vm/translator/hopt/print.cpp index 03c62e579..3113a8529 100644 --- a/hphp/runtime/vm/translator/hopt/print.cpp +++ b/hphp/runtime/vm/translator/hopt/print.cpp @@ -41,7 +41,7 @@ void printOpcode(std::ostream& os, const IRInstruction* inst) { << color(ANSI_COLOR_END) ; - auto type_param = inst->getTypeParam(); + auto type_param = inst->typeParam(); if (type_param == Type::None && !inst->hasExtra()) { return; } @@ -118,7 +118,7 @@ void printSrcs(std::ostream& os, const IRInstruction* inst, void printLabel(std::ostream& os, const Block* block) { os << color(ANSI_COLOR_MAGENTA); os << "L" << block->id(); - switch (block->getHint()) { + switch (block->hint()) { case Block::Unlikely: os << ""; break; case Block::Likely: os << ""; break; default: @@ -130,7 +130,7 @@ void printLabel(std::ostream& os, const Block* block) { void print(std::ostream& ostream, const IRInstruction* inst, const RegAllocInfo* regs, const LifetimeInfo* lifetime) { if (inst->op() == Marker) { - auto* marker = inst->getExtra(); + auto* marker = inst->extra(); ostream << color(ANSI_COLOR_BLUE) << folly::format("--- bc {}, spOff {} ({})", marker->bcOff, @@ -154,7 +154,7 @@ void print(std::ostream& ostream, const IRInstruction* inst, printOpcode(ostream, inst); printSrcs(ostream, inst, regs, lifetime); - if (Block* taken = inst->getTaken()) { + if (Block* taken = inst->taken()) { ostream << punc(" -> "); printLabel(ostream, taken); } @@ -169,8 +169,8 @@ static void printConst(std::ostream& os, IRInstruction* inst) { os << color(ANSI_COLOR_LIGHT_BLUE); SCOPE_EXIT { os << color(ANSI_COLOR_END); }; - auto t = inst->getTypeParam(); - auto c = inst->getExtra(); + auto t = inst->typeParam(); + auto c = inst->extra(); if (t == Type::Int) { os << c->as(); } else if (t == Type::Dbl) { @@ -183,7 +183,7 @@ static void printConst(std::ostream& os, IRInstruction* inst) { << Util::escapeStringForCPP(str->data(), str->size()) << "\""; } else if (t.isArray()) { - auto arr = inst->getExtra()->as(); + auto arr = inst->extra()->as(); if (arr->empty()) { os << "array()"; } else { @@ -272,14 +272,14 @@ void print(const Trace* trace) { // Print unlikely blocks at the end in normal generation. If we have // asmInfo, order the blocks based on how they were layed out. -static smart::vector getBlocks(const Trace* trace, - const AsmInfo* asmInfo) { +static smart::vector blocks(const Trace* trace, + const AsmInfo* asmInfo) { smart::vector blocks; if (!asmInfo) { smart::vector unlikely; - for (Block* block : trace->getBlocks()) { - if (block->getHint() == Block::Unlikely) { + for (Block* block : trace->blocks()) { + if (block->hint() == Block::Unlikely) { unlikely.push_back(block); } else { blocks.push_back(block); @@ -287,16 +287,16 @@ static smart::vector getBlocks(const Trace* trace, } for (Trace* e : trace->getExitTraces()) { unlikely.insert(unlikely.end(), - e->getBlocks().begin(), - e->getBlocks().end()); + e->blocks().begin(), + e->blocks().end()); } blocks.insert(blocks.end(), unlikely.begin(), unlikely.end()); return blocks; } - blocks.assign(trace->getBlocks().begin(), trace->getBlocks().end()); + blocks.assign(trace->blocks().begin(), trace->blocks().end()); for (Trace* e : trace->getExitTraces()) { - blocks.insert(blocks.end(), e->getBlocks().begin(), e->getBlocks().end()); + blocks.insert(blocks.end(), e->blocks().begin(), e->blocks().end()); } std::sort( blocks.begin(), @@ -316,7 +316,7 @@ void print(std::ostream& os, const Trace* trace, const RegAllocInfo* regs, .printEncoding(dumpIREnabled(kExtraLevel)) .color(color(ANSI_COLOR_BROWN))); - for (Block* block : getBlocks(trace, asmInfo)) { + for (Block* block : blocks(trace, asmInfo)) { if (!block->isMain()) { os << "\n" << color(ANSI_COLOR_GREEN) << " ------- Exit Trace -------" @@ -336,7 +336,7 @@ void print(std::ostream& os, const Trace* trace, const RegAllocInfo* regs, // Don't print bytecode in a non-main trace. if (!trace->isMain()) continue; - auto* marker = inst.getExtra(); + auto* marker = inst.extra(); uint32_t bcOffset = marker->bcOff; if (const auto* func = marker->func) { std::ostringstream uStr; @@ -356,7 +356,7 @@ void print(std::ostream& os, const Trace* trace, const RegAllocInfo* regs, if (inst.op() == DefLabel) { os << std::string(kIndent - 2, ' '); - printLabel(os, inst.getBlock()); + printLabel(os, inst.block()); os << punc(":") << "\n"; // print phi pseudo-instructions for (unsigned i = 0, n = inst.numDsts(); i < n; ++i) { @@ -367,12 +367,12 @@ void print(std::ostream& os, const Trace* trace, const RegAllocInfo* regs, os << punc(" = ") << color(ANSI_COLOR_CYAN) << "phi " << color(ANSI_COLOR_END); bool first = true; - inst.getBlock()->forEachSrc(i, [&](IRInstruction* jmp, SSATmp*) { + inst.block()->forEachSrc(i, [&](IRInstruction* jmp, SSATmp*) { if (!first) os << punc(", "); first = false; printSrc(os, jmp, i, regs, lifetime); os << punc("@"); - printLabel(os, jmp->getBlock()); + printLabel(os, jmp->block()); }); os << '\n'; } diff --git a/hphp/runtime/vm/translator/hopt/simplifier.cpp b/hphp/runtime/vm/translator/hopt/simplifier.cpp index d693871d4..6ee2b204e 100644 --- a/hphp/runtime/vm/translator/hopt/simplifier.cpp +++ b/hphp/runtime/vm/translator/hopt/simplifier.cpp @@ -60,8 +60,8 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { case GuardStk: // We don't have a value, but we may know the type due to guarding // on it. - if (inst->getExtra()->offset == index) { - return StackValueInfo { inst->getTypeParam() }; + if (inst->extra()->offset == index) { + return StackValueInfo { inst->typeParam() }; } return getStackValue(inst->src(0), index); @@ -121,7 +121,7 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { case InterpOne: { SSATmp* prevSp = inst->src(1); int64_t spAdjustment = inst->src(3)->getValInt(); // # popped - # pushed - Type resultType = inst->getTypeParam(); + Type resultType = inst->typeParam(); if (index == 0 && !resultType.equals(Type::None)) { return StackValueInfo { resultType }; } @@ -139,7 +139,7 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { // vectorBaseIdx if not. auto const base = inst->src(vectorBaseIdx(inst)); assert(base->inst()->op() == LdStackAddr); - if (base->inst()->getExtra()->offset == index) { + if (base->inst()->extra()->offset == index) { VectorEffects ve(inst); assert(ve.baseTypeChanged || ve.baseValChanged); return StackValueInfo { ve.baseType.derefIfPtr() }; @@ -365,7 +365,7 @@ SSATmp* Simplifier::simplifySpillStack(IRInstruction* inst) { const int64_t offset = cellOff + adjustment; auto* srcInst = spillVals[i]->inst(); if (srcInst->op() == LdStack && srcInst->src(0) == sp && - srcInst->getExtra()->offset == offset) { + srcInst->extra()->offset == offset) { spillVals[i] = m_tb->genDefNone(); } cellOff++; @@ -394,7 +394,7 @@ SSATmp* Simplifier::simplifyCall(IRInstruction* inst) { // If our value came from a LdStack on the same sp and offset, // we don't need to spill it. if (srcInst->op() == LdStack && srcInst->src(0) == sp && - srcInst->getExtra()->offset == offset) { + srcInst->extra()->offset == offset) { spillVals[i] = m_tb->genDefNone(); } } @@ -468,7 +468,7 @@ SSATmp* Simplifier::simplifyLdCls(IRInstruction* inst) { } SSATmp* Simplifier::simplifyCheckType(IRInstruction* inst) { - Type type = inst->getTypeParam(); + Type type = inst->typeParam(); SSATmp* src = inst->src(0); Type srcType = src->type(); @@ -526,7 +526,7 @@ SSATmp* Simplifier::simplifyQueryJmp(IRInstruction* inst) { return nullptr; }, JmpNZero, - inst->getTaken(), + inst->taken(), newCmp); if (!newQueryJmp) return nullptr; return newQueryJmp; @@ -1178,7 +1178,7 @@ SSATmp* Simplifier::simplifyJmpIsType(IRInstruction* inst) { assert(res->isConst()); if (res->getValBool()) { // Taken jump - return gen(Jmp_, inst->getTaken()); + return gen(Jmp_, inst->taken()); } else { // Not taken jump; turn jump into a nop inst->convertToNop(); @@ -1189,7 +1189,7 @@ SSATmp* Simplifier::simplifyJmpIsType(IRInstruction* inst) { SSATmp* Simplifier::simplifyIsType(IRInstruction* inst) { bool trueSense = inst->op() == IsType || inst->op() == JmpIsType; - auto type = inst->getTypeParam(); + auto type = inst->typeParam(); auto src = inst->src(0); auto srcType = src->type(); @@ -1420,7 +1420,7 @@ SSATmp* Simplifier::simplifyLdClsPropAddr(IRInstruction* inst) { const StringData* clsNameStr = findClassName(cls); return gen(LdClsPropAddrCached, - inst->getTaken(), + inst->taken(), cls, propName, cns(clsNameStr), @@ -1462,7 +1462,7 @@ SSATmp* Simplifier::simplifyUnbox(IRInstruction* inst) { if (srcType.isBoxed()) { srcType = srcType.innerType(); assert(type.equals(srcType)); - return gen(LdRef, type, inst->getTaken()->getTrace(), src); + return gen(LdRef, type, inst->taken()->trace(), src); } return nullptr; } @@ -1479,7 +1479,7 @@ SSATmp* Simplifier::simplifyCheckInit(IRInstruction* inst) { Type srcType = inst->src(0)->type(); srcType = inst->op() == CheckInitMem ? srcType.deref() : srcType; assert(srcType.notPtr()); - assert(inst->getTaken()); + assert(inst->taken()); if (srcType.isInit()) { inst->convertToNop(); } @@ -1526,7 +1526,7 @@ SSATmp* Simplifier::simplifyCondJmp(IRInstruction* inst) { val = !val; } if (val) { - return gen(Jmp_, inst->getTaken()); + return gen(Jmp_, inst->taken()); } inst->convertToNop(); return nullptr; @@ -1535,7 +1535,7 @@ SSATmp* Simplifier::simplifyCondJmp(IRInstruction* inst) { // Pull negations into the jump. if (src->inst()->op() == OpNot) { return gen(inst->op() == JmpZero ? JmpNZero : JmpZero, - inst->getTaken(), + inst->taken(), srcInst->src(0)); } @@ -1552,7 +1552,7 @@ SSATmp* Simplifier::simplifyCondJmp(IRInstruction* inst) { // If the source is conversion of an int or pointer to boolean, we // can test the int/ptr value directly. if (isConvIntOrPtrToBool(srcInst)) { - return gen(inst->op(), inst->getTaken(), srcInst->src(0)); + return gen(inst->op(), inst->taken(), srcInst->src(0)); } // Fuse jumps with query operators. @@ -1563,8 +1563,8 @@ SSATmp* Simplifier::simplifyCondJmp(IRInstruction* inst) { inst->op() == JmpZero ? negateQueryOp(srcOpcode) : srcOpcode), - srcInst->getTypeParam(), // if it had a type param - inst->getTaken(), + srcInst->typeParam(), // if it had a type param + inst->taken(), std::make_pair(ssas.size(), ssas.begin()) ); } @@ -1574,8 +1574,8 @@ SSATmp* Simplifier::simplifyCondJmp(IRInstruction* inst) { SSATmp* Simplifier::simplifyCastStk(IRInstruction* inst) { auto const info = getStackValue(inst->src(0), - inst->getExtra()->offset); - if (info.knownType.subtypeOf(inst->getTypeParam())) { + inst->extra()->offset); + if (info.knownType.subtypeOf(inst->typeParam())) { // No need to cast---the type was as good or better. inst->convertToNop(); } @@ -1584,13 +1584,13 @@ SSATmp* Simplifier::simplifyCastStk(IRInstruction* inst) { SSATmp* Simplifier::simplifyAssertStk(IRInstruction* inst) { auto const info = getStackValue(inst->src(0), - inst->getExtra()->offset); + inst->extra()->offset); // AssertStk indicated that we knew the type from static analysis, // so this assert just double checks. - if (info.value) assert(info.value->isA(inst->getTypeParam())); + if (info.value) assert(info.value->isA(inst->typeParam())); - if (info.knownType.subtypeOf(inst->getTypeParam())) { + if (info.knownType.subtypeOf(inst->typeParam())) { inst->convertToNop(); } return nullptr; @@ -1598,7 +1598,7 @@ SSATmp* Simplifier::simplifyAssertStk(IRInstruction* inst) { SSATmp* Simplifier::simplifyLdStack(IRInstruction* inst) { auto const info = getStackValue(inst->src(0), - inst->getExtra()->offset); + inst->extra()->offset); // We don't want to extend live ranges of tmps across calls, so we // don't get the value if spansCall is true; however, we can use @@ -1609,22 +1609,22 @@ SSATmp* Simplifier::simplifyLdStack(IRInstruction* inst) { } if (!info.knownType.equals(Type::None)) { inst->setTypeParam( - Type::mostRefined(inst->getTypeParam(), info.knownType) + Type::mostRefined(inst->typeParam(), info.knownType) ); } return nullptr; } SSATmp* Simplifier::simplifyDecRefLoc(IRInstruction* inst) { - if (inst->getTypeParam().notCounted()) { + if (inst->typeParam().notCounted()) { inst->convertToNop(); } return nullptr; } SSATmp* Simplifier::simplifyLdLoc(IRInstruction* inst) { - if (inst->getTypeParam().isNull()) { - return cns(inst->getTypeParam()); + if (inst->typeParam().isNull()) { + return cns(inst->typeParam()); } return nullptr; } @@ -1643,29 +1643,29 @@ SSATmp* Simplifier::simplifyStRef(IRInstruction* inst) { SSATmp* Simplifier::simplifyLdStackAddr(IRInstruction* inst) { auto const info = getStackValue(inst->src(0), - inst->getExtra()->offset); + inst->extra()->offset); if (!info.knownType.equals(Type::None)) { inst->setTypeParam( - Type::mostRefined(inst->getTypeParam(), info.knownType.ptr()) + Type::mostRefined(inst->typeParam(), info.knownType.ptr()) ); } return nullptr; } SSATmp* Simplifier::simplifyDecRefStack(IRInstruction* inst) { - if (inst->getTypeParam().notCounted()) { + if (inst->typeParam().notCounted()) { inst->convertToNop(); return nullptr; } auto const info = getStackValue(inst->src(0), - inst->getExtra()->offset); + inst->extra()->offset); if (info.value && !info.spansCall) { inst->convertToNop(); return gen(DecRef, info.knownType, info.value); } if (!info.knownType.equals(Type::None)) { inst->setTypeParam( - Type::mostRefined(inst->getTypeParam(), info.knownType) + Type::mostRefined(inst->typeParam(), info.knownType) ); } return nullptr; diff --git a/hphp/runtime/vm/translator/hopt/trace.h b/hphp/runtime/vm/translator/hopt/trace.h index 9bb5d9d0e..f9805a548 100644 --- a/hphp/runtime/vm/translator/hopt/trace.h +++ b/hphp/runtime/vm/translator/hopt/trace.h @@ -43,20 +43,20 @@ struct Trace : private boost::noncopyable { boost::checked_deleter()); } - std::list& getBlocks() { return m_blocks; } - const std::list& getBlocks() const { return m_blocks; } + std::list& blocks() { return m_blocks; } + const std::list& blocks() const { return m_blocks; } Block* front() { return *m_blocks.begin(); } Block* back() { auto it = m_blocks.end(); return *(--it); } const Block* front() const { return *m_blocks.begin(); } const Block* back() const { auto it = m_blocks.end(); return *(--it); } - const_iterator cbegin() const { return getBlocks().cbegin(); } - const_iterator cend() const { return getBlocks().cend(); } - const_iterator begin() const { return getBlocks().begin(); } - const_iterator end() const { return getBlocks().end(); } - iterator begin() { return getBlocks().begin(); } - iterator end() { return getBlocks().end(); } + const_iterator cbegin() const { return blocks().cbegin(); } + const_iterator cend() const { return blocks().cend(); } + const_iterator begin() const { return blocks().begin(); } + const_iterator end() const { return blocks().end(); } + iterator begin() { return blocks().begin(); } + iterator end() { return blocks().end(); } /* * Unlink a block from a trace. Updates any successor blocks that diff --git a/hphp/runtime/vm/translator/hopt/tracebuilder.cpp b/hphp/runtime/vm/translator/hopt/tracebuilder.cpp index bba89a532..6ce620bf1 100644 --- a/hphp/runtime/vm/translator/hopt/tracebuilder.cpp +++ b/hphp/runtime/vm/translator/hopt/tracebuilder.cpp @@ -104,8 +104,8 @@ SSATmp* TraceBuilder::genDefNone() { } void TraceBuilder::trackDefInlineFP(IRInstruction* inst) { - auto const target = inst->getExtra()->target; - auto const savedSPOff = inst->getExtra()->retSPOff; + auto const target = inst->extra()->target; + auto const savedSPOff = inst->extra()->retSPOff; auto const calleeFP = inst->dst(); auto const calleeSP = inst->src(0); auto const savedSP = inst->src(1); @@ -172,7 +172,7 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { case InlineReturn: trackInlineReturn(inst); break; case Marker: - m_lastMarker = *inst->getExtra(); + m_lastMarker = *inst->extra(); break; case Call: @@ -208,7 +208,7 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { case DefSP: case ReDefSP: m_spValue = inst->dst(); - m_spOffset = inst->getExtra()->offset; + m_spOffset = inst->extra()->offset; break; case AssertStk: @@ -267,25 +267,24 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { case StLocNT: case StLoc: - setLocalValue(inst->getExtra()->locId, - inst->src(1)); + setLocalValue(inst->extra()->locId, inst->src(1)); break; case LdLoc: - setLocalValue(inst->getExtra()->locId, inst->dst()); + setLocalValue(inst->extra()->locId, inst->dst()); break; case OverrideLoc: // If changing the inner type of a boxed local, also drop the // information about inner types for any other boxed locals. - if (inst->getTypeParam().isBoxed()) { + if (inst->typeParam().isBoxed()) { dropLocalRefsInnerTypes(); } // fallthrough case AssertLoc: case GuardLoc: - setLocalType(inst->getExtra()->locId, - inst->getTypeParam()); + setLocalType(inst->extra()->locId, + inst->typeParam()); break; case IterInitK: @@ -348,7 +347,7 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { } // save a copy of the current state for each successor. - if (Block* target = inst->getTaken()) saveState(target); + if (Block* target = inst->taken()) saveState(target); } std::unique_ptr TraceBuilder::createState() const { @@ -536,12 +535,12 @@ SSATmp* TraceBuilder::cseLookup(IRInstruction* inst) { ////////////////////////////////////////////////////////////////////// SSATmp* TraceBuilder::preOptimizeCheckLoc(IRInstruction* inst) { - auto const locId = inst->getExtra()->locId; + auto const locId = inst->extra()->locId; if (auto const prevValue = getLocalValue(locId)) { always_assert(false && "WTF"); return gen( - CheckType, inst->getTypeParam(), inst->getTaken(), prevValue + CheckType, inst->typeParam(), inst->taken(), prevValue ); } @@ -550,7 +549,7 @@ SSATmp* TraceBuilder::preOptimizeCheckLoc(IRInstruction* inst) { always_assert(false && "WTF2"); // It doesn't make sense to be checking something that's deemed to // fail. - assert(prevType == inst->getTypeParam()); + assert(prevType == inst->typeParam()); inst->convertToNop(); } @@ -558,9 +557,9 @@ SSATmp* TraceBuilder::preOptimizeCheckLoc(IRInstruction* inst) { } SSATmp* TraceBuilder::preOptimizeAssertLoc(IRInstruction* inst) { - auto const locId = inst->getExtra()->locId; + auto const locId = inst->extra()->locId; auto const prevType = getLocalType(locId); - auto const typeParam = inst->getTypeParam(); + auto const typeParam = inst->typeParam(); if (!prevType.equals(Type::None) && !typeParam.strictSubtypeOf(prevType)) { assert(prevType.subtypeOf(typeParam)); @@ -637,7 +636,7 @@ SSATmp* TraceBuilder::preOptimizeDecRefThis(IRInstruction* inst) { } SSATmp* TraceBuilder::preOptimizeDecRefLoc(IRInstruction* inst) { - auto const locId = inst->getExtra()->locId; + auto const locId = inst->extra()->locId; /* * Refine the type if we can. @@ -652,7 +651,7 @@ SSATmp* TraceBuilder::preOptimizeDecRefLoc(IRInstruction* inst) { } if (knownType != Type::None) { // TODO(#2135185) inst->setTypeParam( - Type::mostRefined(knownType, inst->getTypeParam()) + Type::mostRefined(knownType, inst->typeParam()) ); } @@ -669,33 +668,33 @@ SSATmp* TraceBuilder::preOptimizeDecRefLoc(IRInstruction* inst) { } SSATmp* TraceBuilder::preOptimizeLdLoc(IRInstruction* inst) { - auto const locId = inst->getExtra()->locId; + auto const locId = inst->extra()->locId; if (auto tmp = getLocalValue(locId)) { return tmp; } if (getLocalType(locId) != Type::None) { // TODO(#2135185) inst->setTypeParam( - Type::mostRefined(getLocalType(locId), inst->getTypeParam()) + Type::mostRefined(getLocalType(locId), inst->typeParam()) ); } return nullptr; } SSATmp* TraceBuilder::preOptimizeLdLocAddr(IRInstruction* inst) { - auto const locId = inst->getExtra()->locId; + auto const locId = inst->extra()->locId; if (getLocalType(locId) != Type::None) { // TODO(#2135185) inst->setTypeParam( - Type::mostRefined(getLocalType(locId).ptr(), inst->getTypeParam()) + Type::mostRefined(getLocalType(locId).ptr(), inst->typeParam()) ); } return nullptr; } SSATmp* TraceBuilder::preOptimizeStLoc(IRInstruction* inst) { - auto const curType = getLocalType(inst->getExtra()->locId); + auto const curType = getLocalType(inst->extra()->locId); auto const newType = inst->src(1)->type(); - assert(inst->getTypeParam().equals(Type::None)); + assert(inst->typeParam().equals(Type::None)); // There's no need to store the type if it's going to be the same // KindOfFoo. We still have to store string types because we don't @@ -797,7 +796,7 @@ SSATmp* TraceBuilder::optimizeInst(IRInstruction* inst) { void CSEHash::filter(Block* block, IdomVector& idoms) { for (auto it = map.begin(), end = map.end(); it != end;) { auto next = it; ++next; - if (!dominates(it->second->inst()->getBlock(), block, idoms)) { + if (!dominates(it->second->inst()->block(), block, idoms)) { map.erase(it); } it = next; @@ -833,7 +832,7 @@ void TraceBuilder::reoptimize() { m_enableCse = RuntimeOption::EvalHHIRCse; m_enableSimplification = RuntimeOption::EvalHHIRSimplification; if (!m_enableCse && !m_enableSimplification) return; - if (m_trace->getBlocks().size() > + if (m_trace->blocks().size() > RuntimeOption::EvalHHIRSimplificationMaxBlocks) { // TODO CSEHash::filter is very slow for large block sizes // t2135219 should address that @@ -844,12 +843,12 @@ void TraceBuilder::reoptimize() { IdomVector idoms = findDominators(sortedBlocks); clearTrackedState(); - auto blocks = std::move(m_trace->getBlocks()); - assert(m_trace->getBlocks().empty()); + auto blocks = std::move(m_trace->blocks()); + assert(m_trace->blocks().empty()); while (!blocks.empty()) { Block* block = blocks.front(); blocks.pop_front(); - assert(block->getTrace() == m_trace.get()); + assert(block->trace() == m_trace.get()); FTRACE(5, "Block: {}\n", block->id()); m_trace->push_back(block); @@ -858,7 +857,7 @@ void TraceBuilder::reoptimize() { m_cseHash.filter(block, idoms); } - auto instructions = std::move(block->getInstrs()); + auto instructions = std::move(block->instrs()); assert(block->empty()); while (!instructions.empty()) { auto *inst = &instructions.front(); @@ -883,7 +882,7 @@ void TraceBuilder::reoptimize() { updateTrackedState(mov); } // Not re-adding inst; remove the inst->taken edge - if (inst->getTaken()) inst->setTaken(nullptr); + if (inst->taken()) inst->setTaken(nullptr); } if (block->back()->isTerminal()) { // Could have converted a conditional branch to Jmp; clear next. @@ -892,7 +891,7 @@ void TraceBuilder::reoptimize() { // if the last instruction was a branch, we already saved state // for the target in updateTrackedState(). Now save state for // the fall-through path. - saveState(block->getNext()); + saveState(block->next()); } } } diff --git a/hphp/runtime/vm/translator/hopt/tracebuilder.h b/hphp/runtime/vm/translator/hopt/tracebuilder.h index 0f42b7e49..70563b816 100644 --- a/hphp/runtime/vm/translator/hopt/tracebuilder.h +++ b/hphp/runtime/vm/translator/hopt/tracebuilder.h @@ -98,7 +98,7 @@ struct TraceBuilder { void setEnableCse(bool val) { m_enableCse = val; } void setEnableSimplification(bool val) { m_enableSimplification = val; } - Trace* getTrace() const { return m_trace.get(); } + Trace* trace() const { return m_trace.get(); } IRFactory* getIrFactory() { return &m_irFactory; } int32_t getSpOffset() { return m_spOffset; } SSATmp* getSp() const { return m_spValue; } @@ -200,7 +200,7 @@ struct TraceBuilder { SSATmp* v2 = taken(); gen(Jmp_, done_block, v2); appendBlock(done_block); - SSATmp* result = done_block->getLabel()->dst(0); + SSATmp* result = done_block->label()->dst(0); result->setType(Type::unionOf(v1->type(), v2->type())); return result; } @@ -216,7 +216,7 @@ struct TraceBuilder { Block* done_block = m_irFactory.defBlock(func); DisableCseGuard guard(*this); branch(taken_block); - assert(!m_trace->back()->getNext()); + assert(!m_trace->back()->next()); m_trace->back()->setNext(done_block); appendBlock(taken_block); taken(); diff --git a/hphp/runtime/vm/translator/hopt/type.cpp b/hphp/runtime/vm/translator/hopt/type.cpp index c5460809d..7089ba306 100644 --- a/hphp/runtime/vm/translator/hopt/type.cpp +++ b/hphp/runtime/vm/translator/hopt/type.cpp @@ -51,7 +51,7 @@ Type vectorReturn(const IRInstruction* inst) { Type builtinReturn(const IRInstruction* inst) { assert(inst->op() == CallBuiltin); - Type t = inst->getTypeParam(); + Type t = inst->typeParam(); if (t.isSimpleType() || t.equals(Type::Cell)) { return t; } @@ -112,7 +112,7 @@ Type outputType(const IRInstruction* inst, int dstId) { #define DofS(n) return inst->src(n)->type(); #define DUnbox(n) return inst->src(n)->type().unbox(); #define DBox(n) return boxReturn(inst, n); -#define DParam return inst->getTypeParam(); +#define DParam return inst->typeParam(); #define DMulti return Type::None; #define DStk(in) return stkReturn(inst, dstId, \ [&]() -> Type { in not_reached(); }); @@ -289,10 +289,10 @@ void assertOperandTypes(const IRInstruction* inst) { "invalid src num"); #define DofS(src) checkDst(src < inst->numSrcs(), \ "invalid src num"); -#define DParam checkDst(inst->getTypeParam() != Type::None || \ +#define DParam checkDst(inst->typeParam() != Type::None || \ inst->op() == DefConst /* for DefNone */, \ "DParam with paramType None"); -#define DArith checkDst(inst->getTypeParam() == Type::None, \ +#define DArith checkDst(inst->typeParam() == Type::None, \ "DArith should have no type parameter"); #define O(opcode, dstinfo, srcinfo, flags) \ diff --git a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp index 3856aa9b1..f2e3fb6f6 100644 --- a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp @@ -54,7 +54,7 @@ void VectorEffects::get(const IRInstruction* inst, UNUSED Type baseType = locInstr->dst()->type(); assert(baseType.equals(base->type())); assert(baseType.isPtr() || baseType.isKnownDataType()); - int loc = locInstr->getExtra()->locId; + int loc = locInstr->extra()->locId; VectorEffects ve(inst); if (ve.baseTypeChanged || ve.baseValChanged) { @@ -2049,7 +2049,7 @@ void HhbcTranslator::VectorTranslator::emitMPost() { gen(CheckType, m_predictedResult->type(), - m_ht.getExitTrace(m_ht.getNextSrcKey().offset(), spillValues), + m_ht.getExitTrace(m_ht.nextSrcKey().offset(), spillValues), m_result); } }