Skip to content

Commit 6818586

Browse files
WizKidfacebook-github-bot
authored andcommitted
HHBBC does not run in lowptr mode so no need to use LSString
Summary: - LowPtr is going to be replaced with PackedPtr - This code can just use const StringData* because HHBBC runs in non-lowptr mode anyway. Reviewed By: ricklavoie Differential Revision: D77181337 fbshipit-source-id: a1b0afdb9b92f20d2ed47bf73fbf4b0648b21510
1 parent e6af575 commit 6818586

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

hphp/hhbbc/bc.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct FCallArgsLong : FCallArgsBase {
164164
explicit FCallArgsLong(Flags flags, uint32_t numArgs, uint32_t numRets,
165165
std::unique_ptr<uint8_t[]> inoutArgs,
166166
std::unique_ptr<uint8_t[]> readonlyArgs,
167-
BlockId asyncEagerTarget, LSString context)
167+
BlockId asyncEagerTarget, SString context)
168168
: FCallArgsBase(flags, numArgs, numRets)
169169
, inoutArgs(std::move(inoutArgs))
170170
, readonlyArgs(std::move(readonlyArgs))
@@ -173,7 +173,7 @@ struct FCallArgsLong : FCallArgsBase {
173173
explicit FCallArgsLong(FCallArgsBase base,
174174
std::unique_ptr<uint8_t[]> inoutArgs,
175175
std::unique_ptr<uint8_t[]> readonlyArgs,
176-
BlockId asyncEagerTarget, LSString context)
176+
BlockId asyncEagerTarget, SString context)
177177
: FCallArgsBase(std::move(base))
178178
, inoutArgs(std::move(inoutArgs))
179179
, readonlyArgs(std::move(readonlyArgs))
@@ -321,15 +321,15 @@ struct FCallArgsLong : FCallArgsBase {
321321
std::unique_ptr<uint8_t[]> inoutArgs;
322322
std::unique_ptr<uint8_t[]> readonlyArgs;
323323
BlockId asyncEagerTarget;
324-
LSString context;
324+
SString context;
325325

326326
template <typename SerDe>
327327
static copy_ptr<FCallArgsLong> makeForSerde(SerDe& sd) {
328328
static_assert(SerDe::deserializing);
329329

330330
auto base = sd.template make<FCallArgsBase>();
331331
BlockId asyncEagerTarget;
332-
LSString context;
332+
SString context;
333333
sd(asyncEagerTarget)(context);
334334

335335
bool hasInout;
@@ -385,7 +385,7 @@ struct FCallArgs {
385385
std::unique_ptr<uint8_t[]> inoutArgs,
386386
std::unique_ptr<uint8_t[]> readonlyArgs,
387387
BlockId asyncEagerTarget,
388-
LSString context)
388+
SString context)
389389
: l{flags, numArgs, numRets,
390390
std::move(inoutArgs), std::move(readonlyArgs),
391391
asyncEagerTarget, context} {}
@@ -515,7 +515,7 @@ struct FCallArgs {
515515
Flavor popFlavor(uint32_t i) const {
516516
return l->template popFlavor<nin,nobj>(i);
517517
}
518-
LSString context() const { return l->context; }
518+
SString context() const { return l->context; }
519519

520520
template <typename SerDe> static FCallArgs makeForSerde(SerDe& sd) {
521521
static_assert(SerDe::deserializing);
@@ -540,7 +540,7 @@ using SwitchTab = CompactVector<BlockId>;
540540

541541
// The final entry in the SSwitchTab is the default case, it will
542542
// always have a nullptr for the string.
543-
using SSwitchTabEnt = std::pair<LSString,BlockId>;
543+
using SSwitchTabEnt = std::pair<SString,BlockId>;
544544
using SSwitchTab = CompactVector<SSwitchTabEnt>;
545545

546546
//////////////////////////////////////////////////////////////////////

hphp/hhbbc/wide-func.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ TRACE_SET_MOD(hhbbc_mem)
3636

3737
using Buffer = CompressedBytecode;
3838

39-
static_assert(std::is_same<LSString, LowStringPtr>::value);
40-
4139
constexpr int32_t kNoSrcLoc = -1;
4240

4341
constexpr uint8_t k16BitCode = 0xfe;
@@ -103,7 +101,7 @@ T decode(const Buffer& buffer, size_t& pos) {
103101
if constexpr (std::is_same<T, FCallArgs>::value) {
104102
using FCA = FCallArgsBase;
105103
auto const base = decode<FCA>(buffer, pos);
106-
auto const context = decode<LSString>(buffer, pos);
104+
auto const context = decode<SString>(buffer, pos);
107105
auto const aeTarget = decode<BlockId>(buffer, pos) + NoBlockId;
108106
auto inout = std::unique_ptr<uint8_t[]>();
109107
if (base.flags & FCallArgsFlags::EnforceInOut) {
@@ -136,14 +134,14 @@ T decode(const Buffer& buffer, size_t& pos) {
136134
return T{first, count};
137135
}
138136

139-
if constexpr (std::is_same<T, LowStringPtr>::value) {
137+
if constexpr (std::is_same<T, const StringData*>::value) {
140138
auto const lo = decode_as_bytes<uint32_t>(buffer, pos);
141139
if (!(lo & kStringDataFlag)) {
142-
return LowStringPtr(reinterpret_cast<const StringData*>(lo));
140+
return reinterpret_cast<const StringData*>(lo);
143141
}
144142
auto const hi = decode_as_bytes<uint32_t>(buffer, pos);
145143
auto const both = (uint64_t(hi) << 32) | (uint64_t(lo) & ~kStringDataFlag);
146-
return LowStringPtr(reinterpret_cast<const StringData*>(both));
144+
return reinterpret_cast<const StringData*>(both);
147145
}
148146

149147
if constexpr (std::is_same<T, MKey>::value) {
@@ -264,9 +262,9 @@ void encode(Buffer& buffer, const T& data) {
264262
encode(buffer, data.first);
265263
encode(buffer, data.count);
266264

267-
} else if constexpr (std::is_same<T, LowStringPtr>::value) {
265+
} else if constexpr (std::is_same<T, const StringData*>::value) {
268266
static_assert(alignof(StringData) % 2 == 0);
269-
auto const raw = uintptr_t(data.get());
267+
auto const raw = uintptr_t(data);
270268
if (raw <= std::numeric_limits<uint32_t>::max()) {
271269
encode_as_bytes(buffer, safe_cast<uint32_t>(raw));
272270
} else {

0 commit comments

Comments
 (0)