Skip to content

Commit cd184bf

Browse files
fix bug with not marking instruction stack
1 parent 5f8c3a4 commit cd184bf

File tree

6 files changed

+8876
-58
lines changed

6 files changed

+8876
-58
lines changed

pickle.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void pickle::mark_globals() {
5959
this->markobject(this->queue_tail); // in case queue gets detached
6060
this->markobject(this->globals);
6161
this->markobject(this->stack);
62+
this->markobject(this->instruction_stack);
6263
}
6364

6465
void pickle::step() {

pickle_test.cpp

+9-12
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include <cstdio>
55
#include <csignal>
66

7-
char* me = NULL; // The name of this executable -- captured at the top of main()
8-
97
void on_segfault(int signal, siginfo_t* info, void* arg) {
108
fprintf(stderr, "Segmentation fault at %p\n", info->si_addr);
119
DBG("Segmentation fault at %p", info->si_addr);
@@ -20,20 +18,19 @@ void start_catch_segfault() {
2018
sigaction(SIGSEGV, &x, NULL);
2119
}
2220

23-
int main(int argc, char** argv) {
24-
if (argc > 0) me = argv[0];
21+
int main() {
2522
start_catch_segfault();
2623
pickle::pickle vm;
27-
vm.push_instruction(vm.make_symbol("foo"));
28-
vm.push_instruction(vm.make_symbol("bar"), vm.make_symbol("error"));
29-
vm.push_instruction(vm.make_symbol("baz"));
30-
vm.push_instruction(vm.make_symbol("baz"), vm.make_symbol("test long symbol with spaces"));
31-
vm.push_instruction(vm.make_symbol("baz"));
32-
vm.push_instruction(vm.make_symbol("baz"));
33-
vm.push_instruction(vm.make_symbol("baz"));
24+
for (size_t i = 0; i < 100; i++) {
25+
vm.push_instruction(vm.make_symbol("foo"));
26+
vm.push_instruction(vm.make_symbol("bar"), vm.make_symbol("error"));
27+
vm.push_instruction(vm.make_symbol("baz"));
28+
vm.push_instruction(vm.make_symbol("baz"), vm.make_symbol("test long symbol with spaces"));
29+
vm.push_instruction(vm.make_symbol("baz"));
30+
vm.push_instruction(vm.make_symbol("baz"));
31+
}
3432
pickle::dump(vm.instruction_stack);
3533
putchar('\n');
36-
3734
vm.gc();
3835
printf("all done -- cleaning up\n");
3936
return 0;

0 commit comments

Comments
 (0)