Skip to content

Commit

Permalink
Remove IR instructions for static locals
Browse files Browse the repository at this point in the history
Reviewed By: ricklavoie

Differential Revision: D14317134

fbshipit-source-id: 9877255c0836615ffc227295f12580d8c2821f27
  • Loading branch information
paulbiss authored and hhvm-bot committed Mar 18, 2019
1 parent bcaf6b9 commit 495f1c6
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 181 deletions.
20 changes: 0 additions & 20 deletions hphp/doc/ir.specification
Original file line number Diff line number Diff line change
Expand Up @@ -1529,16 +1529,6 @@ To string conversions:

Load the length of the string in S0.

| LdClosureStaticLoc<func,staticLocalName>, D(PtrToPropGen), S(Obj), NF

Get pointer to static local named 'staticLocName' for function 'func' whose
closure object is S0. func must either be a Closure, or generatorFromClosure

| LdStaticLoc<func,staticLocalName>, D(BoxedInitCell), NA, PRc

Load the address of the static local variable named 'staticLocalName' for
function 'func' in RDS. The variable must be initialized

| FuncSupportsAsyncEagerReturn, D(Bool), S(Func), NF

Tests for Func::m_attrs & AttrSupportsAsyncEagerReturn.
Expand Down Expand Up @@ -2312,16 +2302,6 @@ To string conversions:
Raises a runtime error unless whether each generic in S0 is reified or erased
matches exactly to the expectations of the func.

| CheckStaticLoc<func,staticLocalName>, ND, NA, B

Check whether the static local variable named 'staticLocalName' for
function 'func' is initialized in RDS, and branch if not.

| InitStaticLoc<func,staticLocalName>, ND, S(Cell), NF

Initialize the static local variable named 'staticLocalName' for
function 'func' with S0.

| InitClsCns<className,constName>, DCns, NA, PRc

