Fixed some minor issues reported by clang

This commit is contained in:
kobalicek
2014-11-17 00:28:56 +01:00
parent 06f1dbb32d
commit f95a065ee2
6 changed files with 14 additions and 30 deletions

View File

@@ -40,11 +40,11 @@ enum { kBaseCompilerDefaultLookAhead = 64 };
Compiler::Compiler(Runtime* runtime) :
CodeGen(runtime),
_assembler(NULL),
_nodeFlowId(0),
_nodeFlags(0),
_maxLookAhead(kBaseCompilerDefaultLookAhead),
_targetVarMapping(NULL),
_assembler(NULL),
_firstNode(NULL),
_lastNode(NULL),
_cursor(NULL),

View File

@@ -162,19 +162,6 @@ void ConstPool::reset() {
// [asmjit::ConstPool - Ops]
// ============================================================================
static ASMJIT_INLINE size_t ConstPool_getGapIndex(size_t size) {
if (size <= 1)
return ConstPool::kIndex1;
else if (size <= 3)
return ConstPool::kIndex2;
else if (size <= 7)
return ConstPool::kIndex4;
else if (size <= 15)
return ConstPool::kIndex8;
else
return ConstPool::kIndex16;
}
static ASMJIT_INLINE ConstPoolGap* ConstPool_allocGap(ConstPool* self) {
ConstPoolGap* gap = self->_gapPool;
if (gap == NULL)
@@ -481,7 +468,6 @@ UNIT(base_constpool) {
INFO("Checking pool alignment when combined constants are added.");
{
uint8_t bytes[32] = { 0 };
uint64_t c = 0;
size_t offset;
pool.add(bytes, 1, offset);

View File

@@ -217,7 +217,7 @@ Error Context::resolveCellOffsets() {
// Vars - Allocated according to alignment/width.
while (varCell != NULL) {
uint32_t size = varCell->getSize();
uint32_t offset;
uint32_t offset = 0;
switch (size) {
case 1: offset = pos1 ; pos1 += 1 ; break;

View File

@@ -968,16 +968,18 @@ static bool X86Assembler_dumpComment(StringBuilder& sb, size_t len, const uint8_
// [asmjit::X86Assembler - Emit]
// ============================================================================
#define HI_REG(_Index_) ((_kX86RegTypePatchedGpbHi << 8) | _Index_)
//! \internal
static const Operand::VRegOp x86PatchedHiRegs[4] = {
// --------------+---+--------------------------------+--------------+------+
// Operand | S | Register Code | OperandId |Unused|
// --------------+---+--------------------------------+--------------+------+
{ kOperandTypeReg, 1 , (_kX86RegTypePatchedGpbHi << 8) | 4, kInvalidValue, 0, 0 },
{ kOperandTypeReg, 1 , (_kX86RegTypePatchedGpbHi << 8) | 5, kInvalidValue, 0, 0 },
{ kOperandTypeReg, 1 , (_kX86RegTypePatchedGpbHi << 8) | 6, kInvalidValue, 0, 0 },
{ kOperandTypeReg, 1 , (_kX86RegTypePatchedGpbHi << 8) | 7, kInvalidValue, 0, 0 }
// --------------+---+--------------+--------------+------------+
// Operand | S | Reg. Code | OperandId | Unused |
// --------------+---+--------------+--------------+------------+
{ kOperandTypeReg, 1 , { HI_REG(4) }, kInvalidValue, {{ 0, 0 }} },
{ kOperandTypeReg, 1 , { HI_REG(5) }, kInvalidValue, {{ 0, 0 }} },
{ kOperandTypeReg, 1 , { HI_REG(6) }, kInvalidValue, {{ 0, 0 }} },
{ kOperandTypeReg, 1 , { HI_REG(7) }, kInvalidValue, {{ 0, 0 }} }
};
#undef HI_REG
template<int Arch>
static Error ASMJIT_CDECL X86Assembler_emit(Assembler* self_, uint32_t code, const Operand* o0, const Operand* o1, const Operand* o2, const Operand* o3) {
@@ -4108,7 +4110,6 @@ _EmitJmpOrCallAbs:
if (Arch == kArchX64) {
Ptr baseAddress = self->getBaseAddress();
Ptr diff = rd.data - (baseAddress + rd.from + 4);
// If the base address of the output is known, it's possible to determine
// the need for a trampoline here. This saves possible REX prefix in

View File

@@ -279,8 +279,8 @@ X86Context::~X86Context() {}
// [asmjit::X86Context - Reset]
// ============================================================================
void X86Context::reset() {
Context::reset();
void X86Context::reset(bool releaseMemory) {
Context::reset(releaseMemory);
_x86State.reset(0);
_clobberedRegs.reset();
@@ -2090,7 +2090,6 @@ Error X86Context::fetch() {
Node* next = NULL;
Node* stop = getStop();
uint32_t groupId = 1;
uint32_t flowId = 0;
VarAttr vaTmpList[80];
@@ -4432,8 +4431,6 @@ ASMJIT_INLINE void X86CallAlloc::ret() {
//! \internal
static Error X86Context_translateOperands(X86Context* self, Operand* opList, uint32_t opCount) {
X86Compiler* compiler = self->getCompiler();
const X86VarInfo* varInfo = _x86VarInfo;
uint32_t hasGpdBase = compiler->getRegSize() == 4;
// Translate variables into registers.

View File

@@ -59,7 +59,7 @@ struct X86Context : public Context {
// [Reset]
// --------------------------------------------------------------------------
virtual void reset();
virtual void reset(bool releaseMemory = false);
// --------------------------------------------------------------------------
// [Arch]