|
|
@ -27,14 +27,14 @@ import ( |
|
|
|
|
|
|
|
|
|
|
|
type programInstruction interface { |
|
|
|
type programInstruction interface { |
|
|
|
// executes the program instruction and allows the instruction to modify the state of the program
|
|
|
|
// executes the program instruction and allows the instruction to modify the state of the program
|
|
|
|
do(program *Program, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) ([]byte, error) |
|
|
|
do(program *Program, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) |
|
|
|
// returns whether the program instruction halts the execution of the JIT
|
|
|
|
// returns whether the program instruction halts the execution of the JIT
|
|
|
|
halts() bool |
|
|
|
halts() bool |
|
|
|
// Returns the current op code (debugging purposes)
|
|
|
|
// Returns the current op code (debugging purposes)
|
|
|
|
Op() OpCode |
|
|
|
Op() OpCode |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type instrFn func(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) |
|
|
|
type instrFn func(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) |
|
|
|
|
|
|
|
|
|
|
|
type instruction struct { |
|
|
|
type instruction struct { |
|
|
|
op OpCode |
|
|
|
op OpCode |
|
|
@ -58,7 +58,7 @@ func jump(mapping map[uint64]uint64, destinations map[uint64]struct{}, contract |
|
|
|
return mapping[to.Uint64()], nil |
|
|
|
return mapping[to.Uint64()], nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (instr instruction) do(program *Program, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) ([]byte, error) { |
|
|
|
func (instr instruction) do(program *Program, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) { |
|
|
|
// calculate the new memory size and gas price for the current executing opcode
|
|
|
|
// calculate the new memory size and gas price for the current executing opcode
|
|
|
|
newMemSize, cost, err := jitCalculateGasAndSize(env, contract, instr, env.Db(), memory, stack) |
|
|
|
newMemSize, cost, err := jitCalculateGasAndSize(env, contract, instr, env.Db(), memory, stack) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -114,26 +114,26 @@ func (instr instruction) Op() OpCode { |
|
|
|
return instr.op |
|
|
|
return instr.op |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opStaticJump(instr instruction, pc *uint64, ret *big.Int, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opStaticJump(instr instruction, pc *uint64, ret *big.Int, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
ret.Set(instr.data) |
|
|
|
ret.Set(instr.data) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opAdd(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opAdd(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
stack.push(U256(x.Add(x, y))) |
|
|
|
stack.push(U256(x.Add(x, y))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSub(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSub(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
stack.push(U256(x.Sub(x, y))) |
|
|
|
stack.push(U256(x.Sub(x, y))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opMul(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opMul(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
stack.push(U256(x.Mul(x, y))) |
|
|
|
stack.push(U256(x.Mul(x, y))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opDiv(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opDiv(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
if y.Cmp(common.Big0) != 0 { |
|
|
|
if y.Cmp(common.Big0) != 0 { |
|
|
|
stack.push(U256(x.Div(x, y))) |
|
|
|
stack.push(U256(x.Div(x, y))) |
|
|
@ -142,7 +142,7 @@ func opDiv(instr instruction, pc *uint64, env Environment, contract *Contract, m |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSdiv(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSdiv(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := S256(stack.pop()), S256(stack.pop()) |
|
|
|
x, y := S256(stack.pop()), S256(stack.pop()) |
|
|
|
if y.Cmp(common.Big0) == 0 { |
|
|
|
if y.Cmp(common.Big0) == 0 { |
|
|
|
stack.push(new(big.Int)) |
|
|
|
stack.push(new(big.Int)) |
|
|
@ -162,7 +162,7 @@ func opSdiv(instr instruction, pc *uint64, env Environment, contract *Contract, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opMod(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opMod(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
if y.Cmp(common.Big0) == 0 { |
|
|
|
if y.Cmp(common.Big0) == 0 { |
|
|
|
stack.push(new(big.Int)) |
|
|
|
stack.push(new(big.Int)) |
|
|
@ -171,7 +171,7 @@ func opMod(instr instruction, pc *uint64, env Environment, contract *Contract, m |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSmod(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSmod(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := S256(stack.pop()), S256(stack.pop()) |
|
|
|
x, y := S256(stack.pop()), S256(stack.pop()) |
|
|
|
|
|
|
|
|
|
|
|
if y.Cmp(common.Big0) == 0 { |
|
|
|
if y.Cmp(common.Big0) == 0 { |
|
|
@ -191,12 +191,12 @@ func opSmod(instr instruction, pc *uint64, env Environment, contract *Contract, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opExp(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opExp(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
stack.push(U256(x.Exp(x, y, Pow256))) |
|
|
|
stack.push(U256(x.Exp(x, y, Pow256))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSignExtend(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSignExtend(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
back := stack.pop() |
|
|
|
back := stack.pop() |
|
|
|
if back.Cmp(big.NewInt(31)) < 0 { |
|
|
|
if back.Cmp(big.NewInt(31)) < 0 { |
|
|
|
bit := uint(back.Uint64()*8 + 7) |
|
|
|
bit := uint(back.Uint64()*8 + 7) |
|
|
@ -213,12 +213,12 @@ func opSignExtend(instr instruction, pc *uint64, env Environment, contract *Cont |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opNot(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opNot(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x := stack.pop() |
|
|
|
x := stack.pop() |
|
|
|
stack.push(U256(x.Not(x))) |
|
|
|
stack.push(U256(x.Not(x))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opLt(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opLt(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
if x.Cmp(y) < 0 { |
|
|
|
if x.Cmp(y) < 0 { |
|
|
|
stack.push(big.NewInt(1)) |
|
|
|
stack.push(big.NewInt(1)) |
|
|
@ -227,7 +227,7 @@ func opLt(instr instruction, pc *uint64, env Environment, contract *Contract, me |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opGt(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opGt(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
if x.Cmp(y) > 0 { |
|
|
|
if x.Cmp(y) > 0 { |
|
|
|
stack.push(big.NewInt(1)) |
|
|
|
stack.push(big.NewInt(1)) |
|
|
@ -236,7 +236,7 @@ func opGt(instr instruction, pc *uint64, env Environment, contract *Contract, me |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSlt(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSlt(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := S256(stack.pop()), S256(stack.pop()) |
|
|
|
x, y := S256(stack.pop()), S256(stack.pop()) |
|
|
|
if x.Cmp(S256(y)) < 0 { |
|
|
|
if x.Cmp(S256(y)) < 0 { |
|
|
|
stack.push(big.NewInt(1)) |
|
|
|
stack.push(big.NewInt(1)) |
|
|
@ -245,7 +245,7 @@ func opSlt(instr instruction, pc *uint64, env Environment, contract *Contract, m |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSgt(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSgt(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := S256(stack.pop()), S256(stack.pop()) |
|
|
|
x, y := S256(stack.pop()), S256(stack.pop()) |
|
|
|
if x.Cmp(y) > 0 { |
|
|
|
if x.Cmp(y) > 0 { |
|
|
|
stack.push(big.NewInt(1)) |
|
|
|
stack.push(big.NewInt(1)) |
|
|
@ -254,7 +254,7 @@ func opSgt(instr instruction, pc *uint64, env Environment, contract *Contract, m |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opEq(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opEq(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
if x.Cmp(y) == 0 { |
|
|
|
if x.Cmp(y) == 0 { |
|
|
|
stack.push(big.NewInt(1)) |
|
|
|
stack.push(big.NewInt(1)) |
|
|
@ -263,7 +263,7 @@ func opEq(instr instruction, pc *uint64, env Environment, contract *Contract, me |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opIszero(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opIszero(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x := stack.pop() |
|
|
|
x := stack.pop() |
|
|
|
if x.Cmp(common.Big0) > 0 { |
|
|
|
if x.Cmp(common.Big0) > 0 { |
|
|
|
stack.push(new(big.Int)) |
|
|
|
stack.push(new(big.Int)) |
|
|
@ -272,19 +272,19 @@ func opIszero(instr instruction, pc *uint64, env Environment, contract *Contract |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opAnd(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opAnd(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
stack.push(x.And(x, y)) |
|
|
|
stack.push(x.And(x, y)) |
|
|
|
} |
|
|
|
} |
|
|
|
func opOr(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opOr(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
stack.push(x.Or(x, y)) |
|
|
|
stack.push(x.Or(x, y)) |
|
|
|
} |
|
|
|
} |
|
|
|
func opXor(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opXor(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
x, y := stack.pop(), stack.pop() |
|
|
|
stack.push(x.Xor(x, y)) |
|
|
|
stack.push(x.Xor(x, y)) |
|
|
|
} |
|
|
|
} |
|
|
|
func opByte(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opByte(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
th, val := stack.pop(), stack.pop() |
|
|
|
th, val := stack.pop(), stack.pop() |
|
|
|
if th.Cmp(big.NewInt(32)) < 0 { |
|
|
|
if th.Cmp(big.NewInt(32)) < 0 { |
|
|
|
byte := big.NewInt(int64(common.LeftPadBytes(val.Bytes(), 32)[th.Int64()])) |
|
|
|
byte := big.NewInt(int64(common.LeftPadBytes(val.Bytes(), 32)[th.Int64()])) |
|
|
@ -293,7 +293,7 @@ func opByte(instr instruction, pc *uint64, env Environment, contract *Contract, |
|
|
|
stack.push(new(big.Int)) |
|
|
|
stack.push(new(big.Int)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
func opAddmod(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opAddmod(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y, z := stack.pop(), stack.pop(), stack.pop() |
|
|
|
x, y, z := stack.pop(), stack.pop(), stack.pop() |
|
|
|
if z.Cmp(Zero) > 0 { |
|
|
|
if z.Cmp(Zero) > 0 { |
|
|
|
add := x.Add(x, y) |
|
|
|
add := x.Add(x, y) |
|
|
@ -303,7 +303,7 @@ func opAddmod(instr instruction, pc *uint64, env Environment, contract *Contract |
|
|
|
stack.push(new(big.Int)) |
|
|
|
stack.push(new(big.Int)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
func opMulmod(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opMulmod(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
x, y, z := stack.pop(), stack.pop(), stack.pop() |
|
|
|
x, y, z := stack.pop(), stack.pop(), stack.pop() |
|
|
|
if z.Cmp(Zero) > 0 { |
|
|
|
if z.Cmp(Zero) > 0 { |
|
|
|
mul := x.Mul(x, y) |
|
|
|
mul := x.Mul(x, y) |
|
|
@ -314,45 +314,45 @@ func opMulmod(instr instruction, pc *uint64, env Environment, contract *Contract |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSha3(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSha3(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
offset, size := stack.pop(), stack.pop() |
|
|
|
offset, size := stack.pop(), stack.pop() |
|
|
|
hash := crypto.Keccak256(memory.Get(offset.Int64(), size.Int64())) |
|
|
|
hash := crypto.Keccak256(memory.Get(offset.Int64(), size.Int64())) |
|
|
|
|
|
|
|
|
|
|
|
stack.push(common.BytesToBig(hash)) |
|
|
|
stack.push(common.BytesToBig(hash)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opAddress(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opAddress(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(common.Bytes2Big(contract.Address().Bytes())) |
|
|
|
stack.push(common.Bytes2Big(contract.Address().Bytes())) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opBalance(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opBalance(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
addr := common.BigToAddress(stack.pop()) |
|
|
|
addr := common.BigToAddress(stack.pop()) |
|
|
|
balance := env.Db().GetBalance(addr) |
|
|
|
balance := env.Db().GetBalance(addr) |
|
|
|
|
|
|
|
|
|
|
|
stack.push(new(big.Int).Set(balance)) |
|
|
|
stack.push(new(big.Int).Set(balance)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opOrigin(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opOrigin(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(env.Origin().Big()) |
|
|
|
stack.push(env.Origin().Big()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCaller(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCaller(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(contract.Caller().Big()) |
|
|
|
stack.push(contract.Caller().Big()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCallValue(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCallValue(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(new(big.Int).Set(contract.value)) |
|
|
|
stack.push(new(big.Int).Set(contract.value)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCalldataLoad(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCalldataLoad(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(common.Bytes2Big(getData(contract.Input, stack.pop(), common.Big32))) |
|
|
|
stack.push(common.Bytes2Big(getData(contract.Input, stack.pop(), common.Big32))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCalldataSize(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCalldataSize(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(big.NewInt(int64(len(contract.Input)))) |
|
|
|
stack.push(big.NewInt(int64(len(contract.Input)))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCalldataCopy(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCalldataCopy(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
var ( |
|
|
|
var ( |
|
|
|
mOff = stack.pop() |
|
|
|
mOff = stack.pop() |
|
|
|
cOff = stack.pop() |
|
|
|
cOff = stack.pop() |
|
|
@ -361,18 +361,18 @@ func opCalldataCopy(instr instruction, pc *uint64, env Environment, contract *Co |
|
|
|
memory.Set(mOff.Uint64(), l.Uint64(), getData(contract.Input, cOff, l)) |
|
|
|
memory.Set(mOff.Uint64(), l.Uint64(), getData(contract.Input, cOff, l)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opExtCodeSize(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opExtCodeSize(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
addr := common.BigToAddress(stack.pop()) |
|
|
|
addr := common.BigToAddress(stack.pop()) |
|
|
|
l := big.NewInt(int64(len(env.Db().GetCode(addr)))) |
|
|
|
l := big.NewInt(int64(len(env.Db().GetCode(addr)))) |
|
|
|
stack.push(l) |
|
|
|
stack.push(l) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCodeSize(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCodeSize(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
l := big.NewInt(int64(len(contract.Code))) |
|
|
|
l := big.NewInt(int64(len(contract.Code))) |
|
|
|
stack.push(l) |
|
|
|
stack.push(l) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCodeCopy(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCodeCopy(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
var ( |
|
|
|
var ( |
|
|
|
mOff = stack.pop() |
|
|
|
mOff = stack.pop() |
|
|
|
cOff = stack.pop() |
|
|
|
cOff = stack.pop() |
|
|
@ -383,7 +383,7 @@ func opCodeCopy(instr instruction, pc *uint64, env Environment, contract *Contra |
|
|
|
memory.Set(mOff.Uint64(), l.Uint64(), codeCopy) |
|
|
|
memory.Set(mOff.Uint64(), l.Uint64(), codeCopy) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opExtCodeCopy(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opExtCodeCopy(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
var ( |
|
|
|
var ( |
|
|
|
addr = common.BigToAddress(stack.pop()) |
|
|
|
addr = common.BigToAddress(stack.pop()) |
|
|
|
mOff = stack.pop() |
|
|
|
mOff = stack.pop() |
|
|
@ -395,11 +395,11 @@ func opExtCodeCopy(instr instruction, pc *uint64, env Environment, contract *Con |
|
|
|
memory.Set(mOff.Uint64(), l.Uint64(), codeCopy) |
|
|
|
memory.Set(mOff.Uint64(), l.Uint64(), codeCopy) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opGasprice(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opGasprice(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(new(big.Int).Set(contract.Price)) |
|
|
|
stack.push(new(big.Int).Set(contract.Price)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opBlockhash(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opBlockhash(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
num := stack.pop() |
|
|
|
num := stack.pop() |
|
|
|
|
|
|
|
|
|
|
|
n := new(big.Int).Sub(env.BlockNumber(), common.Big257) |
|
|
|
n := new(big.Int).Sub(env.BlockNumber(), common.Big257) |
|
|
@ -410,43 +410,43 @@ func opBlockhash(instr instruction, pc *uint64, env Environment, contract *Contr |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCoinbase(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCoinbase(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(env.Coinbase().Big()) |
|
|
|
stack.push(env.Coinbase().Big()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opTimestamp(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opTimestamp(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(U256(new(big.Int).Set(env.Time()))) |
|
|
|
stack.push(U256(new(big.Int).Set(env.Time()))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opNumber(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opNumber(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(U256(new(big.Int).Set(env.BlockNumber()))) |
|
|
|
stack.push(U256(new(big.Int).Set(env.BlockNumber()))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opDifficulty(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opDifficulty(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(U256(new(big.Int).Set(env.Difficulty()))) |
|
|
|
stack.push(U256(new(big.Int).Set(env.Difficulty()))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opGasLimit(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opGasLimit(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(U256(new(big.Int).Set(env.GasLimit()))) |
|
|
|
stack.push(U256(new(big.Int).Set(env.GasLimit()))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opPop(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opPop(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.pop() |
|
|
|
stack.pop() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opPush(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opPush(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(new(big.Int).Set(instr.data)) |
|
|
|
stack.push(new(big.Int).Set(instr.data)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opDup(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opDup(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.dup(int(instr.data.Int64())) |
|
|
|
stack.dup(int(instr.data.Int64())) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSwap(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSwap(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.swap(int(instr.data.Int64())) |
|
|
|
stack.swap(int(instr.data.Int64())) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opLog(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opLog(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
n := int(instr.data.Int64()) |
|
|
|
n := int(instr.data.Int64()) |
|
|
|
topics := make([]common.Hash, n) |
|
|
|
topics := make([]common.Hash, n) |
|
|
|
mStart, mSize := stack.pop(), stack.pop() |
|
|
|
mStart, mSize := stack.pop(), stack.pop() |
|
|
@ -459,55 +459,55 @@ func opLog(instr instruction, pc *uint64, env Environment, contract *Contract, m |
|
|
|
env.AddLog(log) |
|
|
|
env.AddLog(log) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opMload(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opMload(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
offset := stack.pop() |
|
|
|
offset := stack.pop() |
|
|
|
val := common.BigD(memory.Get(offset.Int64(), 32)) |
|
|
|
val := common.BigD(memory.Get(offset.Int64(), 32)) |
|
|
|
stack.push(val) |
|
|
|
stack.push(val) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opMstore(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opMstore(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
// pop value of the stack
|
|
|
|
// pop value of the stack
|
|
|
|
mStart, val := stack.pop(), stack.pop() |
|
|
|
mStart, val := stack.pop(), stack.pop() |
|
|
|
memory.Set(mStart.Uint64(), 32, common.BigToBytes(val, 256)) |
|
|
|
memory.Set(mStart.Uint64(), 32, common.BigToBytes(val, 256)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opMstore8(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opMstore8(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
off, val := stack.pop().Int64(), stack.pop().Int64() |
|
|
|
off, val := stack.pop().Int64(), stack.pop().Int64() |
|
|
|
memory.store[off] = byte(val & 0xff) |
|
|
|
memory.store[off] = byte(val & 0xff) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSload(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSload(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
loc := common.BigToHash(stack.pop()) |
|
|
|
loc := common.BigToHash(stack.pop()) |
|
|
|
val := env.Db().GetState(contract.Address(), loc).Big() |
|
|
|
val := env.Db().GetState(contract.Address(), loc).Big() |
|
|
|
stack.push(val) |
|
|
|
stack.push(val) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSstore(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSstore(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
loc := common.BigToHash(stack.pop()) |
|
|
|
loc := common.BigToHash(stack.pop()) |
|
|
|
val := stack.pop() |
|
|
|
val := stack.pop() |
|
|
|
env.Db().SetState(contract.Address(), loc, common.BigToHash(val)) |
|
|
|
env.Db().SetState(contract.Address(), loc, common.BigToHash(val)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opJump(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opJump(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
} |
|
|
|
} |
|
|
|
func opJumpi(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opJumpi(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
} |
|
|
|
} |
|
|
|
func opJumpdest(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opJumpdest(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opPc(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opPc(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(new(big.Int).Set(instr.data)) |
|
|
|
stack.push(new(big.Int).Set(instr.data)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opMsize(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opMsize(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(big.NewInt(int64(memory.Len()))) |
|
|
|
stack.push(big.NewInt(int64(memory.Len()))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opGas(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opGas(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.push(new(big.Int).Set(contract.Gas)) |
|
|
|
stack.push(new(big.Int).Set(contract.Gas)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCreate(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCreate(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
var ( |
|
|
|
var ( |
|
|
|
value = stack.pop() |
|
|
|
value = stack.pop() |
|
|
|
offset, size = stack.pop(), stack.pop() |
|
|
|
offset, size = stack.pop(), stack.pop() |
|
|
@ -529,7 +529,7 @@ func opCreate(instr instruction, pc *uint64, env Environment, contract *Contract |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCall(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCall(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
gas := stack.pop() |
|
|
|
gas := stack.pop() |
|
|
|
// pop gas and value of the stack.
|
|
|
|
// pop gas and value of the stack.
|
|
|
|
addr, value := stack.pop(), stack.pop() |
|
|
|
addr, value := stack.pop(), stack.pop() |
|
|
@ -560,7 +560,7 @@ func opCall(instr instruction, pc *uint64, env Environment, contract *Contract, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opCallCode(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opCallCode(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
gas := stack.pop() |
|
|
|
gas := stack.pop() |
|
|
|
// pop gas and value of the stack.
|
|
|
|
// pop gas and value of the stack.
|
|
|
|
addr, value := stack.pop(), stack.pop() |
|
|
|
addr, value := stack.pop(), stack.pop() |
|
|
@ -591,7 +591,7 @@ func opCallCode(instr instruction, pc *uint64, env Environment, contract *Contra |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opDelegateCall(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opDelegateCall(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
gas, to, inOffset, inSize, outOffset, outSize := stack.pop(), stack.pop(), stack.pop(), stack.pop(), stack.pop(), stack.pop() |
|
|
|
gas, to, inOffset, inSize, outOffset, outSize := stack.pop(), stack.pop(), stack.pop(), stack.pop(), stack.pop(), stack.pop() |
|
|
|
|
|
|
|
|
|
|
|
toAddr := common.BigToAddress(to) |
|
|
|
toAddr := common.BigToAddress(to) |
|
|
@ -605,12 +605,12 @@ func opDelegateCall(instr instruction, pc *uint64, env Environment, contract *Co |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opReturn(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opReturn(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
} |
|
|
|
} |
|
|
|
func opStop(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opStop(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func opSuicide(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
func opSuicide(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
balance := env.Db().GetBalance(contract.Address()) |
|
|
|
balance := env.Db().GetBalance(contract.Address()) |
|
|
|
env.Db().AddBalance(common.BigToAddress(stack.pop()), balance) |
|
|
|
env.Db().AddBalance(common.BigToAddress(stack.pop()), balance) |
|
|
|
|
|
|
|
|
|
|
@ -621,7 +621,7 @@ func opSuicide(instr instruction, pc *uint64, env Environment, contract *Contrac |
|
|
|
|
|
|
|
|
|
|
|
// make log instruction function
|
|
|
|
// make log instruction function
|
|
|
|
func makeLog(size int) instrFn { |
|
|
|
func makeLog(size int) instrFn { |
|
|
|
return func(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
return func(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
topics := make([]common.Hash, size) |
|
|
|
topics := make([]common.Hash, size) |
|
|
|
mStart, mSize := stack.pop(), stack.pop() |
|
|
|
mStart, mSize := stack.pop(), stack.pop() |
|
|
|
for i := 0; i < size; i++ { |
|
|
|
for i := 0; i < size; i++ { |
|
|
@ -636,7 +636,7 @@ func makeLog(size int) instrFn { |
|
|
|
|
|
|
|
|
|
|
|
// make push instruction function
|
|
|
|
// make push instruction function
|
|
|
|
func makePush(size uint64, bsize *big.Int) instrFn { |
|
|
|
func makePush(size uint64, bsize *big.Int) instrFn { |
|
|
|
return func(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
return func(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
byts := getData(contract.Code, new(big.Int).SetUint64(*pc+1), bsize) |
|
|
|
byts := getData(contract.Code, new(big.Int).SetUint64(*pc+1), bsize) |
|
|
|
stack.push(common.Bytes2Big(byts)) |
|
|
|
stack.push(common.Bytes2Big(byts)) |
|
|
|
*pc += size |
|
|
|
*pc += size |
|
|
@ -645,7 +645,7 @@ func makePush(size uint64, bsize *big.Int) instrFn { |
|
|
|
|
|
|
|
|
|
|
|
// make push instruction function
|
|
|
|
// make push instruction function
|
|
|
|
func makeDup(size int64) instrFn { |
|
|
|
func makeDup(size int64) instrFn { |
|
|
|
return func(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
return func(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.dup(int(size)) |
|
|
|
stack.dup(int(size)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -654,7 +654,7 @@ func makeDup(size int64) instrFn { |
|
|
|
func makeSwap(size int64) instrFn { |
|
|
|
func makeSwap(size int64) instrFn { |
|
|
|
// switch n + 1 otherwise n would be swapped with n
|
|
|
|
// switch n + 1 otherwise n would be swapped with n
|
|
|
|
size += 1 |
|
|
|
size += 1 |
|
|
|
return func(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) { |
|
|
|
return func(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { |
|
|
|
stack.swap(int(size)) |
|
|
|
stack.swap(int(size)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|