address arity discrepancies in builtins.n and call/N (#525)
This commit is contained in:
@@ -69,7 +69,7 @@ user:term_expansion((:- op(Pred, Spec, [Op | OtherOps])), OpResults) :-
|
|||||||
|
|
||||||
% the maximum arity flag. needs to be replaced with
|
% the maximum arity flag. needs to be replaced with
|
||||||
% current_prolog_flag(max_arity, MAX_ARITY).
|
% current_prolog_flag(max_arity, MAX_ARITY).
|
||||||
max_arity(255).
|
max_arity(1023).
|
||||||
|
|
||||||
% unify.
|
% unify.
|
||||||
X = X.
|
X = X.
|
||||||
|
|||||||
@@ -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 arity = arity + 1;
|
||||||
let pred = self.registers[1];
|
let pred = self.registers[1];
|
||||||
|
|
||||||
@@ -1613,7 +1614,8 @@ impl MachineState {
|
|||||||
self.fail = true;
|
self.fail = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn setup_call_n(&mut self, arity: usize) -> Option<PredicateKey> {
|
pub(super)
|
||||||
|
fn setup_call_n(&mut self, arity: usize) -> Option<PredicateKey> {
|
||||||
let addr = self.store(self.deref(self.registers[arity]));
|
let addr = self.store(self.deref(self.registers[arity]));
|
||||||
|
|
||||||
let (name, narity) = match addr {
|
let (name, narity) = match addr {
|
||||||
@@ -1623,7 +1625,7 @@ impl MachineState {
|
|||||||
if let HeapCellValue::NamedStr(narity, name, _) = result {
|
if let HeapCellValue::NamedStr(narity, name, _) = result {
|
||||||
let stub = MachineError::functor_stub(clause_name!("call"), arity + 1);
|
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(
|
let representation_error = self.error_form(
|
||||||
MachineError::representation_error(RepFlag::MaxArity),
|
MachineError::representation_error(RepFlag::MaxArity),
|
||||||
stub,
|
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 old_h = self.heap.h();
|
||||||
|
|
||||||
let a1 = self[temp_v!(1)];
|
let a1 = self[temp_v!(1)];
|
||||||
@@ -2865,7 +2868,8 @@ impl MachineState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns true on failure.
|
// 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 a1 = self[temp_v!(1)];
|
||||||
let a2 = self[temp_v!(2)];
|
let a2 = self[temp_v!(2)];
|
||||||
|
|
||||||
@@ -3158,7 +3162,8 @@ impl MachineState {
|
|||||||
self.last_call = false;
|
self.last_call = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn execute_ctrl_instr(
|
pub(super)
|
||||||
|
fn execute_ctrl_instr(
|
||||||
&mut self,
|
&mut self,
|
||||||
indices: &mut IndexStore,
|
indices: &mut IndexStore,
|
||||||
code_repo: &CodeRepo,
|
code_repo: &CodeRepo,
|
||||||
|
|||||||
Reference in New Issue
Block a user