diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-01 22:30:29 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-01 22:30:29 +0800 |
commit | 8ccde784f9035c0a7a8f234994538c817c5b9de7 (patch) | |
tree | 6fc252d3372510abda8fd16297caca481b5beeae /core/state_transition.go | |
parent | d52878c744fd7acce727feb41c2d4296e56826d3 (diff) | |
download | dexon-8ccde784f9035c0a7a8f234994538c817c5b9de7.tar dexon-8ccde784f9035c0a7a8f234994538c817c5b9de7.tar.gz dexon-8ccde784f9035c0a7a8f234994538c817c5b9de7.tar.bz2 dexon-8ccde784f9035c0a7a8f234994538c817c5b9de7.tar.lz dexon-8ccde784f9035c0a7a8f234994538c817c5b9de7.tar.xz dexon-8ccde784f9035c0a7a8f234994538c817c5b9de7.tar.zst dexon-8ccde784f9035c0a7a8f234994538c817c5b9de7.zip |
Added (disabled) Jit validation
Diffstat (limited to 'core/state_transition.go')
-rw-r--r-- | core/state_transition.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/core/state_transition.go b/core/state_transition.go index 8b0ca2ac4..00d9d486a 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -10,6 +10,8 @@ import ( "github.com/ethereum/go-ethereum/vm" ) +const tryJit = false + /* * The State transitioning model * @@ -184,6 +186,7 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) { return } + stateCopy := self.env.State().Copy() vmenv := self.env var ref vm.ContextRef if MessageCreatesContract(msg) { @@ -196,8 +199,30 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) { ref.SetCode(ret) } } + + if vmenv, ok := vmenv.(*VMEnv); ok && tryJit { + statelogger.Infof("CREATE: re-running using JIT (PH=%x)\n", stateCopy.Root()[:4]) + // re-run using the JIT (validation for the JIT) + goodState := vmenv.State().Copy() + vmenv.state = stateCopy + vmenv.SetVmType(vm.JitVmTy) + vmenv.Create(sender, contract.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) + statelogger.Infof("DONE PH=%x STD_H=%x JIT_H=%x\n", stateCopy.Root()[:4], goodState.Root()[:4], vmenv.State().Root()[:4]) + self.state.Set(goodState) + } } else { ret, err = vmenv.Call(self.From(), self.To().Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) + + if vmenv, ok := vmenv.(*VMEnv); ok && tryJit { + statelogger.Infof("CALL: re-running using JIT (PH=%x)\n", stateCopy.Root()[:4]) + // re-run using the JIT (validation for the JIT) + goodState := vmenv.State().Copy() + vmenv.state = stateCopy + vmenv.SetVmType(vm.JitVmTy) + vmenv.Call(self.From(), self.To().Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) + statelogger.Infof("DONE PH=%x STD_H=%x JIT_H=%x\n", stateCopy.Root()[:4], goodState.Root()[:4], vmenv.State().Root()[:4]) + self.state.Set(goodState) + } } if err != nil { |