rose: consistent naming in updateNfaState

This commit is contained in:
Justin Viiret 2017-03-02 09:18:28 +11:00 committed by Matthew Barr
parent 6013fb1546
commit b2aae060d8

View File

@ -2106,32 +2106,31 @@ bool buildNfas(RoseBuildImpl &tbi, build_context &bc, QueueIndexFactory &qif,
static static
void allocateStateSpace(const NFA *nfa, NfaInfo *nfa_info, bool is_transient, void allocateStateSpace(const NFA *nfa, NfaInfo *nfa_info, bool is_transient,
RoseStateOffsets *so, u32 *currFullStateSize, RoseStateOffsets *so, u32 *scratchStateSize,
u32 *maskStateSize, u32 *tStateSize) { u32 *streamStateSize, u32 *transientStateSize) {
const u32 stateSize = nfa->streamStateSize;
const u32 scratchStateSize = nfa->scratchStateSize;
u32 state_offset; u32 state_offset;
if (is_transient) { if (is_transient) {
state_offset = *tStateSize; // Transient engines do not use stream state, but must have room in
*tStateSize += stateSize; // transient state (stored in scratch).
state_offset = *transientStateSize;
*transientStateSize += nfa->streamStateSize;
} else { } else {
// Pack NFA state on to the end of the Rose state. // Pack NFA stream state on to the end of the Rose stream state.
state_offset = so->end; state_offset = so->end;
so->end += stateSize; so->end += nfa->streamStateSize;
*maskStateSize += stateSize; *streamStateSize += nfa->streamStateSize;
} }
nfa_info->stateOffset = state_offset; nfa_info->stateOffset = state_offset;
// Uncompressed state must be aligned. // Uncompressed state in scratch must be aligned.
u32 alignReq = state_alignment(*nfa); u32 alignReq = state_alignment(*nfa);
assert(alignReq); assert(alignReq);
while (*currFullStateSize % alignReq) { while (*scratchStateSize % alignReq) {
(*currFullStateSize)++; (*scratchStateSize)++;
} }
nfa_info->fullStateOffset = *currFullStateSize; nfa_info->fullStateOffset = *scratchStateSize;
*currFullStateSize += scratchStateSize; *scratchStateSize += nfa->scratchStateSize;
} }
static static
@ -2150,8 +2149,8 @@ findTransientQueues(const map<RoseVertex, left_build_info> &leftfix_info) {
static static
void updateNfaState(const build_context &bc, RoseEngine &proto, void updateNfaState(const build_context &bc, RoseEngine &proto,
RoseStateOffsets *so, u32 *fullStateSize, u32 *nfaStateSize, RoseStateOffsets *so, u32 *scratchStateSize,
u32 *tStateSize) { u32 *streamStateSize, u32 *transientStateSize) {
if (!proto.nfaInfoOffset) { if (!proto.nfaInfoOffset) {
assert(bc.engineOffsets.empty()); assert(bc.engineOffsets.empty());
return; return;
@ -2162,9 +2161,9 @@ void updateNfaState(const build_context &bc, RoseEngine &proto,
proto.nfaInfoOffset - proto.nfaInfoOffset -
bc.engine_blob.base_offset); bc.engine_blob.base_offset);
*nfaStateSize = 0; *streamStateSize = 0;
*tStateSize = 0; *transientStateSize = 0;
*fullStateSize = 0; *scratchStateSize = 0;
auto transient_queues = findTransientQueues(bc.leftfix_info); auto transient_queues = findTransientQueues(bc.leftfix_info);
@ -2173,8 +2172,8 @@ void updateNfaState(const build_context &bc, RoseEngine &proto,
u32 qi = nfa->queueIndex; u32 qi = nfa->queueIndex;
bool is_transient = contains(transient_queues, qi); bool is_transient = contains(transient_queues, qi);
NfaInfo *nfa_info = &nfa_infos[qi]; NfaInfo *nfa_info = &nfa_infos[qi];
allocateStateSpace(nfa, nfa_info, is_transient, so, fullStateSize, allocateStateSpace(nfa, nfa_info, is_transient, so, scratchStateSize,
nfaStateSize, tStateSize); streamStateSize, transientStateSize);
} }
} }