From: Mark Thom Date: Sat, 23 May 2020 05:57:32 +0000 (-0600) Subject: address arity discrepancies in builtins.n and call/N (#525) X-Git-Tag: v0.8.123 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=befeddbcbcffb9026e0ed3e41362fd448b976515;p=scryer-prolog.git address arity discrepancies in builtins.n and call/N (#525) --- diff --git a/src/prolog/lib/builtins.pl b/src/prolog/lib/builtins.pl index 9e606bbf..a4bd6db8 100644 --- a/src/prolog/lib/builtins.pl +++ b/src/prolog/lib/builtins.pl @@ -69,7 +69,7 @@ user:term_expansion((:- op(Pred, Spec, [Op | OtherOps])), OpResults) :- % the maximum arity flag. needs to be replaced with % current_prolog_flag(max_arity, MAX_ARITY). -max_arity(255). +max_arity(1023). % unify. X = X. diff --git a/src/prolog/machine/machine_state_impl.rs b/src/prolog/machine/machine_state_impl.rs index a26c4cde..79cf0f38 100644 --- a/src/prolog/machine/machine_state_impl.rs +++ b/src/prolog/machine/machine_state_impl.rs @@ -1597,7 +1597,8 @@ impl MachineState { ); } - pub(super) fn handle_internal_call_n(&mut self, arity: usize) { + pub(super) + fn handle_internal_call_n(&mut self, arity: usize) { let arity = arity + 1; let pred = self.registers[1]; @@ -1613,7 +1614,8 @@ impl MachineState { self.fail = true; } - pub(super) fn setup_call_n(&mut self, arity: usize) -> Option { + pub(super) + fn setup_call_n(&mut self, arity: usize) -> Option { let addr = self.store(self.deref(self.registers[arity])); let (name, narity) = match addr { @@ -1623,7 +1625,7 @@ impl MachineState { if let HeapCellValue::NamedStr(narity, name, _) = result { let stub = MachineError::functor_stub(clause_name!("call"), arity + 1); - if narity + arity > 63 { + if narity + arity > MAX_ARITY { let representation_error = self.error_form( MachineError::representation_error(RepFlag::MaxArity), stub, @@ -2853,7 +2855,8 @@ impl MachineState { } } - pub(super) fn copy_term(&mut self, attr_var_policy: AttrVarPolicy) { + pub(super) + fn copy_term(&mut self, attr_var_policy: AttrVarPolicy) { let old_h = self.heap.h(); let a1 = self[temp_v!(1)]; @@ -2865,7 +2868,8 @@ impl MachineState { } // returns true on failure. - pub(super) fn structural_eq_test(&self) -> bool { + pub(super) + fn structural_eq_test(&self) -> bool { let a1 = self[temp_v!(1)]; let a2 = self[temp_v!(2)]; @@ -3158,7 +3162,8 @@ impl MachineState { self.last_call = false; } - pub(super) fn execute_ctrl_instr( + pub(super) + fn execute_ctrl_instr( &mut self, indices: &mut IndexStore, code_repo: &CodeRepo,