Skip to content

Commit

Permalink
Rename KindOfStaticString to KindOfPersistentString
Browse files Browse the repository at this point in the history
Summary:
No logic changes, this just does a global rename to make
reviewing easier.

Reviewed By: swtaarrs

Differential Revision: D2730735

fb-gh-sync-id: b663d40abdd088a3058c0f09617582b35c30bcf6
  • Loading branch information
edwinsmith authored and hhvm-bot committed Jan 6, 2016
1 parent 5331a1e commit 127a039
Show file tree
Hide file tree
Showing 81 changed files with 251 additions and 288 deletions.
8 changes: 4 additions & 4 deletions hphp/compiler/analysis/emitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4624,7 +4624,7 @@ bool EmitterVisitor::visit(ConstructPtr node) {
e.Double(v.getDouble());
return true;

case KindOfStaticString:
case KindOfPersistentString:
case KindOfString: {
StringData* nValue = makeStaticString(v.getStringData());
e.String(nValue);
Expand Down Expand Up @@ -5793,7 +5793,7 @@ void EmitterVisitor::emitBuiltinDefaultArg(Emitter& e, Variant& v,
if (t) {
[&] {
switch (*t) {
case KindOfStaticString:
case KindOfPersistentString:
case KindOfString:
case KindOfPersistentArray:
case KindOfArray:
Expand Down Expand Up @@ -5833,7 +5833,7 @@ void EmitterVisitor::emitBuiltinDefaultArg(Emitter& e, Variant& v,
e.Double(v.toDouble());
return;

case KindOfStaticString:
case KindOfPersistentString:
case KindOfString: {
StringData *nValue = makeStaticString(v.getStringData());
e.String(nValue);
Expand Down Expand Up @@ -6407,7 +6407,7 @@ MaybeDataType EmitterVisitor::analyzeSwitch(SwitchStatementPtr sw,
DataType caseType;
if (condition->getScalarValue(cval)) {
caseType = cval.getType();
if (caseType == KindOfStaticString) caseType = KindOfString;
if (caseType == KindOfPersistentString) caseType = KindOfString;
if ((caseType != KindOfInt64 && caseType != KindOfString) ||
!IMPLIES(t != KindOfUninit, caseType == t)) {
return folly::none;
Expand Down
2 changes: 1 addition & 1 deletion hphp/compiler/expression/parameter_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ void ParameterExpression::compatibleDefault(FileScopeRawPtr file) {
(m_hhType && interface_supports_double(hint)));
return;

case KindOfStaticString:
case KindOfPersistentString:
case KindOfString:
compat = (!strcasecmp(hint, "HH\\string") ||
!strcasecmp(hint, "HH\\arraykey") ||
Expand Down
2 changes: 1 addition & 1 deletion hphp/compiler/expression/scalar_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ ScalarExpression::ScalarExpression
m_type = T_DNUMBER;
return;

case KindOfStaticString:
case KindOfPersistentString:
case KindOfString:
m_type = T_STRING;
return;
Expand Down
2 changes: 1 addition & 1 deletion hphp/hhbbc/eval-cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ folly::Optional<Type> eval_cell(Pred p) {
}
auto const sstr = makeStaticString(c.m_data.pstr);
tvDecRef(&c);
c = make_tv<KindOfStaticString>(sstr);
c = make_tv<KindOfPersistentString>(sstr);
}
break;
case KindOfArray:
Expand Down
8 changes: 4 additions & 4 deletions hphp/hhbbc/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,7 @@ Type Index::lookup_constraint(Context ctx, const TypeConstraint& tc) const {
case KindOfBoolean: return TBool;
case KindOfInt64: return TInt;
case KindOfDouble: return TDbl;
case KindOfStaticString:
case KindOfPersistentString:
case KindOfString: return TStr;
case KindOfPersistentArray:
case KindOfArray: return TArr;
Expand Down Expand Up @@ -2143,7 +2143,7 @@ Type Index::satisfies_constraint_helper(Context ctx,
case KindOfBoolean: return TBool;
case KindOfInt64: return TInt;
case KindOfDouble: return TDbl;
case KindOfStaticString:
case KindOfPersistentString:
case KindOfString: return TStr;
case KindOfPersistentArray:
case KindOfArray: return TArr;
Expand Down Expand Up @@ -2372,7 +2372,7 @@ Type Index::lookup_public_static(Type cls, Type name) const {
}();

auto const vname = tv(name);
if (!vname || (vname && vname->m_type != KindOfStaticString)) {
if (!vname || (vname && vname->m_type != KindOfPersistentString)) {
return TInitGen;
}
auto const sname = vname->m_data.pstr;
Expand Down Expand Up @@ -2654,7 +2654,7 @@ void PublicSPropIndexer::merge(Context ctx, Type tcls, Type name, Type val) {

auto const cinfo = *maybe_cinfo;
bool const unknownName = !vname ||
(vname && vname->m_type != KindOfStaticString);
(vname && vname->m_type != KindOfPersistentString);

if (!cinfo) {
if (unknownName) {
Expand Down
4 changes: 2 additions & 2 deletions hphp/hhbbc/interp-minstr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ Type mcodeKey(MIS& env) {
// Returns nullptr if it's an unknown key or not a string.
SString mStringKey(Type key) {
auto const v = tv(key);
return v && v->m_type == KindOfStaticString ? v->m_data.pstr : nullptr;
return v && v->m_type == KindOfPersistentString ? v->m_data.pstr : nullptr;
}

SString mcodeStringKey(MIS& env) {
Expand Down Expand Up @@ -607,7 +607,7 @@ Base miBaseLoc(ISS& env, borrowed_ptr<php::Local> locBase, bool isDefine) {
Base miBaseSProp(ISS& env, Type cls, Type tprop) {
auto const self = selfCls(env);
auto const prop = tv(tprop);
auto const name = prop && prop->m_type == KindOfStaticString
auto const name = prop && prop->m_type == KindOfPersistentString
? prop->m_data.pstr : nullptr;
if (self && cls.subtypeOf(*self) && name) {
if (auto const ty = selfPropAsCell(env, prop->m_data.pstr)) {
Expand Down
44 changes: 22 additions & 22 deletions hphp/hhbbc/interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ void in(ISS& env, const bc::Concat& op) {
auto const v1 = tv(t1);
auto const v2 = tv(t2);
if (v1 && v2) {
if (v1->m_type == KindOfStaticString &&
v2->m_type == KindOfStaticString) {
if (v1->m_type == KindOfPersistentString &&
v2->m_type == KindOfPersistentString) {
constprop(env);
auto const cell = eval_cell([&] {
auto s = StringData::Make(
Expand Down Expand Up @@ -780,7 +780,7 @@ void in(ISS& env, const bc::CGetL3& op) {
void in(ISS& env, const bc::CGetN&) {
auto const t1 = topC(env);
auto const v1 = tv(t1);
if (v1 && v1->m_type == KindOfStaticString) {
if (v1 && v1->m_type == KindOfPersistentString) {
if (auto const loc = findLocal(env, v1->m_data.pstr)) {
return reduce(env, bc::PopC {},
bc::CGetL { loc });
Expand All @@ -804,7 +804,7 @@ void in(ISS& env, const bc::CGetS&) {
auto const vname = tv(tname);
auto const self = selfCls(env);

if (vname && vname->m_type == KindOfStaticString &&
if (vname && vname->m_type == KindOfPersistentString &&
self && tcls.subtypeOf(*self)) {
if (auto const ty = selfPropAsCell(env, vname->m_data.pstr)) {
// Only nothrow when we know it's a private declared property
Expand Down Expand Up @@ -851,7 +851,7 @@ void in(ISS& env, const bc::VGetL& op) {
void in(ISS& env, const bc::VGetN&) {
auto const t1 = topC(env);
auto const v1 = tv(t1);
if (v1 && v1->m_type == KindOfStaticString) {
if (v1 && v1->m_type == KindOfPersistentString) {
if (auto const loc = findLocal(env, v1->m_data.pstr)) {
return reduce(env, bc::PopC {},
bc::VGetL { loc });
Expand All @@ -871,7 +871,7 @@ void in(ISS& env, const bc::VGetS&) {
auto const self = selfCls(env);

if (!self || tcls.couldBe(*self)) {
if (vname && vname->m_type == KindOfStaticString) {
if (vname && vname->m_type == KindOfPersistentString) {
boxSelfProp(env, vname->m_data.pstr);
} else {
killSelfProps(env);
Expand All @@ -891,7 +891,7 @@ void aGetImpl(ISS& env, Type t1) {
return push(env, objcls(t1));
}
auto const v1 = tv(t1);
if (v1 && v1->m_type == KindOfStaticString) {
if (v1 && v1->m_type == KindOfPersistentString) {
if (auto const rcls = env.index.resolve_class(env.ctx, v1->m_data.pstr)) {
return push(env, clsExact(*rcls));
}
Expand Down Expand Up @@ -974,7 +974,7 @@ void in(ISS& env, const bc::IssetS&) {
auto const self = selfCls(env);

if (self && tcls.subtypeOf(*self) &&
vname && vname->m_type == KindOfStaticString) {
vname && vname->m_type == KindOfPersistentString) {
if (auto const t = selfPropAsCell(env, vname->m_data.pstr)) {
if (t->subtypeOf(TNull)) { constprop(env); return push(env, TFalse); }
if (!t->couldBe(TNull)) { constprop(env); return push(env, TTrue); }
Expand All @@ -996,7 +996,7 @@ template<class ReduceOp>
void issetEmptyNImpl(ISS& env) {
auto const t1 = topC(env);
auto const v1 = tv(t1);
if (v1 && v1->m_type == KindOfStaticString) {
if (v1 && v1->m_type == KindOfPersistentString) {
if (auto const loc = findLocal(env, v1->m_data.pstr)) {
return reduce(env, bc::PopC {}, ReduceOp { loc });
}
Expand Down Expand Up @@ -1073,7 +1073,7 @@ void in(ISS& env, const bc::InstanceOfD& op) {
void in(ISS& env, const bc::InstanceOf& op) {
auto const t1 = topC(env);
auto const v1 = tv(t1);
if (v1 && v1->m_type == KindOfStaticString) {
if (v1 && v1->m_type == KindOfPersistentString) {
return reduce(env, bc::PopC {},
bc::InstanceOfD { v1->m_data.pstr });
}
Expand Down Expand Up @@ -1109,7 +1109,7 @@ void in(ISS& env, const bc::SetN&) {
auto const v2 = tv(t2);
// TODO(#3653110): could nothrow if t2 can't be an Obj or Res

auto const knownLoc = v2 && v2->m_type == KindOfStaticString
auto const knownLoc = v2 && v2->m_type == KindOfPersistentString
? findLocal(env, v2->m_data.pstr)
: nullptr;
if (knownLoc) {
Expand All @@ -1136,7 +1136,7 @@ void in(ISS& env, const bc::SetS&) {
auto const self = selfCls(env);

if (!self || tcls.couldBe(*self)) {
if (vname && vname->m_type == KindOfStaticString) {
if (vname && vname->m_type == KindOfPersistentString) {
nothrow(env);
mergeSelfProp(env, vname->m_data.pstr, t1);
} else {
Expand Down Expand Up @@ -1203,7 +1203,7 @@ void in(ISS& env, const bc::SetOpS&) {
auto const self = selfCls(env);

if (!self || tcls.couldBe(*self)) {
if (vname && vname->m_type == KindOfStaticString) {
if (vname && vname->m_type == KindOfPersistentString) {
mergeSelfProp(env, vname->m_data.pstr, TInitCell);
} else {
loseNonRefSelfPropTypes(env);
Expand Down Expand Up @@ -1236,7 +1236,7 @@ void in(ISS& env, const bc::IncDecL& op) {
void in(ISS& env, const bc::IncDecN& op) {
auto const t1 = topC(env);
auto const v1 = tv(t1);
auto const knownLoc = v1 && v1->m_type == KindOfStaticString
auto const knownLoc = v1 && v1->m_type == KindOfPersistentString
? findLocal(env, v1->m_data.pstr)
: nullptr;
if (knownLoc) {
Expand All @@ -1257,7 +1257,7 @@ void in(ISS& env, const bc::IncDecS&) {
auto const self = selfCls(env);

if (!self || tcls.couldBe(*self)) {
if (vname && vname->m_type == KindOfStaticString) {
if (vname && vname->m_type == KindOfPersistentString) {
mergeSelfProp(env, vname->m_data.pstr, TInitCell);
} else {
loseNonRefSelfPropTypes(env);
Expand All @@ -1283,7 +1283,7 @@ void in(ISS& env, const bc::BindN&) {
auto const t1 = popV(env);
auto const t2 = popC(env);
auto const v2 = tv(t2);
auto const knownLoc = v2 && v2->m_type == KindOfStaticString
auto const knownLoc = v2 && v2->m_type == KindOfPersistentString
? findLocal(env, v2->m_data.pstr)
: nullptr;
if (knownLoc) {
Expand All @@ -1308,7 +1308,7 @@ void in(ISS& env, const bc::BindS&) {
auto const self = selfCls(env);

if (!self || tcls.couldBe(*self)) {
if (vname && vname->m_type == KindOfStaticString) {
if (vname && vname->m_type == KindOfPersistentString) {
boxSelfProp(env, vname->m_data.pstr);
} else {
killSelfProps(env);
Expand All @@ -1330,7 +1330,7 @@ void in(ISS& env, const bc::UnsetL& op) {
void in(ISS& env, const bc::UnsetN& op) {
auto const t1 = topC(env);
auto const v1 = tv(t1);
if (v1 && v1->m_type == KindOfStaticString) {
if (v1 && v1->m_type == KindOfPersistentString) {
if (auto const loc = findLocal(env, v1->m_data.pstr)) {
return reduce(env, bc::PopC {},
bc::UnsetL { loc });
Expand All @@ -1354,7 +1354,7 @@ void in(ISS& env, const bc::FPushFuncD& op) {
void in(ISS& env, const bc::FPushFunc& op) {
auto const t1 = topC(env);
auto const v1 = tv(t1);
if (v1 && v1->m_type == KindOfStaticString) {
if (v1 && v1->m_type == KindOfPersistentString) {
auto const name = normalizeNS(v1->m_data.pstr);
// FPushFuncD doesn't support class-method pair strings yet.
if (isNSNormalized(name) && notClassMethodPair(name)) {
Expand Down Expand Up @@ -1396,7 +1396,7 @@ void in(ISS& env, const bc::FPushObjMethodD& op) {
void in(ISS& env, const bc::FPushObjMethod& op) {
auto const t1 = topC(env);
auto const v1 = tv(t1);
if (v1 && v1->m_type == KindOfStaticString) {
if (v1 && v1->m_type == KindOfPersistentString) {
return reduce(
env,
bc::PopC {},
Expand Down Expand Up @@ -1424,7 +1424,7 @@ void in(ISS& env, const bc::FPushClsMethod& op) {
auto const v2 = tv(t2);

folly::Optional<res::Func> rfunc;
if (v2 && v2->m_type == KindOfStaticString) {
if (v2 && v2->m_type == KindOfPersistentString) {
rfunc = env.index.resolve_method(env.ctx, t1, v2->m_data.pstr);
}
folly::Optional<res::Class> rcls;
Expand Down Expand Up @@ -1531,7 +1531,7 @@ void in(ISS& env, const bc::FPassS& op) {
auto const tname = popC(env);
auto const vname = tv(tname);
if (!self || tcls.couldBe(*self)) {
if (vname && vname->m_type == KindOfStaticString) {
if (vname && vname->m_type == KindOfPersistentString) {
// May or may not be boxing it, depending on the refiness.
mergeSelfProp(env, vname->m_data.pstr, TInitGen);
} else {
Expand Down
2 changes: 1 addition & 1 deletion hphp/hhbbc/optimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ bool propagate_constants(const Bytecode& op, const State& state, Gen gen) {
case KindOfDouble:
gen(bc::Double { v->m_data.dbl });
break;
case KindOfStaticString:
case KindOfPersistentString:
gen(bc::String { v->m_data.pstr });
break;
case KindOfPersistentArray:
Expand Down
6 changes: 3 additions & 3 deletions hphp/hhbbc/type-system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ folly::Optional<Cell> tv(Type t) {
switch (t.m_dataTag) {
case DataTag::Int: return make_tv<KindOfInt64>(t.m_data.ival);
case DataTag::Dbl: return make_tv<KindOfDouble>(t.m_data.dval);
case DataTag::Str: return make_tv<KindOfStaticString>(t.m_data.sval);
case DataTag::Str: return make_tv<KindOfPersistentString>(t.m_data.sval);
case DataTag::ArrVal:
if ((t.m_bits & BArrN) == t.m_bits) {
return make_tv<KindOfPersistentArray>(
Expand Down Expand Up @@ -1603,7 +1603,7 @@ Type from_cell(Cell cell) {
case KindOfInt64: return ival(cell.m_data.num);
case KindOfDouble: return dval(cell.m_data.dbl);

case KindOfStaticString:
case KindOfPersistentString:
case KindOfString:
always_assert(cell.m_data.pstr->isStatic());
return sval(cell.m_data.pstr);
Expand All @@ -1629,7 +1629,7 @@ Type from_DataType(DataType dt) {
case KindOfBoolean: return TBool;
case KindOfInt64: return TInt;
case KindOfDouble: return TDbl;
case KindOfStaticString:
case KindOfPersistentString:
case KindOfString: return TStr;
case KindOfPersistentArray:
case KindOfArray: return TArr;
Expand Down
2 changes: 1 addition & 1 deletion hphp/hhbbc/type-system.h
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ DCls dcls_of(Type t);
Type from_cell(Cell tv);

/*
* Create a Type from a DataType. KindOfString and KindOfStaticString
* Create a Type from a DataType. KindOfString and KindOfPersistentString
* are both treated as TStr.
*
* Pre: dt is one of the DataTypes that actually represent php values
Expand Down
2 changes: 1 addition & 1 deletion hphp/runtime/base/actrec-args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static const char *argTypeName(DataType dt) {
case KindOfBoolean: return "boolean";
case KindOfInt64: return "integer";
case KindOfDouble: return "double";
case KindOfStaticString:
case KindOfPersistentString:
case KindOfString: return "string";
case KindOfPersistentArray:
case KindOfArray: return "array";
Expand Down
2 changes: 1 addition & 1 deletion hphp/runtime/base/annot-type.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ annotCompat(DataType dt, AnnotType at, const StringData* annotClsName) {
case KindOfDouble:
return interface_supports_double(annotClsName)
? AnnotAction::Pass : AnnotAction::Fail;
case KindOfStaticString:
case KindOfPersistentString:
case KindOfString:
return interface_supports_string(annotClsName)
? AnnotAction::Pass : AnnotAction::Fail;
Expand Down
6 changes: 2 additions & 4 deletions hphp/runtime/base/apc-handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ APCHandle::Pair APCHandle::Create(const Variant& source,
}
return APCString::MakeSharedString(s);
}
case KindOfStaticString:
case KindOfPersistentString:
return createStaticStr(source.getStringData());

case KindOfPersistentArray:
Expand Down Expand Up @@ -231,10 +231,8 @@ bool APCHandle::checkInvariants() const {
assert(m_type == KindOfDouble);
return true;
case APCKind::StaticString:
assert(m_type == KindOfStaticString);
return true;
case APCKind::UncountedString:
assert(m_type == KindOfString);
assert(m_type == KindOfPersistentString);
return true;
case APCKind::StaticArray:
case APCKind::UncountedArray:
Expand Down
Loading

0 comments on commit 127a039

Please sign in to comment.