Revert "improve performance of lower_bound_of_target_clause (#1598)"
This reverts commit 8938331915.
This commit is contained in:
@@ -1238,7 +1238,6 @@ call_retract_helper(Head, Body, P, Module) :-
|
|||||||
ClauseQualifier = builtins
|
ClauseQualifier = builtins
|
||||||
; ClauseQualifier = Module
|
; ClauseQualifier = Module
|
||||||
),
|
),
|
||||||
'$debug_hook',
|
|
||||||
ClauseQualifier:'$clause'(Head, Body),
|
ClauseQualifier:'$clause'(Head, Body),
|
||||||
'$get_clause_p'(Head, P, Module).
|
'$get_clause_p'(Head, P, Module).
|
||||||
|
|
||||||
|
|||||||
@@ -42,38 +42,42 @@ pub(super) fn bootstrapping_compile(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lower_bound_of_target_clause(skeleton: &mut PredicateSkeleton, target_pos: usize) -> usize {
|
fn lower_bound_of_target_clause(skeleton: &PredicateSkeleton, target_pos: usize) -> usize {
|
||||||
if target_pos == 0 {
|
if target_pos == 0 {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let index = target_pos - 1;
|
let arg_num = skeleton.clauses[target_pos - 1].opt_arg_index_key.arg_num();
|
||||||
let arg_num = skeleton.clauses[index].opt_arg_index_key.arg_num();
|
|
||||||
|
|
||||||
if arg_num == 0 {
|
if arg_num == 0 {
|
||||||
return index;
|
return target_pos - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
skeleton
|
let mut index_loc_opt = None;
|
||||||
.clauses[target_pos]
|
|
||||||
.opt_arg_index_key
|
|
||||||
.switch_on_term_loc()
|
|
||||||
.map(|index_loc| {
|
|
||||||
let search_result = skeleton.clauses.make_contiguous()
|
|
||||||
[0 .. skeleton.core.clause_assert_margin]
|
|
||||||
.partition_point(|clause_index_info| {
|
|
||||||
clause_index_info.clause_start > index_loc
|
|
||||||
});
|
|
||||||
|
|
||||||
if search_result < skeleton.core.clause_assert_margin {
|
for index in (0..target_pos).rev() {
|
||||||
search_result
|
let current_arg_num = skeleton.clauses[index].opt_arg_index_key.arg_num();
|
||||||
} else {
|
|
||||||
skeleton.clauses.make_contiguous()[skeleton.core.clause_assert_margin ..]
|
if current_arg_num == 0 || current_arg_num != arg_num {
|
||||||
.partition_point(|clause_index_info| {
|
return index + 1;
|
||||||
clause_index_info.clause_start < index_loc
|
}
|
||||||
}) + skeleton.core.clause_assert_margin
|
|
||||||
|
if let Some(index_loc) = index_loc_opt {
|
||||||
|
let current_index_loc = skeleton.clauses[index]
|
||||||
|
.opt_arg_index_key
|
||||||
|
.switch_on_term_loc();
|
||||||
|
|
||||||
|
if Some(index_loc) != current_index_loc {
|
||||||
|
return index + 1;
|
||||||
}
|
}
|
||||||
}).unwrap_or(index)
|
} else {
|
||||||
|
index_loc_opt = skeleton.clauses[index]
|
||||||
|
.opt_arg_index_key
|
||||||
|
.switch_on_term_loc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn derelictize_try_me_else(
|
fn derelictize_try_me_else(
|
||||||
|
|||||||
Reference in New Issue
Block a user