SetNSTOAsUnify,
SetSTOWithErrorAsUnify,
HomeDirectory,
+ DebugHook,
}
impl SystemClauseType {
&SystemClauseType::SetNSTOAsUnify => clause_name!("$set_nsto_as_unify"),
&SystemClauseType::HomeDirectory => clause_name!("$home_directory"),
&SystemClauseType::SetSTOWithErrorAsUnify => clause_name!("$set_sto_with_error_as_unify"),
+ &SystemClauseType::DebugHook => clause_name!("$debug_hook"),
}
}
("$set_nsto_as_unify", 0) => Some(SystemClauseType::SetNSTOAsUnify),
("$set_sto_with_error_as_unify", 0) => Some(SystemClauseType::SetSTOWithErrorAsUnify),
("$home_directory", 1) => Some(SystemClauseType::HomeDirectory),
+ ("$debug_hook", 0) => Some(SystemClauseType::DebugHook),
_ => None,
}
}
self.increment_s_ptr(1);
}
MachineMode::Write => {
- let heap_val = self.store(self[reg]);
- self.heap.push(HeapCellValue::Addr(heap_val));
+ let h = self.heap.h();
+ self.heap.push(HeapCellValue::Addr(Addr::HeapCell(h)));
+
+ let addr = self.store(self[reg]);
+ (self.bind_fn)(self, Ref::HeapCell(h), addr);
+
+ // the former code of this match arm was:
+
+ // let addr = self.store(self[reg]);
+ // self.heap.push(HeapCellValue::Addr(addr));
+
+ // the old code didn't perform the occurs
+ // check when enabled and so it was changed to
+ // the above, which is only slightly less
+ // efficient when the occurs_check is disabled.
}
};
}
}
}
}
- /*
- &SystemClauseType::ResetGlobalVarAtKey => {
- let key = self[temp_v!(1)];
-
- match self.store(self.deref(key)) {
- Addr::Con(h) if self.heap.atom_at(h) => {
- if let HeapCellValue::Atom(ref key, _) = &self.heap[h] {
- indices.global_variables.swap_remove(key);
- } else {
- unreachable!()
- }
- }
- _ => {
- unreachable!()
- }
- }
- }
- &SystemClauseType::ResetGlobalVarAtOffset => {
- let key = self[temp_v!(1)];
-
- let key = match self.store(self.deref(key)) {
- Addr::Con(h) if self.heap.atom_at(h) => {
- if let HeapCellValue::Atom(ref key, _) = &self.heap[h] {
- key.clone()
- } else {
- unreachable!()
- }
- }
- _ => {
- unreachable!()
- }
- };
-
- let value = self[temp_v!(2)];
- let mut ball = Ball::new();
-
- ball.boundary = self.heap.h();
-
- copy_term(
- CopyBallTerm::new(&mut self.stack, &mut self.heap, &mut ball.stub),
- value,
- AttrVarPolicy::DeepCopy,
- );
-
- let offset = self[temp_v!(3)];
-
- match self.store(self.deref(offset)) {
- Addr::Usize(offset) => {
- indices.global_variables.insert(key, (ball, Some(offset)));
- }
- _ => {
- indices.global_variables.insert(key, (ball, None));
- }
- }
- }
- */
&SystemClauseType::ResetAttrVarState => {
self.attr_var_init.reset();
}
&SystemClauseType::REPL(repl_code_ptr) => {
return self.repl_redirect(repl_code_ptr);
}
- /*
- &SystemClauseType::ModuleRetractClause => {
- let p = self.cp;
- let trans_type = DynamicTransactionType::ModuleRetract;
-
- self.p = CodePtr::DynamicTransaction(trans_type, p);
- return Ok(());
- }
- &SystemClauseType::RetractClause => {
- let p = self.cp;
- let trans_type = DynamicTransactionType::Retract;
-
- self.p = CodePtr::DynamicTransaction(trans_type, p);
- return Ok(());
- }
- */
&SystemClauseType::ReturnFromVerifyAttr => {
let e = self.e;
let frame_len = self.stack.index_and_frame(e).prelude.univ_prelude.num_cells;
self.fail = true;
}
+ &SystemClauseType::DebugHook => {
+ self.fail = false;
+ }
};
return_from_clause!(self.last_call, self)
submit_query_and_print_results_(Term, VarList) :-
'$get_b_value'(B),
- call(Term),
+ '$call'(Term),
write_eqs_and_read_input(B, VarList),
!.
submit_query_and_print_results_(_, _) :-
submit_query_and_print_results(Term0, VarList) :-
- expand_goal(call(Term0), user, Term),
+ expand_goal(call(Term0), user, call(Term)),
!,
setup_call_cleanup(bb_put('$first_answer', true),
submit_query_and_print_results_(Term, VarList),