mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
bugfixes + doc update
This commit is contained in:
parent
77842f9b63
commit
1de39f5d7c
44 changed files with 652 additions and 272 deletions
|
@ -53,6 +53,23 @@ int exec_null_swap_if(VmState* st, bool cond, int depth) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int exec_null_swap_if_many(VmState* st, bool cond, int depth, int count) {
|
||||
Stack& stack = st->get_stack();
|
||||
VM_LOG(st) << "execute NULL" << (depth ? "ROTR" : "SWAP") << (cond ? "IF" : "IFNOT") << count;
|
||||
stack.check_underflow(depth + 1);
|
||||
auto x = stack.pop_int_finite();
|
||||
if (!x->sgn() != cond) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
stack.push({});
|
||||
}
|
||||
for (int i = 0; i < depth; i++) {
|
||||
swap(stack[i], stack[i + count]);
|
||||
}
|
||||
}
|
||||
stack.push_int(std::move(x));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exec_mktuple_common(VmState* st, unsigned n) {
|
||||
Stack& stack = st->get_stack();
|
||||
stack.check_underflow(n);
|
||||
|
@ -374,6 +391,10 @@ void register_tuple_ops(OpcodeTable& cp0) {
|
|||
.insert(OpcodeInstr::mksimple(0x6fa1, 16, "NULLSWAPIFNOT", std::bind(exec_null_swap_if, _1, false, 0)))
|
||||
.insert(OpcodeInstr::mksimple(0x6fa2, 16, "NULLROTRIF", std::bind(exec_null_swap_if, _1, true, 1)))
|
||||
.insert(OpcodeInstr::mksimple(0x6fa3, 16, "NULLROTRIFNOT", std::bind(exec_null_swap_if, _1, false, 1)))
|
||||
.insert(OpcodeInstr::mksimple(0x6fa4, 16, "NULLSWAPIF2", std::bind(exec_null_swap_if_many, _1, true, 0, 2)))
|
||||
.insert(OpcodeInstr::mksimple(0x6fa5, 16, "NULLSWAPIFNOT2", std::bind(exec_null_swap_if_many, _1, false, 0, 2)))
|
||||
.insert(OpcodeInstr::mksimple(0x6fa6, 16, "NULLROTRIF2", std::bind(exec_null_swap_if_many, _1, true, 1, 2)))
|
||||
.insert(OpcodeInstr::mksimple(0x6fa7, 16, "NULLROTRIFNOT2", std::bind(exec_null_swap_if_many, _1, false, 1, 2)))
|
||||
.insert(OpcodeInstr::mkfixed(0x6fb, 12, 4, dump_tuple_index2, exec_tuple_index2))
|
||||
.insert(OpcodeInstr::mkfixed(0x6fc >> 2, 10, 6, dump_tuple_index3, exec_tuple_index3));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue