bytecode_ptr: add make_zeroed_bytecode_ptr

Rather than always zeroing memory.
This commit is contained in:
Justin Viiret
2017-04-04 11:02:33 +10:00
committed by Matthew Barr
parent 5653fa55a1
commit 63fe84c3f1
19 changed files with 40 additions and 24 deletions

View File

@@ -162,7 +162,7 @@ bytecode_ptr<FDR> FDRCompiler::setupFDR() {
headerSize, tabSize, confirmTmp.size(), floodControlTmp.size(),
size);
auto fdr = make_bytecode_ptr<FDR>(size, 64);
auto fdr = make_zeroed_bytecode_ptr<FDR>(size, 64);
assert(fdr); // otherwise would have thrown std::bad_alloc
fdr->size = size;

View File

@@ -284,7 +284,7 @@ bytecode_ptr<FDRConfirm> getFDRConfirm(const vector<hwlmLiteral> &lits,
sizeof(LitInfo) * lits.size() + totalLitSize;
size = ROUNDUP_N(size, alignof(FDRConfirm));
auto fdrc = make_bytecode_ptr<FDRConfirm>(size);
auto fdrc = make_zeroed_bytecode_ptr<FDRConfirm>(size);
assert(fdrc); // otherwise would have thrown std::bad_alloc
fdrc->andmsk = andmsk;
@@ -373,7 +373,7 @@ setupFullConfs(const vector<hwlmLiteral> &lits,
u32 totalConfSwitchSize = nBuckets * sizeof(u32);
u32 totalSize = ROUNDUP_16(totalConfSwitchSize + totalConfirmSize);
auto buf = make_bytecode_ptr<u8>(totalSize, 16);
auto buf = make_zeroed_bytecode_ptr<u8>(totalSize, 16);
assert(buf); // otherwise would have thrown std::bad_alloc
u32 *confBase = (u32 *)buf.get();

View File

@@ -207,7 +207,7 @@ bytecode_ptr<u8> setupFDRFloodControl(const vector<hwlmLiteral> &lits,
size_t floodStructSize = sizeof(FDRFlood) * nDistinctFloods;
size_t totalSize = ROUNDUP_16(floodHeaderSize + floodStructSize);
auto buf = make_bytecode_ptr<u8>(totalSize, 16);
auto buf = make_zeroed_bytecode_ptr<u8>(totalSize, 16);
assert(buf); // otherwise would have thrown std::bad_alloc
u32 *floodHeader = (u32 *)buf.get();

View File

@@ -324,7 +324,7 @@ bytecode_ptr<FDR> TeddyCompiler::build() {
floodControlTmp.size(),
16 * maskWidth);
auto fdr = make_bytecode_ptr<FDR>(size, 64);
auto fdr = make_zeroed_bytecode_ptr<FDR>(size, 64);
assert(fdr); // otherwise would have thrown std::bad_alloc
Teddy *teddy = (Teddy *)fdr.get(); // ugly
u8 *teddy_base = (u8 *)teddy;