Initialize the RDS entry for a constant for a class, invoking autoload if it
Expand Down
4 changes: 0 additions & 4 deletions hphp/runtime/vm/jit/dce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ bool canDCE(IRInstruction* inst) {
case LdVecElem:
case LdPackedElem:
case LdPackedArrayDataElemAddr:
case LdClosureStaticLoc:
case NewInstanceRaw:
case NewArray:
case NewMixedArray:
Expand Down Expand Up @@ -272,7 +271,6 @@ bool canDCE(IRInstruction* inst) {
case GetTimeNs:
case Select:
case LdARCtx:
case LdStaticLoc:
case LdARNumArgsAndFlags:
case LdARReifiedGenerics:
case KillARReifiedGenerics:
Expand Down Expand Up @@ -551,7 +549,6 @@ bool canDCE(IRInstruction* inst) {
case RaiseStrToClassNotice:
case CheckClsReifiedGenericMismatch:
case CheckFunReifiedGenericMismatch:
case InitStaticLoc:
case PrintStr:
case PrintInt:
case PrintBool:
Expand Down Expand Up @@ -727,7 +724,6 @@ bool canDCE(IRInstruction* inst) {
case SetOpCell:
case SetOpCellVerify:
case ConjureUse:
case CheckStaticLoc:
case LdClsMethodFCacheFunc:
case LdClsMethodCacheFunc:
case LdReifiedGeneric:
Expand Down
29 changes: 0 additions & 29 deletions hphp/runtime/vm/jit/extra-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -850,31 +850,6 @@ struct ProfileSubClsCnsData : IRExtraData {
rds::Handle handle;
};

/*
* The name of a static local in a function.
*/
struct StaticLocName : IRExtraData {
StaticLocName(const Func* func, const StringData* name)
: func(func)
, name(name)
{}

std::string show() const {
return folly::to<std::string>(
func->fullName()->data(), "$", name->data()
);
}

bool equals(const StaticLocName& o) const {
return func == o.func && name == o.name;
}
size_t hash() const {
return hash_int64_pair((intptr_t)func, (intptr_t)name);
}
const Func* func;
const StringData* name;
};

struct FuncNameData : IRExtraData {
explicit FuncNameData(const StringData* name)
: name(name)
Expand Down Expand Up @@ -1666,10 +1641,6 @@ X(LdClsMethodCacheCls, ClsMethodData);
X(LdClsMethodFCacheFunc, ClsMethodData);
X(LookupClsMethodFCache, ClsMethodData);
X(LdIfaceMethod, IfaceMethodData);
X(LdClosureStaticLoc, StaticLocName);
X(LdStaticLoc, StaticLocName);
X(CheckStaticLoc, StaticLocName);
X(InitStaticLoc, StaticLocName);
X(LdClsCns, ClsCnsName);
X(InitClsCns, ClsCnsName);
X(LdSubClsCns, LdSubClsCnsData);
Expand Down
1 change: 0 additions & 1 deletion hphp/runtime/vm/jit/gvn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ bool supportsGVN(const IRInstruction* inst) {
case LdContActRec:
case LdAFWHActRec:
case LdPackedArrayDataElemAddr:
case LdStaticLoc:
case OrdStr:
case ChrInt:
case CheckRange:
Expand Down
4 changes: 0 additions & 4 deletions hphp/runtime/vm/jit/ir-opcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,6 @@ bool opcodeMayRaise(Opcode opc) {
case CheckRDSInitialized:
case CheckRefInner:
case CheckRefs:
case CheckStaticLoc:
case CheckStk:
case CheckSubClsCns:
case CheckSurpriseFlags:
Expand Down Expand Up @@ -771,7 +770,6 @@ bool opcodeMayRaise(Opcode opc) {
case InitObjMemoSlots:
case InitPackedLayoutArray:
case InitPackedLayoutArrayLoop:
case InitStaticLoc:
case InitThrowableFileAndLine:
case InlineReturn:
case InlineReturnNoFrame:
Expand Down Expand Up @@ -826,7 +824,6 @@ bool opcodeMayRaise(Opcode opc) {
case LdCctx:
case LdClosure:
case LdClosureCtx:
case LdClosureStaticLoc:
case LdClsCachedSafe:
case LdClsCctx:
case LdClsCns:
Expand Down Expand Up @@ -878,7 +875,6 @@ bool opcodeMayRaise(Opcode opc) {
case LdRef:
case LdRetVal:
case LdSSwitchDestFast:
case LdStaticLoc:
case LdStk:
case LdStkAddr:
case LdStrLen:
Expand Down
13 changes: 0 additions & 13 deletions hphp/runtime/vm/jit/irlower-closure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@ void cgLdClosureCtx(IRLS& env, const IRInstruction* inst) {
vmain(env) << load{obj[c_Closure::ctxOffset()], ctx};
}

void cgLdClosureStaticLoc(IRLS& env, const IRInstruction* inst) {
auto const extra = inst->extra<LdClosureStaticLoc>();
auto const func = extra->func;
auto const cls = func->implCls();
auto const slot = lookupStaticSlotFromClosure(cls, extra->name);
auto const offset = cls->declPropOffset(slot);

auto const dst = dstLoc(env, inst, 0).reg();
auto const obj = srcLoc(env, inst, 0).reg();
auto& v = vmain(env);
v << lea{obj[offset], dst};
}

void cgStClosureCtx(IRLS& env, const IRInstruction* inst) {
auto const obj = srcLoc(env, inst, 0).reg();
auto& v = vmain(env);
Expand Down
85 changes: 0 additions & 85 deletions hphp/runtime/vm/jit/irlower-static-loc.cpp

This file was deleted.

6 changes: 0 additions & 6 deletions hphp/runtime/vm/jit/memory-effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,9 +1061,6 @@ MemEffects memory_effects_impl(const IRInstruction& inst) {
// in AliasClass yet.
return PureStore { AUnknown, inst.src(1) };

case LdClosureStaticLoc:
return may_load_store(AFrameAny, AFrameAny);

//////////////////////////////////////////////////////////////////////
// Instructions that manipulate class-ref slots

Expand Down Expand Up @@ -1766,8 +1763,6 @@ MemEffects memory_effects_impl(const IRInstruction& inst) {
case LdMIPropStateAddr:
case LdMIStateAddr:
case LdPairBase:
case CheckStaticLoc:
case LdStaticLoc:
case LdClsCns:
case LdSubClsCns:
case LdTypeCns:
Expand Down Expand Up @@ -1963,7 +1958,6 @@ MemEffects memory_effects_impl(const IRInstruction& inst) {
return may_load_store(AEmpty, AEmpty);

// Some that touch memory we might care about later, but currently don't:
case InitStaticLoc:
case ColIsEmpty:
case ColIsNEmpty:
case ConvCellToBool:
Expand Down
2 changes: 1 addition & 1 deletion hphp/runtime/vm/jit/phi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ SinkableInst findSinkablePhiSrc(
is_lval = true;
}
if (!val->inst()->is(LdLocAddr, LdStkAddr, LdMIStateAddr,
LdMIPropStateAddr, LdStaticLoc)) {
LdMIPropStateAddr)) {
return {};
}
assertx(val->inst()->numSrcs() <= 1);
Expand Down
18 changes: 0 additions & 18 deletions hphp/runtime/vm/jit/refcount-opts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1355,24 +1355,11 @@ bool irrelevant_inst(const IRInstruction& inst) {

//////////////////////////////////////////////////////////////////////

struct LdStaticLocHashEqual {
size_t operator()(const IRInstruction* inst) const {
return inst->extra<LdStaticLoc>()->hash();
}
bool operator()(const IRInstruction* i1, const IRInstruction* i2) const {
return i1->extra<LdStaticLoc>()->equals(*i2->extra<LdStaticLoc>());
}
};

void find_alias_sets(Env& env) {
FTRACE(2, "find_alias_sets --------------------------------------\n");

auto frame_to_ctx = sparse_idptr_map<SSATmp,ASetID>(env.unit.numTmps());

jit::fast_set<IRInstruction*,
LdStaticLocHashEqual,
LdStaticLocHashEqual> ldStaticLocs;

auto add = [&] (SSATmp* tmp) {
if (!tmp->type().maybe(TCounted)) return;

Expand Down Expand Up @@ -1404,11 +1391,6 @@ void find_alias_sets(Env& env) {
}

auto canon = canonical(tmp);
if (canon->inst()->is(LdStaticLoc)) {
auto const res = ldStaticLocs.insert(canon->inst());
if (!res.second) canon = (*res.first)->dst();
}

if (env.asetMap[canon] != -1) {
id = env.asetMap[canon];
} else {
Expand Down

0 comments on commit 495f1c6

Please sign in to comment.