rose_build_long_lit: use bytecode_ptr

This commit is contained in:
Justin Viiret 2017-04-04 11:50:10 +10:00 committed by Matthew Barr
parent e8162960fc
commit d269b83dda

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016, Intel Corporation * Copyright (c) 2016-2017, Intel Corporation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@ -31,7 +31,7 @@
#include "rose_build_engine_blob.h" #include "rose_build_engine_blob.h"
#include "rose_build_impl.h" #include "rose_build_impl.h"
#include "stream_long_lit_hash.h" #include "stream_long_lit_hash.h"
#include "util/alloc.h" #include "util/bytecode_ptr.h"
#include "util/bitutils.h" #include "util/bitutils.h"
#include "util/verify_types.h" #include "util/verify_types.h"
#include "util/compile_context.h" #include "util/compile_context.h"
@ -401,7 +401,7 @@ u32 buildLongLiteralTable(const RoseBuildImpl &build, RoseEngineBlob &blob,
u8 streamBitsNocase = lg2(roundUpToPowerOfTwo(tab_nocase.size() + 2)); u8 streamBitsNocase = lg2(roundUpToPowerOfTwo(tab_nocase.size() + 2));
u32 tot_state_bytes = ROUNDUP_N(streamBitsCase + streamBitsNocase, 8) / 8; u32 tot_state_bytes = ROUNDUP_N(streamBitsCase + streamBitsNocase, 8) / 8;
auto table = aligned_zmalloc_unique<char>(tabSize); auto table = make_zeroed_bytecode_ptr<char>(tabSize, 16);
assert(table); // otherwise would have thrown std::bad_alloc assert(table); // otherwise would have thrown std::bad_alloc
// Fill in the RoseLongLitTable header structure. // Fill in the RoseLongLitTable header structure.
@ -435,7 +435,7 @@ u32 buildLongLiteralTable(const RoseBuildImpl &build, RoseEngineBlob &blob,
*historyRequired = max(*historyRequired, max_len); *historyRequired = max(*historyRequired, max_len);
*longLitStreamStateRequired = tot_state_bytes; *longLitStreamStateRequired = tot_state_bytes;
return blob.add(table.get(), tabSize, 16); return blob.add(table);
} }
} // namespace ue2 } // namespace ue2