Skip to content

Commit

Permalink
core/vm: use a callcontext struct (#20761)
Browse files Browse the repository at this point in the history
* core/vm: use a callcontext struct

* core/vm: fix tests

* core/vm/runtime: benchmark

* core/vm: make intpool push inlineable, unexpose callcontext
  • Loading branch information
holiman committed Apr 7, 2020
1 parent 0bec6a4 commit 8dc8941
Show file tree
Hide file tree
Showing 7 changed files with 349 additions and 292 deletions.
10 changes: 5 additions & 5 deletions core/vm/eips.go
Expand Up @@ -60,9 +60,9 @@ func enable1884(jt *JumpTable) {
}
}

func opSelfBalance(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
balance := interpreter.intPool.get().Set(interpreter.evm.StateDB.GetBalance(contract.Address()))
stack.push(balance)
func opSelfBalance(pc *uint64, interpreter *EVMInterpreter, callContext *callCtx) ([]byte, error) {
balance := interpreter.intPool.get().Set(interpreter.evm.StateDB.GetBalance(callContext.contract.Address()))
callContext.stack.push(balance)
return nil, nil
}

Expand All @@ -80,9 +80,9 @@ func enable1344(jt *JumpTable) {
}

// opChainID implements CHAINID opcode
func opChainID(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
func opChainID(pc *uint64, interpreter *EVMInterpreter, callContext *callCtx) ([]byte, error) {
chainId := interpreter.intPool.get().Set(interpreter.evm.chainConfig.ChainID)
stack.push(chainId)
callContext.stack.push(chainId)
return nil, nil
}

Expand Down

0 comments on commit 8dc8941

Please sign in to comment.