diff --git a/src/common.h b/src/common.h index 7c92f85f2c..ac7a4e6c21 100644 --- a/src/common.h +++ b/src/common.h @@ -260,6 +260,18 @@ pad(unsigned n) return pad(n, BytesPerWord); } +inline uintptr_t +padWord(uintptr_t n, uintptr_t alignment) +{ + return (n + (alignment - 1)) & ~(alignment - 1); +} + +inline uintptr_t +padWord(uintptr_t n) +{ + return padWord(n, BytesPerWord); +} + inline unsigned ceiling(unsigned n, unsigned d) { diff --git a/src/compile.cpp b/src/compile.cpp index a3a93fb8c0..e123bac0ed 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -7694,7 +7694,7 @@ boot(MyThread* t, BootImage* image) unsigned* callTable = stringTable + image->stringCount; uintptr_t* heapMap = reinterpret_cast - (pad(reinterpret_cast(callTable + (image->callCount * 2)))); + (padWord(reinterpret_cast(callTable + (image->callCount * 2)))); unsigned heapMapSizeInWords = ceiling (heapMapSize(image->heapSize), BytesPerWord); uintptr_t* heap = heapMap + heapMapSizeInWords;