rose: use bytecode_ptr for interpreter programs

This commit is contained in:
Justin Viiret
2017-04-04 11:19:07 +10:00
committed by Matthew Barr
parent 0a3bd455ad
commit b6047ea5d4
3 changed files with 14 additions and 13 deletions

View File

@@ -639,12 +639,14 @@ OffsetMap makeOffsetMap(const RoseProgram &program, u32 *total_len) {
return offset_map;
}
aligned_unique_ptr<char>
writeProgram(RoseEngineBlob &blob, const RoseProgram &program, u32 *total_len) {
const auto offset_map = makeOffsetMap(program, total_len);
DEBUG_PRINTF("%zu instructions, len %u\n", program.size(), *total_len);
bytecode_ptr<char> writeProgram(RoseEngineBlob &blob,
const RoseProgram &program) {
u32 total_len = 0;
const auto offset_map = makeOffsetMap(program, &total_len);
DEBUG_PRINTF("%zu instructions, len %u\n", program.size(), total_len);
auto bytecode = aligned_zmalloc_unique<char>(*total_len);
auto bytecode = make_zeroed_bytecode_ptr<char>(total_len,
ROSE_INSTR_MIN_ALIGN);
char *ptr = bytecode.get();
for (const auto &ri : program) {