diff --git a/src/bootimage.cpp b/src/bootimage.cpp index bb9f75926d..32bfe75e82 100644 --- a/src/bootimage.cpp +++ b/src/bootimage.cpp @@ -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; } diff --git a/src/compile.cpp b/src/compile.cpp index c6f33a0806..c993e82f6e 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -380,7 +380,7 @@ compareIpToMethodBounds(Thread* t, intptr_t ip, object method) if (ip < start) { return -1; } else if (ip < start + static_cast - (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(allocator->allocate(pad(length))); + uint8_t* start = static_cast + (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 - (allocator->allocate(total)); + (allocator->allocate(total, TargetBytesPerWord)); code[0] = codeSize; uint8_t* start = reinterpret_cast(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 - (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(codeAllocator(t)->allocate(*size)); + uint8_t* start = static_cast + (codeAllocator(t)->allocate(*size, TargetBytesPerWord)); a->setDestination(start); a->write(); diff --git a/src/machine.h b/src/machine.h index 1b53c9f8d8..70f3d7295e 100644 --- a/src/machine.h +++ b/src/machine.h @@ -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(p) + size == base + offset) { offset -= size;