mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
evmjit: Implement STATICCALL
This commit is contained in:
parent
07379eb387
commit
d0bbe110b4
1 changed files with 14 additions and 7 deletions
|
|
@ -358,13 +358,17 @@ func call(result *C.struct_evm_result, pCtx unsafe.Pointer, msg *C.struct_evm_me
|
||||||
var gasLeft uint64
|
var gasLeft uint64
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
staticCall := (msg.flags & C.EVM_STATIC) != 0
|
|
||||||
assert(!staticCall, "static call?")
|
|
||||||
|
|
||||||
switch msg.kind {
|
switch msg.kind {
|
||||||
case C.EVM_CALL:
|
case C.EVM_CALL:
|
||||||
|
staticCall := (msg.flags & C.EVM_STATIC) != 0
|
||||||
|
if staticCall {
|
||||||
|
fmt.Printf("STATICCALL(gas %d, %x)\n", gas, addr)
|
||||||
|
output, gasLeft, err = env.StaticCall(contract, addr, input, gas)
|
||||||
|
} else {
|
||||||
fmt.Printf("CALL(gas %d, %x)\n", gas, addr)
|
fmt.Printf("CALL(gas %d, %x)\n", gas, addr)
|
||||||
output, gasLeft, err = env.Call(contract, addr, input, gas, value)
|
output, gasLeft, err = env.Call(contract, addr, input, gas, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
case C.EVM_CALLCODE:
|
case C.EVM_CALLCODE:
|
||||||
fmt.Printf("CALLCODE(gas %d, %x, value %d)\n", gas, addr, value)
|
fmt.Printf("CALLCODE(gas %d, %x, value %d)\n", gas, addr, value)
|
||||||
|
|
@ -468,8 +472,11 @@ func (evm *EVMJIT) Run(snapshot int, contract *Contract, input []byte) (ret []by
|
||||||
msg.depth = C.int32_t(evm.env.depth - 1)
|
msg.depth = C.int32_t(evm.env.depth - 1)
|
||||||
codeHash := crypto.Keccak256Hash(code)
|
codeHash := crypto.Keccak256Hash(code)
|
||||||
msg.code_hash = HashToEvmc(codeHash)
|
msg.code_hash = HashToEvmc(codeHash)
|
||||||
assert(evm.readOnly == false, "read only?")
|
if evm.readOnly {
|
||||||
|
msg.flags = C.EVM_STATIC
|
||||||
|
} else {
|
||||||
msg.flags = 0
|
msg.flags = 0
|
||||||
|
}
|
||||||
|
|
||||||
// fmt.Printf("EVMJIT pre Run (gas %d %d mode: %d, env: %d) %x %x\n", contract.Gas, gas, rev, wrapper.index, codeHash, contract.Address())
|
// fmt.Printf("EVMJIT pre Run (gas %d %d mode: %d, env: %d) %x %x\n", contract.Gas, gas, rev, wrapper.index, codeHash, contract.Address())
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue