corda/src/bootimage-template.cpp

30 lines
867 B
C++
Raw Normal View History

const unsigned NAME(BootMask) = (~static_cast<unsigned>(0))
2014-07-11 15:50:18 +00:00
/ NAME(BytesPerWord);
2013-03-04 18:09:59 +00:00
const unsigned NAME(BootShift) = 32 - avian::util::log(NAME(BytesPerWord));
const unsigned NAME(BootFlatConstant) = 1 << NAME(BootShift);
const unsigned NAME(BootHeapOffset) = 1 << (NAME(BootShift) + 1);
2014-07-11 15:50:18 +00:00
inline unsigned LABEL(codeMapSize)(unsigned codeSize)
{
2014-07-11 15:50:18 +00:00
return avian::util::ceilingDivide(codeSize, TargetBitsPerWord)
* TargetBytesPerWord;
}
2014-07-11 15:50:18 +00:00
inline unsigned LABEL(heapMapSize)(unsigned heapSize)
{
2014-07-11 15:50:18 +00:00
return avian::util::ceilingDivide(heapSize,
TargetBitsPerWord * TargetBytesPerWord)
* TargetBytesPerWord;
}
2014-07-11 15:50:18 +00:00
inline object LABEL(bootObject)(LABEL(uintptr_t) * heap, unsigned offset)
{
if (offset) {
return reinterpret_cast<object>(heap + offset - 1);
} else {
return 0;
}
}