diff options
Diffstat (limited to 'decoder/apply_fsa_models.cc')
-rwxr-xr-x | decoder/apply_fsa_models.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/decoder/apply_fsa_models.cc b/decoder/apply_fsa_models.cc index 83083fc5..4bf4e031 100755 --- a/decoder/apply_fsa_models.cc +++ b/decoder/apply_fsa_models.cc @@ -21,6 +21,8 @@ #include "show.h" #include "string_to.h" +#define SAFE_VALGRIND 1 + #define DFSA(x) x //fsa earley chart @@ -494,9 +496,23 @@ struct Item; typedef Item *ItemP; /* we use a single type of item so it can live in a single best-first queue. we hold them by pointer so they can have mutable state, e.g. priority/location, but also lists of predictions and kbest completions (i.e. completions[L,r] = L -> * (r,s), by 1best for each possible s. we may discover more s later. we could use different subtypes since we hold by pointer, but for now everything will be packed as variants of Item */ +#undef INIT_LOCATION +#if D_ARY_TRACK_OUT_OF_HEAP +# define INIT_LOCATION , location(D_ARY_HEAP_NULL_INDEX) +#elsif !defined(NDEBUG) || SAFE_VALGRIND + // avoid spurious valgrind warning +# define INIT_LOCATION , location() +#else +# define INIT_LOCATION +#endif + struct Item : ItemPrio,ItemKey { - explicit Item(NodeP dot,int next=0) : ItemKey(dot),next(next),from(0),location(D_ARY_HEAP_NULL_INDEX) { } - explicit Item(NodeP dot,FFState const& state,int next=0) : ItemKey(dot,state),next(next),from(0),location(D_ARY_HEAP_NULL_INDEX) { } + explicit Item(NodeP dot,int next=0) : ItemKey(dot),next(next),from(0) + INIT_LOCATION + { } + explicit Item(NodeP dot,FFState const& state,int next=0) : ItemKey(dot,state),next(next),from(0) + INIT_LOCATION + { } typedef std::queue<ItemP> Predicted; Predicted predicted; // this is empty, unless this is a predicted L -> .asdf item, or a to-complete L -> asdf . int next; // index of dot->adj to complete (if dest==0), or predict (if NT), or scan (if word). note: we could store pointer inside adj since it and trie are @ fixed addrs. less pointer arith, more space. |