Menu

Commit [r8959]  Maximize  Restore  History

Fixed yet another bug in incremental table view maintenance,

though this one was obscure. The function
get_list_of_answers_from_answer_list was core dumping. This
function takes the answer list which was produced by
traverse_variant_trie, and copies their corresponding answers to
a list on the heap, constructing the answers as it goes. The
problem arose in cases where no answers needed to be copied, in
which case uninitialized garbage was returned to find_the
visitors, rather than a pointer to a list. The fix was simple --
properly initialize the variable whose value is returned, and
check the return when the function was called.

I didn't think that such a case could happen, so I looked into
why it did, and it turns out it depended on a feature of XSB's
trie hash nodes. A call to a hash node may have the
corresponding position free or bound. If it is free, then when
the hash_handle code executes, it finds the next value to return
by traversing the hash table. It can be the case where there is
no next value. In certain cases, this leads directly to
list_of_answers_for_answer_list returning no answers and to the
problem we had.

Along the way, I also created a debugging macro,
print_hash_handle that helped me verify why things were
happening.
y

tswift 2017-01-07

changed /trunk/XSB/emu/call_graph_xsb.c
changed /trunk/XSB/emu/tr_code_xsb_i.h
changed /trunk/XSB/emu/tr_utils.c
/trunk/XSB/emu/call_graph_xsb.c Diff Switch to side-by-side view
Loading...
/trunk/XSB/emu/tr_code_xsb_i.h Diff Switch to side-by-side view
Loading...
/trunk/XSB/emu/tr_utils.c Diff Switch to side-by-side view
Loading...
MongoDB Logo MongoDB