diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-31 02:16:48 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-31 02:16:48 +0000 |
commit | 0f5a4475fa15a135a0e6bab2b83d8828fb15f77f (patch) | |
tree | 62f3d25bc4d8af7d8dfa71a64ae864d275cf8b19 /decoder | |
parent | 6165a7852d01439d20ed5ee1814798863a3d5bf7 (diff) |
l2r bugfixes
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@636 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder')
-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. |