raw_som_dfa: initialize members in constructor

This commit is contained in:
Alex Coyte 2015-11-02 13:35:04 +11:00 committed by Matthew Barr
parent 4311775b43
commit 89660e30b6
3 changed files with 11 additions and 9 deletions

View File

@ -1109,7 +1109,7 @@ aligned_unique_ptr<NFA> goughCompile(raw_som_dfa &raw, u8 somPrecision,
u32 total_prog_size = byte_length(temp_blocks);
curr_offset += total_prog_size;
gi.stream_som_loc_count = slot_count;
gi.stream_som_loc_count = slot_count;
gi.stream_som_loc_width = somPrecision;
u32 gough_size = ROUNDUP_N(curr_offset, 16);

View File

@ -70,8 +70,11 @@ struct dstate_som {
};
struct raw_som_dfa : public raw_dfa {
raw_som_dfa(nfa_kind k, bool unordered_som_triggers_in)
: raw_dfa(k), unordered_som_triggers(unordered_som_triggers_in) {
raw_som_dfa(nfa_kind k, bool unordered_som_triggers_in, u32 trigger,
u32 stream_som_loc_width_in)
: raw_dfa(k), stream_som_loc_width(stream_som_loc_width_in),
unordered_som_triggers(unordered_som_triggers_in),
trigger_nfa_state(trigger) {
assert(!unordered_som_triggers || is_triggered(kind));
}

View File

@ -609,7 +609,6 @@ bool doHaig(const NGHolder &g,
}
haig_note_starts(g, &rdfa->new_som_nfa_states);
rdfa->trigger_nfa_state = NODE_START;
return true;
}
@ -639,7 +638,8 @@ unique_ptr<raw_som_dfa> attemptToBuildHaig(NGHolder &g, som_type som,
return nullptr;
}
auto rdfa = ue2::make_unique<raw_som_dfa>(g.kind, unordered_som);
auto rdfa = ue2::make_unique<raw_som_dfa>(g.kind, unordered_som, NODE_START,
somPrecision);
DEBUG_PRINTF("determinising nfa with %u vertices\n", numStates);
bool rv;
@ -659,7 +659,6 @@ unique_ptr<raw_som_dfa> attemptToBuildHaig(NGHolder &g, som_type som,
DEBUG_PRINTF("determinised, building impl dfa (a,f) = (%hu,%hu)\n",
rdfa->start_anchored, rdfa->start_floating);
rdfa->stream_som_loc_width = somPrecision;
assert(rdfa->kind == g.kind);
return rdfa;
@ -783,7 +782,9 @@ unique_ptr<raw_som_dfa> attemptToMergeHaig(const vector<const raw_som_dfa *> &df
typedef Automaton_Haig_Merge::StateSet StateSet;
vector<StateSet> nfa_state_map;
auto rdfa = ue2::make_unique<raw_som_dfa>(dfas[0]->kind, unordered_som);
auto rdfa = ue2::make_unique<raw_som_dfa>(dfas[0]->kind, unordered_som,
NODE_START,
dfas[0]->stream_som_loc_width);
int rv = determinise(n, rdfa->states, limit, &nfa_state_map);
if (rv) {
@ -831,11 +832,9 @@ unique_ptr<raw_som_dfa> attemptToMergeHaig(const vector<const raw_som_dfa *> &df
}
haig_merge_note_starts(dfas, per_dfa_adj, &rdfa->new_som_nfa_states);
rdfa->trigger_nfa_state = NODE_START;
DEBUG_PRINTF("merged, building impl dfa (a,f) = (%hu,%hu)\n",
rdfa->start_anchored, rdfa->start_floating);
rdfa->stream_som_loc_width = dfas[0]->stream_som_loc_width;
return rdfa;
}