Skip to content

Commit

Permalink
common/sclang: more integer type fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Blechmann <tim@klingt.org>
  • Loading branch information
timblechmann committed Sep 9, 2012
1 parent fbe8bce commit 497d830
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion common/SC_AllocPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ void* AllocPool::Realloc(void* inPtr, size_t inReqSize)
void AllocPool::LinkFree(AllocChunkPtr inChunk)
{
size_t size = inChunk->Size();
int index = BinIndex(size);
size_t index = BinIndex(size);

AllocChunkPtr bin = mBins + index;

Expand Down
8 changes: 4 additions & 4 deletions include/common/SC_AllocPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ class AllocPool
return (bits << 3) + (inSize >> bits) ;
}

void MarkBinBlock(int inIndex)
void MarkBinBlock(size_t inIndex)
{
unsigned long word = inIndex >> 5;
unsigned long bitPosition = inIndex & 31;
unsigned long bitValue = 1L << bitPosition;
size_t word = inIndex >> 5;
size_t bitPosition = inIndex & 31;
size_t bitValue = 1L << bitPosition;
mBinBlocks[word] |= bitValue;
}

Expand Down
4 changes: 2 additions & 2 deletions include/lang/ByteCodeArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef unsigned char Byte;
typedef struct {
Byte *bytes;
Byte *ptr;
long size;
size_t size;
} ByteCodeArray, *ByteCodes;

extern ByteCodes gCompilingByteCodes;
Expand All @@ -42,7 +42,7 @@ void copyByteCodes(Byte *dest, ByteCodes byteCodes);
ByteCodes getByteCodes();
ByteCodes saveByteCodeArray();
void restoreByteCodeArray(ByteCodes byteCodes);
int byteCodeLength(ByteCodes byteCodes);
size_t byteCodeLength(ByteCodes byteCodes);
void compileByteCodes(ByteCodes byteCodes);
ByteCodes allocByteCodes();
void reallocByteCodes(ByteCodes byteCodes);
Expand Down
5 changes: 2 additions & 3 deletions lang/LangSource/ByteCodeArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void restoreByteCodeArray(ByteCodes byteCodes)
gCompilingByteCodes = byteCodes;
}

int byteCodeLength(ByteCodes byteCodes)
size_t byteCodeLength(ByteCodes byteCodes)
{
if (!byteCodes) return 0;
return (byteCodes->ptr - byteCodes->bytes);
Expand Down Expand Up @@ -176,13 +176,12 @@ ByteCodes allocByteCodes()
void reallocByteCodes(ByteCodes byteCodes)
{
Byte *newBytes;
int newLen;

if (byteCodes->size != (byteCodes->ptr - byteCodes->bytes)) {
error("reallocByteCodes called with size != byteCode len");
}

newLen = byteCodes->size << 1;
size_t newLen = byteCodes->size << 1;
// pyrmalloc: I think that all bytecodes are copied to objects
// lifetime: kill after compile
newBytes = (Byte *)pyr_pool_compile->Alloc(newLen);
Expand Down
8 changes: 4 additions & 4 deletions lang/LangSource/PyrInterpreter3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ PyrProcess* newPyrProcess(VMGlobals *g, PyrClass *procclassobj)
}

PyrSymbol * contextsym = getsym("functionCompileContext");
int index = slotRawInt(&class_interpreter->classIndex) + contextsym->u.index;
size_t index = slotRawInt(&class_interpreter->classIndex) + contextsym->u.index;
PyrMethod * meth = gRowTable[index];
if (!meth || slotRawSymbol(&meth->name) != contextsym) {
error("compile context method 'functionCompileContext' not found.\n");
Expand Down Expand Up @@ -537,7 +537,8 @@ HOT void Interpret(VMGlobals *g)
// byte code values
unsigned char *ip;
unsigned char op1;
int op2, op3, index, tag;
size_t index;
int op2, op3, tag;
// interpreter globals

// temporary variables used in the interpreter
Expand Down Expand Up @@ -2754,7 +2755,6 @@ void DumpDetailedBackTrace(VMGlobals *g)

void DumpStack(VMGlobals *g, PyrSlot *sp)
{
int i;
PyrSlot *slot;
char str[128];
#if BCSTAT
Expand All @@ -2763,7 +2763,7 @@ void DumpStack(VMGlobals *g, PyrSlot *sp)
postfl("STACK:\n");
slot = sp - 64;
if (slot < g->gc->Stack()->slots) slot = g->gc->Stack()->slots;
for (i=slot - g->gc->Stack()->slots; slot<=sp; slot++, ++i) {
for (size_t i=slot - g->gc->Stack()->slots; slot<=sp; slot++, ++i) {
slotString(slot, str);
post(" %2d %s\n", i, str);
}
Expand Down

0 comments on commit 497d830

Please sign in to comment.