summaryrefslogtreecommitdiff
path: root/decoder
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-31 02:16:48 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-31 02:16:48 +0000
commitf1558e4afd2afe5b23c4ecf9fb4de0415068cc02 (patch)
tree02d6ff49e49127cce30a771f48eea0c6ff18aa7a /decoder
parentd8fa7f3e9b8127911996c36f477bcae3831f7708 (diff)
l2r bugfixes
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@636 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder')
-rwxr-xr-xdecoder/apply_fsa_models.cc20
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.