Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit 3863c5f

Browse files
authored
Merge pull request #217 from urbit/eamsden/dont-stack-trace-copying-frame
interpreter: check for copying flag in exit
2 parents d184cf5 + 7136846 commit 3863c5f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

rust/ares/src/interpreter.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,13 +1185,19 @@ fn exit(
11851185
unsafe {
11861186
context.restore(snapshot);
11871187

1188+
if context.stack.copying() {
1189+
assert!(context.stack.get_frame_pointer() != virtual_frame);
1190+
context.stack.frame_pop();
1191+
}
1192+
11881193
let stack = &mut context.stack;
11891194
let mut preserve = match error {
11901195
Error::ScryBlocked(path) => path,
11911196
Error::Deterministic(_, t) | Error::NonDeterministic(_, t) | Error::ScryCrashed(t) => {
11921197
// Return $tang of traces
11931198
let h = *(stack.local_noun_pointer(0));
11941199
// XX: Small chance of clobbering something important after OOM?
1200+
// XX: what if we OOM while making a stack trace
11951201
T(stack, &[h, t])
11961202
}
11971203
};

rust/ares/src/mem.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ impl NockStack {
137137
};
138138
}
139139

140+
pub fn copying(&self) -> bool {
141+
self.pc
142+
}
143+
140144
/** Current frame pointer of this NockStack */
141145
pub fn get_frame_pointer(&self) -> *const u64 {
142146
self.frame_pointer

0 commit comments

Comments
 (0)