Skip to content

Commit

Permalink
Fix try-catch: save c1, c3 to catch continuation (#1332)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmelyanenkoK authored Nov 2, 2024
1 parent a5f1f7d commit 3ce6118
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions crypto/func/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,8 @@ bool Op::generate_code_step(Stack& stack) {
catch_stack.push_new_var(left[1]);
stack.rearrange_top(catch_vars, catch_last);
stack.opt_show();
stack.o << "c1 PUSH";
stack.o << "c3 PUSH";
stack.o << "c4 PUSH";
stack.o << "c5 PUSH";
stack.o << "c7 PUSH";
Expand All @@ -846,6 +848,8 @@ bool Op::generate_code_step(Stack& stack) {
stack.o << "c7 SETCONT";
stack.o << "c5 SETCONT";
stack.o << "c4 SETCONT";
stack.o << "c3 SETCONT";
stack.o << "c1 SETCONT";
for (size_t begin = catch_vars.size(), end = begin; end > 0; end = begin) {
begin = end >= block_size ? end - block_size : 0;
stack.o << std::to_string(end - begin) + " PUSHINT";
Expand Down
2 changes: 1 addition & 1 deletion crypto/func/func.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern std::string generated_from;

constexpr int optimize_depth = 20;

const std::string func_version{"0.4.5"};
const std::string func_version{"0.4.6"};

enum Keyword {
_Eof = -1,
Expand Down

0 comments on commit 3ce6118

Please sign in to comment.