Fix printing of ActRecInfo
If it's an AR for a constructor, the high-order bit is set, and it gets printed as -2 billion. This is confusing; at first I thought it was a bug. Print it out in a readable way.
Esse commit está contido em:
@@ -271,11 +271,11 @@ struct ActRec {
|
||||
*/
|
||||
|
||||
int32_t numArgs() const {
|
||||
return m_numArgsAndCtorFlag & ~(1u << 31);
|
||||
return decodeNumArgs(m_numArgsAndCtorFlag).first;
|
||||
}
|
||||
|
||||
bool isFromFPushCtor() const {
|
||||
return m_numArgsAndCtorFlag & (1u << 31);
|
||||
return decodeNumArgs(m_numArgsAndCtorFlag).second;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
@@ -284,6 +284,11 @@ struct ActRec {
|
||||
return numArgs | (isFPushCtor << 31);
|
||||
}
|
||||
|
||||
static inline std::pair<uint32_t,bool>
|
||||
decodeNumArgs(uint32_t numArgs) {
|
||||
return { numArgs & ~(1u << 31), numArgs & (1u << 31) };
|
||||
}
|
||||
|
||||
void initNumArgs(uint32_t numArgs, bool isFPushCtor = false) {
|
||||
m_numArgsAndCtorFlag = encodeNumArgs(numArgs, isFPushCtor);
|
||||
}
|
||||
|
||||
@@ -201,7 +201,10 @@ struct ActRecInfo : IRExtraData {
|
||||
int32_t numArgs;
|
||||
|
||||
std::string show() const {
|
||||
return folly::to<std::string>(numArgs, invName ? " M" : "");
|
||||
auto numArgsAndCtorFlag = ActRec::decodeNumArgs(numArgs);
|
||||
return folly::to<std::string>(numArgsAndCtorFlag.first,
|
||||
numArgsAndCtorFlag.second ? ",ctor" : "",
|
||||
invName ? " M" : "");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1579,7 +1579,7 @@ void HhbcTranslator::emitFPushCtorCommon(SSATmp* cls,
|
||||
fn = gen(LdClsCtor, cls);
|
||||
}
|
||||
SSATmp* obj2 = gen(IncRef, obj);
|
||||
int32_t numArgsAndCtorFlag = numParams | (1 << 31);
|
||||
int32_t numArgsAndCtorFlag = ActRec::encodeNumArgs(numParams, true);
|
||||
emitFPushActRec(fn, obj2, numArgsAndCtorFlag, nullptr);
|
||||
}
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário