make function and constant naming clearer (code review feedback)

This commit is contained in:
Joshua Warner 2014-05-31 19:39:36 -06:00
parent a35e47b6fb
commit 9ed6a16340

View File

@ -208,6 +208,7 @@ struct SliceStack : public Slice<T> {
void push(const T& item) void push(const T& item)
{ {
ASSERT(Slice<T>::count < capacity);
--Slice<T>::items; --Slice<T>::items;
++Slice<T>::count; ++Slice<T>::count;
*Slice<T>::items = item; *Slice<T>::items = item;
@ -223,7 +224,7 @@ struct FixedSliceStack : public SliceStack<T> {
} }
}; };
Value* pushWordSlice(Context* c, Value* slicePushWord(Context* c,
Value* v, Value* v,
size_t stackBase UNUSED, size_t stackBase UNUSED,
SliceStack<ir::Value*>& slice) SliceStack<ir::Value*>& slice)
@ -248,7 +249,7 @@ Value* pushWordSlice(Context* c,
return v; return v;
} }
void pushSlice(Context* c, void slicePush(Context* c,
unsigned footprint, unsigned footprint,
Value* v, Value* v,
size_t stackBase, size_t stackBase,
@ -261,7 +262,7 @@ void pushSlice(Context* c,
Value* low = v; Value* low = v;
if (bigEndian) { if (bigEndian) {
v = pushWordSlice(c, v, stackBase, slice); v = slicePushWord(c, v, stackBase, slice);
} }
Value* high; Value* high;
@ -270,16 +271,16 @@ void pushSlice(Context* c,
if (vm::TargetBytesPerWord == 4) { if (vm::TargetBytesPerWord == 4) {
low->maybeSplit(c); low->maybeSplit(c);
high = pushWordSlice(c, low->nextWord, stackBase, slice); high = slicePushWord(c, low->nextWord, stackBase, slice);
} else { } else {
high = pushWordSlice(c, 0, stackBase, slice); high = slicePushWord(c, 0, stackBase, slice);
} }
} else { } else {
high = 0; high = 0;
} }
if (not bigEndian) { if (not bigEndian) {
v = pushWordSlice(c, v, stackBase, slice); v = slicePushWord(c, v, stackBase, slice);
} }
if (high) { if (high) {
@ -1066,7 +1067,8 @@ void appendCombine(Context* c,
&thunk); &thunk);
if (thunk) { if (thunk) {
FixedSliceStack<ir::Value*, 6> slice; const size_t MaxValueCount = 6;
FixedSliceStack<ir::Value*, MaxValueCount> slice;
size_t stackBase = c->stack ? c->stack->index + 1 : 0; size_t stackBase = c->stack ? c->stack->index + 1 : 0;
bool threadParameter; bool threadParameter;
@ -1078,12 +1080,12 @@ void appendCombine(Context* c,
unsigned stackSize = ceilingDivide(secondValue->type.size(), vm::TargetBytesPerWord) unsigned stackSize = ceilingDivide(secondValue->type.size(), vm::TargetBytesPerWord)
+ ceilingDivide(firstValue->type.size(), vm::TargetBytesPerWord); + ceilingDivide(firstValue->type.size(), vm::TargetBytesPerWord);
pushSlice(c, slicePush(c,
ceilingDivide(secondValue->type.size(), vm::TargetBytesPerWord), ceilingDivide(secondValue->type.size(), vm::TargetBytesPerWord),
secondValue, secondValue,
stackBase, stackBase,
slice); slice);
pushSlice(c, slicePush(c,
ceilingDivide(firstValue->type.size(), vm::TargetBytesPerWord), ceilingDivide(firstValue->type.size(), vm::TargetBytesPerWord),
firstValue, firstValue,
stackBase, stackBase,
@ -1092,7 +1094,7 @@ void appendCombine(Context* c,
if (threadParameter) { if (threadParameter) {
++ stackSize; ++ stackSize;
pushSlice(c, 1, threadRegister(c), stackBase, slice); slicePush(c, 1, threadRegister(c), stackBase, slice);
} }
appendCall(c, appendCall(c,
@ -1221,7 +1223,7 @@ void appendTranslate(Context* c,
size_t stackBase = c->stack ? c->stack->index + 1 : 0; size_t stackBase = c->stack ? c->stack->index + 1 : 0;
FixedSliceStack<ir::Value*, 2> slice; FixedSliceStack<ir::Value*, 2> slice;
pushSlice(c, slicePush(c,
ceilingDivide(firstValue->type.size(), vm::TargetBytesPerWord), ceilingDivide(firstValue->type.size(), vm::TargetBytesPerWord),
firstValue, firstValue,
stackBase, stackBase,
@ -1608,7 +1610,8 @@ void appendBranch(Context* c,
&thunk); &thunk);
if (thunk) { if (thunk) {
FixedSliceStack<ir::Value*, 4> slice; const size_t MaxValueCount = 4;
FixedSliceStack<ir::Value*, MaxValueCount> slice;
size_t stackBase = c->stack ? c->stack->index + 1 : 0; size_t stackBase = c->stack ? c->stack->index + 1 : 0;
bool threadParameter; bool threadParameter;
@ -1617,12 +1620,12 @@ void appendBranch(Context* c,
assert(c, not threadParameter); assert(c, not threadParameter);
pushSlice(c, slicePush(c,
ceilingDivide(firstValue->type.size(), vm::TargetBytesPerWord), ceilingDivide(firstValue->type.size(), vm::TargetBytesPerWord),
secondValue, secondValue,
stackBase, stackBase,
slice); slice);
pushSlice(c, slicePush(c,
ceilingDivide(firstValue->type.size(), vm::TargetBytesPerWord), ceilingDivide(firstValue->type.size(), vm::TargetBytesPerWord),
firstValue, firstValue,
stackBase, stackBase,