jets: fix mismatch between Arvo and Ares for +mook

This commit is contained in:
Alex Shelkovnykov 2023-11-15 22:21:13 +01:00
parent 9a904fcbf6
commit 3b643ab873
2 changed files with 11 additions and 12 deletions

View File

@ -1390,8 +1390,10 @@ mod hint {
}
tas!(b"hela") => {
// XX: This only prints the trace down to the bottom of THIS
// interpret call. We'll need to recursively work down
// frames to get the stack trace all the way to the root.
// interpret call, making this neither a %nara nor a %hela
// hint, as Vere understands them. We'll need to
// recursively work down frames to get the stack trace all
// the way to the root.
let mean = unsafe { *(context.stack.local_noun_pointer(0)) };
let tone = Cell::new(&mut context.stack, D(2), mean);
@ -1401,6 +1403,9 @@ mod hint {
let newt = &mut context.newt;
if unsafe { !toon.head().raw_equals(D(2)) } {
// +mook will only ever return a $toon with non-%2 head if that's what it was given as
// input. Since we control the input for this call exactly, there must exist a programming
// error in Ares if this occurs.
panic!("serf: %hela: mook returned invalid tone");
}
@ -1422,9 +1427,9 @@ mod hint {
}
}
Err(_) => {
let stack = &mut context.stack;
let tape = tape(stack, "serf: %hela: mook error");
slog_leaf(stack, &mut context.newt, tape);
// +mook should only ever bail if the input is not [%2 (list)]. Since we control the input
// for this call exactly, there must exist a programming error in Ares if this occurs.
panic!("serf: unrecoverable stack trace error");
}
}
}

View File

@ -194,13 +194,7 @@ pub mod util {
let tag = tone.head().as_direct()?;
let original_list = tone.tail();
match tag.data() {
x if x < 2 => return Ok(tone),
x if x > 2 => return Err(JetErr::Fail(Error::Deterministic(D(0)))),
_ => {}
}
if unsafe { original_list.raw_equals(D(0)) } {
if (tag.data() != 2) | unsafe { original_list.raw_equals(D(0)) } {
return Ok(tone);
} else if original_list.atom().is_some() {
return Err(JetErr::Fail(Error::Deterministic(D(0))));