1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

func: bugfix

- bugfix in func
- vertseqno support in validator/collator/topsharddescr
This commit is contained in:
ton 2019-10-07 13:08:23 +04:00
parent 29deff15c3
commit f67f5d879b
10 changed files with 78 additions and 20 deletions

View file

@ -308,7 +308,7 @@ bool Op::generate_code_step(Stack& stack) {
func->compile(stack.o, res, args); // compile res := f (args)
} else {
std::string name = sym::symbols.get_name(fun_ref->sym_idx);
stack.o << AsmOp::Custom(name + " CALLDICT", (int)right.size());
stack.o << AsmOp::Custom(name + " CALLDICT", (int)right.size(), (int)left.size());
}
stack.push_new_var(left[0]);
return true;
@ -395,7 +395,7 @@ bool Op::generate_code_step(Stack& stack) {
assert(stack.s[k + i].first == right1[i]);
}
if (cl == _CallInd) {
stack.o << exec_arg_op("CALLARGS", (int)right.size() - 1, -1, (int)right.size() - 1);
stack.o << exec_arg_op("CALLARGS", (int)right.size() - 1, (int)right.size(), (int)left.size());
} else {
auto func = dynamic_cast<const SymValAsmFunc*>(fun_ref->value);
if (func) {
@ -407,7 +407,7 @@ bool Op::generate_code_step(Stack& stack) {
func->compile(stack.o, res, args); // compile res := f (args)
} else {
std::string name = sym::symbols.get_name(fun_ref->sym_idx);
stack.o << AsmOp::Custom(name + " CALLDICT", (int)right.size());
stack.o << AsmOp::Custom(name + " CALLDICT", (int)right.size(), (int)left.size());
}
}
stack.s.resize(k);
@ -421,6 +421,11 @@ bool Op::generate_code_step(Stack& stack) {
if (block0->is_empty() && block1->is_empty()) {
return true;
}
if (!next->noreturn() && (block0->noreturn() != block1->noreturn())) {
// simple fix of unbalanced returns in if/else branches
// (to be replaced with a finer condition working in loop bodies)
throw src::ParseError{where, "`if` and `else` branches should both return or both not return"};
}
var_idx_t x = left[0];
stack.rearrange_top(x, var_info[x] && var_info[x]->is_last());
assert(stack[0] == x);