Ad few more lint fixes under runtime/vm/translator

Esse commit está contido em:
Jordan DeLong
2013-04-20 14:04:42 -07:00
commit de Sara Golemon
commit a70b1bf8f7
16 arquivos alterados com 82 adições e 66 exclusões
+4
Ver Arquivo
@@ -13,6 +13,8 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_ASM_X64_TEST_H_
#define incl_HPHP_ASM_X64_TEST_H_
namespace HPHP {
namespace x64 {
@@ -24,3 +26,5 @@ void testEmitMethods();
}
}
#endif
+1 -2
Ver Arquivo
@@ -54,7 +54,7 @@ enum SyncOptions {
// Information about where code was generated, for pretty-printing.
struct AsmInfo {
AsmInfo(const IRFactory* factory)
explicit AsmInfo(const IRFactory* factory)
: instRanges(factory, TcaRange(nullptr, nullptr))
, asmRanges(factory, TcaRange(nullptr, nullptr))
, astubRanges(factory, TcaRange(nullptr, nullptr))
@@ -464,7 +464,6 @@ private:
std::vector<ArgDesc> m_args;
};
using namespace HPHP::VM::Transl::TargetCache;
ActRec* irNewInstanceHelper(Class* cls,
int numArgs,
Cell* sp,
+3 -3
Ver Arquivo
@@ -32,7 +32,7 @@ namespace {
class MemMap {
public:
MemMap(IRFactory* factory)
explicit MemMap(IRFactory* factory)
: m_factory(factory)
, m_liveInsts(factory->numInsts()) {
assert(factory != nullptr);
@@ -71,7 +71,7 @@ private:
// it can also track the reference count of the box for better availability
// analysis. and when the object gets to a ref count of 0 it will be destroyed
struct RefInfo : public Counted {
RefInfo(IRInstruction* inst, bool killValue = false) {
explicit RefInfo(IRInstruction* inst, bool killValue = false) {
update(inst, killValue);
}
@@ -86,7 +86,7 @@ private:
};
struct LocInfo : public Counted {
LocInfo(IRInstruction* inst, bool killValue = false) {
explicit LocInfo(IRInstruction* inst, bool killValue = false) {
update(inst, killValue);
}
+1 -1
Ver Arquivo
@@ -36,7 +36,7 @@ enum FuncType : unsigned {
struct FuncPtr {
FuncPtr() {}
FuncPtr(TCA f) : type(FPtr), ptr(f) {}
/* implicit */ FuncPtr(TCA f) : type(FPtr), ptr(f) {}
FuncPtr(FuncType t, uint64_t i) : type(t), srcIdx(i) { assert(t == FSSA); }
FuncType type;
+3 -3
Ver Arquivo
@@ -311,9 +311,9 @@ public:
}
struct DisableCseGuard {
DisableCseGuard(TraceBuilder& tb)
: m_tb(tb)
, m_oldEnable(tb.m_enableCse)
explicit DisableCseGuard(TraceBuilder& tb)
: m_tb(tb)
, m_oldEnable(tb.m_enableCse)
{
m_tb.m_enableCse = false;
}
+3 -3
Ver Arquivo
@@ -37,13 +37,13 @@ namespace HPHP { namespace VM { namespace Transl {
*/
struct PhysReg {
explicit constexpr PhysReg(int n = -1) : n(n) {}
/* implicit */ constexpr PhysReg(Reg64 r) : n(int(r)) {}
constexpr /* implicit */ PhysReg(Reg64 r) : n(int(r)) {}
explicit constexpr PhysReg(Reg32 r) : n(int(RegNumber(r))) {}
explicit constexpr PhysReg(RegNumber r) : n(int(r)) {}
constexpr operator Reg64() const { return Reg64(n); }
constexpr operator RegNumber() const { return RegNumber(n); }
constexpr /* implicit */ operator Reg64() const { return Reg64(n); }
constexpr /* implicit */ operator RegNumber() const { return RegNumber(n); }
explicit constexpr operator int() const { return n; }
constexpr bool operator==(PhysReg r) const { return n == r.n; }
+4 -1
Ver Arquivo
@@ -13,13 +13,16 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#define __STDC_FORMAT_MACROS
#include "runtime/vm/translator/regalloc.h"
#include <set>
#include <cinttypes>
#include <boost/format.hpp>
#include "runtime/base/types.h"
#include "util/trace.h"
#include "regalloc.h"
namespace HPHP { namespace VM { namespace Transl {
+9 -5
Ver Arquivo
@@ -51,10 +51,14 @@ struct RegContent {
int64_t m_int;
Location m_loc;
RegContent(const Location &loc, int64_t intval = 0)
: m_kind(Loc), m_int(intval), m_loc(loc) { }
explicit RegContent(const Location &loc, int64_t intval = 0)
: m_kind(Loc), m_int(intval), m_loc(loc) {}
RegContent(int64_t _m_int) : m_kind(Int), m_int(_m_int), m_loc(Location()) { }
explicit RegContent(int64_t _m_int)
: m_kind(Int)
, m_int(_m_int)
, m_loc(Location())
{}
RegContent() : m_kind(Invalid), m_int(0), m_loc(Location()) { }
@@ -419,7 +423,7 @@ class LazyScratchReg : boost::noncopyable {
RegAlloc& m_regMap;
PhysReg m_reg;
public:
LazyScratchReg(RegAlloc& regMap);
explicit LazyScratchReg(RegAlloc& regMap);
~LazyScratchReg();
bool isAllocated() const { return m_reg != reg::noreg; }
@@ -436,7 +440,7 @@ class LazyScratchReg : boost::noncopyable {
class ScratchReg : public LazyScratchReg {
public:
ScratchReg(RegAlloc& regMap);
explicit ScratchReg(RegAlloc& regMap);
// Use this constructor to reserve an already-selected register, which
// must be free.
ScratchReg(RegAlloc& regMap, PhysReg pr);
+2 -2
Ver Arquivo
@@ -13,14 +13,14 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#include "runtime/vm/translator/runtime-type.h"
#include <assert.h>
#include <stdint.h>
#include <stdarg.h>
#include "runtime/vm/bytecode.h"
#include "runtime/base/types.h"
#include "runtime-type.h"
#include "translator.h"
#include "runtime/vm/translator/translator.h"
namespace HPHP {
namespace VM {
+19 -17
Ver Arquivo
@@ -37,10 +37,12 @@ struct Location {
This, // $this in the current frame
};
Location(Space spc)
: space(spc)
, offset(0)
{ assert(spc == This); }
explicit Location(Space spc)
: space(spc)
, offset(0)
{
assert(spc == This);
}
Location(Space spc, int64_t off)
: space(spc)
@@ -125,12 +127,12 @@ public:
};
struct InputInfo {
InputInfo(const Location &l)
: loc(l),
dontBreak(false),
dontGuard(l.isLiteral()),
dontGuardInner(false)
{}
explicit InputInfo(const Location &l)
: loc(l)
, dontBreak(false)
, dontGuard(l.isLiteral())
, dontGuardInner(false)
{}
std::string pretty() const {
std::string p = loc.pretty();
@@ -228,17 +230,17 @@ class RuntimeType {
}
public:
RuntimeType(DataType outer, DataType inner = KindOfInvalid,
const Class* = nullptr);
RuntimeType(const StringData*);
RuntimeType(const ArrayData*);
RuntimeType(const Class*);
explicit RuntimeType(DataType outer, DataType inner = KindOfInvalid,
const Class* = nullptr);
explicit RuntimeType(const StringData*);
explicit RuntimeType(const ArrayData*);
explicit RuntimeType(const Class*);
explicit RuntimeType(bool value);
explicit RuntimeType(int64_t value);
RuntimeType(const RuntimeType& copy);
RuntimeType();
RuntimeType(const Iter* iter);
RuntimeType(ArrayIter::Type type);
explicit RuntimeType(const Iter* iter);
explicit RuntimeType(ArrayIter::Type type);
static const int UnknownBool = -1;
+1 -1
Ver Arquivo
@@ -13,6 +13,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#include "runtime/vm/translator/srcdb.h"
#include <stdint.h>
#include <stdarg.h>
@@ -21,7 +22,6 @@
#include "util/base.h"
#include "util/trace.h"
#include "runtime/vm/translator/translator-x64.h"
#include "srcdb.h"
namespace HPHP {
namespace VM {
+1 -1
Ver Arquivo
@@ -90,7 +90,7 @@ struct VMRegAnchor : private boost::noncopyable {
m_old = tl_regState;
Translator::Get()->sync();
}
VMRegAnchor(ActRec* ar) {
explicit VMRegAnchor(ActRec* ar) {
// Some C++ entry points have an ActRec prepared from after a call
// instruction. This syncs us to right after the call instruction.
assert(tl_regState == REGSTATE_DIRTY);
+6 -4
Ver Arquivo
@@ -14,6 +14,9 @@
+----------------------------------------------------------------------+
*/
#define __STDC_FORMAT_MACROS
#include "runtime/vm/translator/translator-x64.h"
#include <cinttypes>
#include <stdint.h>
#include <assert.h>
@@ -76,7 +79,6 @@ typedef __sighandler_t *sighandler_t;
#include "runtime/vm/translator/targetcache.h"
#include "runtime/vm/translator/translator-deps.h"
#include "runtime/vm/translator/translator-inline.h"
#include "runtime/vm/translator/translator-x64.h"
#include "runtime/vm/translator/srcdb.h"
#include "runtime/vm/translator/x64-util.h"
#include "runtime/vm/translator/unwind-x64.h"
@@ -3017,7 +3019,7 @@ TranslatorX64::emitRetFromInterpretedGeneratorFrame() {
class FreeRequestStubTrigger : public Treadmill::WorkItem {
TCA m_stub;
public:
FreeRequestStubTrigger(TCA stub) : m_stub(stub) {
explicit FreeRequestStubTrigger(TCA stub) : m_stub(stub) {
TRACE(3, "FreeStubTrigger @ %p, stub %p\n", this, m_stub);
}
virtual void operator()() {
@@ -11863,7 +11865,7 @@ namespace {
struct DeferredFileInvalidate : public DeferredWorkItem {
Eval::PhpFile* m_f;
DeferredFileInvalidate(Eval::PhpFile* f) : m_f(f) {
explicit DeferredFileInvalidate(Eval::PhpFile* f) : m_f(f) {
TRACE(2, "DeferredFileInvalidate @ %p, m_f %p\n", this, m_f); }
void operator()() {
TRACE(2, "DeferredFileInvalidate: Firing @ %p , m_f %p\n", this, m_f);
@@ -11873,7 +11875,7 @@ struct DeferredFileInvalidate : public DeferredWorkItem {
struct DeferredPathInvalidate : public DeferredWorkItem {
const std::string m_path;
DeferredPathInvalidate(const std::string& path) : m_path(path) {
explicit DeferredPathInvalidate(const std::string& path) : m_path(path) {
assert(m_path.size() >= 1 && m_path[0] == '/');
}
void operator()() {
+18 -17
Ver Arquivo
@@ -13,11 +13,13 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#define __STDC_FORMAT_MACROS
#include "runtime/vm/translator/translator.h"
// Translator front-end: parse instruction stream into basic blocks, decode
// and normalize instructions. Propagate run-time type info to instructions
// to annotate their inputs and outputs with types.
#define __STDC_FORMAT_MACROS
#include <cinttypes>
#include <assert.h>
#include <stdint.h>
@@ -35,7 +37,6 @@
#include "runtime/vm/hhbc.h"
#include "runtime/vm/bytecode.h"
#include "runtime/vm/translator/targetcache.h"
#include "runtime/vm/translator/translator.h"
#include "runtime/vm/translator/translator-deps.h"
#include "runtime/vm/translator/translator-inline.h"
#include "runtime/vm/translator/translator-x64.h"
@@ -499,7 +500,7 @@ static RuntimeType bitOpType(DynLocation* a, DynLocation* b) {
vector<DynLocation*> ins;
ins.push_back(a);
if (b) ins.push_back(b);
return inferType(BitOpRules, ins);
return RuntimeType(inferType(BitOpRules, ins));
}
static uint32_t m_w = 1; /* must not be zero */
@@ -1798,11 +1799,11 @@ static void addMVectorInputs(NormalizedInstruction& ni,
auto push_stack = [&] {
++stackCount;
inputs.push_back(Location(Location::Stack, localStackOffset++));
inputs.emplace_back(Location(Location::Stack, localStackOffset++));
};
auto push_local = [&] (int imm) {
++localCount;
inputs.push_back(Location(Location::Local, imm));
inputs.emplace_back(Location(Location::Local, imm));
};
/*
@@ -1827,7 +1828,7 @@ static void addMVectorInputs(NormalizedInstruction& ni,
switch (numLocationCodeStackVals(lcode)) {
case 0: {
if (lcode == LH) {
inputs.push_back(Location(Location::This));
inputs.emplace_back(Location(Location::This));
} else {
assert(lcode == LL || lcode == LGL || lcode == LNL);
int numImms = numLocationCodeImms(lcode);
@@ -1867,10 +1868,10 @@ static void addMVectorInputs(NormalizedInstruction& ni,
if (memberCodeImmIsLoc(mcode)) {
push_local(imm);
} else if (memberCodeImmIsString(mcode)) {
inputs.push_back(Location(Location::Litstr, imm));
inputs.emplace_back(Location(Location::Litstr, imm));
} else {
assert(memberCodeImmIsInt(mcode));
inputs.push_back(Location(Location::Litint, imm));
inputs.emplace_back(Location(Location::Litint, imm));
}
} else {
push_stack();
@@ -1925,7 +1926,7 @@ void Translator::getInputs(Tracelet& t,
inputs.needsRefCheck = true;
}
if (input & Iter) {
inputs.push_back(Location(Location::Iter, ni->imm[0].u_IVA));
inputs.emplace_back(Location(Location::Iter, ni->imm[0].u_IVA));
}
if (input & FStack) {
currentStackOffset -= ni->imm[0].u_IVA; // arguments consumed
@@ -1934,15 +1935,15 @@ void Translator::getInputs(Tracelet& t,
if (input & IgnoreInnerType) ni->ignoreInnerType = true;
if (input & Stack1) {
SKTRACE(1, sk, "getInputs: stack1 %d\n", currentStackOffset - 1);
inputs.push_back(Location(Location::Stack, --currentStackOffset));
inputs.emplace_back(Location(Location::Stack, --currentStackOffset));
if (input & DontGuardStack1) inputs.back().dontGuard = true;
if (input & DontBreakStack1) inputs.back().dontBreak = true;
if (input & Stack2) {
SKTRACE(1, sk, "getInputs: stack2 %d\n", currentStackOffset - 1);
inputs.push_back(Location(Location::Stack, --currentStackOffset));
inputs.emplace_back(Location(Location::Stack, --currentStackOffset));
if (input & Stack3) {
SKTRACE(1, sk, "getInputs: stack3 %d\n", currentStackOffset - 1);
inputs.push_back(Location(Location::Stack, --currentStackOffset));
inputs.emplace_back(Location(Location::Stack, --currentStackOffset));
}
}
}
@@ -1951,7 +1952,7 @@ void Translator::getInputs(Tracelet& t,
SKTRACE(1, sk, "getInputs: stackN %d %d\n", currentStackOffset - 1,
numArgs);
for (int i = 0; i < numArgs; i++) {
inputs.push_back(Location(Location::Stack, --currentStackOffset));
inputs.emplace_back(Location(Location::Stack, --currentStackOffset));
inputs.back().dontGuard = true;
inputs.back().dontBreak = true;
}
@@ -1961,7 +1962,7 @@ void Translator::getInputs(Tracelet& t,
SKTRACE(1, sk, "getInputs: BStackN %d %d\n", currentStackOffset - 1,
numArgs);
for (int i = 0; i < numArgs; i++) {
inputs.push_back(Location(Location::Stack, --currentStackOffset));
inputs.emplace_back(Location(Location::Stack, --currentStackOffset));
}
}
if (input & MVector) {
@@ -1991,7 +1992,7 @@ void Translator::getInputs(Tracelet& t,
break;
}
SKTRACE(1, sk, "getInputs: local %d\n", loc);
inputs.push_back(Location(Location::Local, loc));
inputs.emplace_back(Location(Location::Local, loc));
if (input & DontGuardLocal) inputs.back().dontGuard = true;
if (input & DontBreakLocal) inputs.back().dontBreak = true;
}
@@ -2024,7 +2025,7 @@ void Translator::getInputs(Tracelet& t,
int n = curFunc()->numLocals();
for (int i = 0; i < n; ++i) {
if (!ni->nonRefCountedLocals[i]) {
inputs.push_back(Location(Location::Local, i));
inputs.emplace_back(Location(Location::Local, i));
}
}
}
@@ -2039,7 +2040,7 @@ void Translator::getInputs(Tracelet& t,
}
}
if (input & This) {
inputs.push_back(Location(Location::This));
inputs.emplace_back(Location(Location::This));
}
}
+4 -3
Ver Arquivo
@@ -491,9 +491,10 @@ class UnknownInputExc : public std::exception {
class GuardType {
public:
GuardType(DataType outer = KindOfInvalid, DataType inner = KindOfInvalid);
GuardType(const RuntimeType& rtt);
GuardType(const GuardType& other);
explicit GuardType(DataType outer = KindOfInvalid,
DataType inner = KindOfInvalid);
explicit GuardType(const RuntimeType& rtt);
GuardType(const GuardType& other);
const DataType getOuterType() const;
const DataType getInnerType() const;
bool isSpecific() const;
+3 -3
Ver Arquivo
@@ -80,7 +80,7 @@ struct LeaseHolderBase {
public:
~LeaseHolderBase();
operator bool() const { return m_haveLock; }
explicit operator bool() const { return m_haveLock; }
bool acquire();
private:
@@ -89,11 +89,11 @@ struct LeaseHolderBase {
bool m_acquired;
};
struct LeaseHolder : public LeaseHolderBase {
LeaseHolder(Lease& l, LeaseAcquire acquire = ACQUIRE)
explicit LeaseHolder(Lease& l, LeaseAcquire acquire = ACQUIRE)
: LeaseHolderBase(l, acquire, false) {}
};
struct BlockingLeaseHolder : public LeaseHolderBase {
BlockingLeaseHolder(Lease& l)
explicit BlockingLeaseHolder(Lease& l)
: LeaseHolderBase(l, ACQUIRE, true) {}
};