Commit b9a860c
committed
FIXED: #1386 candidate deep list index preempting deterministic primary
For a small static predicate whose primary argument discriminates but
whose non-primary compound argument shares a top-level functor across
clauses, set_candidate_indexes() emits a list hash index on the compound
argument. At call time existing_hash() matched that index (top-level
functor bound), the deep drill entered a sub-list whose inner arguments
were variables, and the recursion fell back to next_clause_unindexed(),
leaving a spurious choice point on the non-matching clause.
Hoist the "small predicate + bound primary key -> try primary first"
block in first_clause_guarded() ahead of the hash lookup, and move the
number_of_clauses == 0 shortcut with it (needed because clist->first_clause
can still point to a stale erased ClauseRef when all clauses were retracted).
When the primary key does not discriminate or is unbound, we fall through
to the hash lookup unchanged, so p(X, (-1.0e+16, _)) still dispatches
deterministically via the deep list index.1 parent 2d6775b commit b9a860c
2 files changed
Lines changed: 44 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| 650 | + | |
| 651 | + | |
650 | 652 | | |
651 | 653 | | |
652 | 654 | | |
| |||
655 | 657 | | |
656 | 658 | | |
657 | 659 | | |
658 | | - | |
659 | 660 | | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
660 | 694 | | |
661 | 695 | | |
662 | 696 | | |
| |||
700 | 734 | | |
701 | 735 | | |
702 | 736 | | |
703 | | - | |
704 | | - | |
| 737 | + | |
705 | 738 | | |
706 | 739 | | |
707 | 740 | | |
| |||
711 | 744 | | |
712 | 745 | | |
713 | 746 | | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | 747 | | |
718 | 748 | | |
719 | 749 | | |
720 | 750 | | |
721 | 751 | | |
722 | 752 | | |
723 | 753 | | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | 754 | | |
746 | 755 | | |
747 | 756 | | |
| |||
757 | 766 | | |
758 | 767 | | |
759 | 768 | | |
760 | | - | |
| 769 | + | |
761 | 770 | | |
762 | 771 | | |
763 | 772 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
215 | 218 | | |
216 | 219 | | |
217 | 220 | | |
| |||
226 | 229 | | |
227 | 230 | | |
228 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
229 | 236 | | |
230 | 237 | | |
0 commit comments