diff --git a/byterun/include/stack.h b/byterun/include/stack.h index 68c4943c8..8cdf3fd3f 100644 --- a/byterun/include/stack.h +++ b/byterun/include/stack.h @@ -235,6 +235,10 @@ static inline void s_exit_f() { #endif s_popn(f_args_sz(&frame)); + if (frame.closure) { + s_pop(); + } + // save returned value, not in main if (frame.prev_fp != 0) { s_push(frame.ret); diff --git a/byterun/regression_check.sh b/byterun/regression_check.sh index 31ac79a44..d08df3e5f 100755 --- a/byterun/regression_check.sh +++ b/byterun/regression_check.sh @@ -15,9 +15,14 @@ for test in ../regression/*.lama; do $compiler -b $test > /dev/null test_file="${test%.*}" echo $test_file - cat $test_file.input | ./byterun.exe -p test*.bc > /dev/null - cat $test_file.input | ./byterun.exe -vi test*.bc > /dev/null + # cat $test_file.input | ./byterun.exe -p test*.bc > test.bc.code + # cat $test_file.input | ./byterun.exe -p test*.bc + cat $test_file.input | ./byterun.exe -vi test*.bc > test.log + sed '1d;s/^..//' $test_file.t > test_orig.log + diff test.log test_orig.log + rm test*.bc + rm test.log test_orig.log echo "done" done diff --git a/byterun/src/interpreter.c b/byterun/src/interpreter.c index d10236309..28770bbd6 100644 --- a/byterun/src/interpreter.c +++ b/byterun/src/interpreter.c @@ -486,10 +486,10 @@ void run_main(Bytefile* bf, int argc, char **argv) { s_push_i(Bsexp_tag_patt(s_pop())); break; case CMD_PATT_REF_TAG: // #ref - s_push_i(Bunboxed_patt(s_pop())); + s_push_i(Bboxed_patt(s_pop())); break; case CMD_PATT_VAL_TAG: // #val - s_push_i(Bboxed_patt(s_pop())); + s_push_i(Bunboxed_patt(s_pop())); break; case CMD_PATT_FUN_TAG: // #fun s_push_i(Bclosure_tag_patt(s_pop())); diff --git a/byterun/src/module_manager.cpp b/byterun/src/module_manager.cpp index c6c56c4f2..571c1d0e7 100644 --- a/byterun/src/module_manager.cpp +++ b/byterun/src/module_manager.cpp @@ -473,6 +473,7 @@ void run_stdlib_func(BUILTIN id, size_t args_count) { s_push(ret); break; case BUILTIN_Lread: + printf(" "); ret = (void *)Lread(); s_push(ret); break;