Merge pull request #254 from chfast/pr/jitvm_stub
JitVm struct stub. Forwards calls to DebugVm.
This commit is contained in:
commit
5b561f434d
@ -14,6 +14,7 @@ type Type int
|
|||||||
const (
|
const (
|
||||||
StandardVmTy Type = iota
|
StandardVmTy Type = iota
|
||||||
DebugVmTy
|
DebugVmTy
|
||||||
|
JitVmTy
|
||||||
|
|
||||||
MaxVmTy
|
MaxVmTy
|
||||||
)
|
)
|
||||||
|
2
vm/vm.go
2
vm/vm.go
@ -15,6 +15,8 @@ func New(env Environment, typ Type) VirtualMachine {
|
|||||||
switch typ {
|
switch typ {
|
||||||
case DebugVmTy:
|
case DebugVmTy:
|
||||||
return NewDebugVm(env)
|
return NewDebugVm(env)
|
||||||
|
case JitVmTy:
|
||||||
|
return NewJitVm(env)
|
||||||
default:
|
default:
|
||||||
return &Vm{env: env}
|
return &Vm{env: env}
|
||||||
}
|
}
|
||||||
|
31
vm/vm_jit.go
Normal file
31
vm/vm_jit.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package vm
|
||||||
|
|
||||||
|
import "math/big"
|
||||||
|
|
||||||
|
type JitVm struct {
|
||||||
|
env Environment
|
||||||
|
backup *DebugVm
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewJitVm(env Environment) *JitVm {
|
||||||
|
backupVm := NewDebugVm(env)
|
||||||
|
return &JitVm{env: env, backup: backupVm}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *big.Int, callData []byte) (ret []byte, err error) {
|
||||||
|
return self.backup.Run(me, caller, code, value, gas, price, callData)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *JitVm) Printf(format string, v ...interface{}) VirtualMachine {
|
||||||
|
return self.backup.Printf(format, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *JitVm) Endl() VirtualMachine {
|
||||||
|
return self.backup.Endl()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *JitVm) Env() Environment {
|
||||||
|
return self.env
|
||||||
|
}
|
||||||
|
|
||||||
|
//go is nice
|
Loading…
Reference in New Issue
Block a user