use TargetBytesPerWord instead of BytesPerWord where appropriate

This commit is contained in:
Joel Dice 2011-09-23 23:25:52 -06:00
parent 3fa4a7001d
commit 0372d999d3
3 changed files with 20 additions and 12 deletions

View File

@ -1242,7 +1242,7 @@ makeHeapImage(Thread* t, BootImage* image, target_uintptr_t* heap,
HeapWalker* w = makeHeapWalker(t, &visitor);
visitRoots(t, image, w, constants);
image->heapSize = visitor.position * BytesPerWord;
image->heapSize = visitor.position * TargetBytesPerWord;
return w;
}

View File

@ -380,7 +380,7 @@ compareIpToMethodBounds(Thread* t, intptr_t ip, object method)
if (ip < start) {
return -1;
} else if (ip < start + static_cast<intptr_t>
(compiledSize(start) + BytesPerWord))
(compiledSize(start) + TargetBytesPerWord))
{
return 0;
} else {
@ -6554,10 +6554,11 @@ simpleFrameMapTableSize(MyThread* t, object method, object map)
}
uint8_t*
finish(MyThread* t, Allocator* allocator, Assembler* a, const char* name,
finish(MyThread* t, FixedAllocator* allocator, Assembler* a, const char* name,
unsigned length)
{
uint8_t* start = static_cast<uint8_t*>(allocator->allocate(pad(length)));
uint8_t* start = static_cast<uint8_t*>
(allocator->allocate(length, TargetBytesPerWord));
a->setDestination(start);
a->write();
@ -6872,10 +6873,11 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
unsigned codeSize = c->resolve
(allocator->base + allocator->offset + TargetBytesPerWord);
unsigned total = pad(codeSize) + pad(c->poolSize()) + TargetBytesPerWord;
unsigned total = pad(codeSize, TargetBytesPerWord)
+ pad(c->poolSize(), TargetBytesPerWord) + TargetBytesPerWord;
target_uintptr_t* code = static_cast<target_uintptr_t*>
(allocator->allocate(total));
(allocator->allocate(total, TargetBytesPerWord));
code[0] = codeSize;
uint8_t* start = reinterpret_cast<uint8_t*>(code + 1);
@ -8291,7 +8293,7 @@ MyProcessor*
processor(MyThread* t);
void
compileThunks(MyThread* t, Allocator* allocator);
compileThunks(MyThread* t, FixedAllocator* allocator);
class MyProcessor: public Processor {
public:
@ -9421,7 +9423,7 @@ compileCall(MyThread* t, Context* c, ThunkIndex index, bool call = true)
}
void
compileThunks(MyThread* t, Allocator* allocator)
compileThunks(MyThread* t, FixedAllocator* allocator)
{
MyProcessor* p = processor(t);
@ -9562,7 +9564,8 @@ compileThunks(MyThread* t, Allocator* allocator)
p->thunks.table.length = a->endBlock(false)->resolve(0, 0);
p->thunks.table.start = static_cast<uint8_t*>
(allocator->allocate(p->thunks.table.length * ThunkCount));
(allocator->allocate
(p->thunks.table.length * ThunkCount, TargetBytesPerWord));
}
uint8_t* start = p->thunks.table.start;
@ -9681,7 +9684,8 @@ compileVirtualThunk(MyThread* t, unsigned index, unsigned* size)
*size = a->endBlock(false)->resolve(0, 0);
uint8_t* start = static_cast<uint8_t*>(codeAllocator(t)->allocate(*size));
uint8_t* start = static_cast<uint8_t*>
(codeAllocator(t)->allocate(*size, TargetBytesPerWord));
a->setDestination(start);
a->write();

View File

@ -1796,8 +1796,8 @@ class FixedAllocator: public Allocator {
abort(s);
}
virtual void* allocate(unsigned size) {
unsigned paddedSize = pad(size);
void* allocate(unsigned size, unsigned padAlignment) {
unsigned paddedSize = pad(size, padAlignment);
expect(s, offset + paddedSize < capacity);
void* p = base + offset;
@ -1805,6 +1805,10 @@ class FixedAllocator: public Allocator {
return p;
}
virtual void* allocate(unsigned size) {
return allocate(size, BytesPerWord);
}
virtual void free(const void* p, unsigned size) {
if (p >= base and static_cast<const uint8_t*>(p) + size == base + offset) {
offset -= size;