From ba225017c4c1b60dff57ad56da4e8972812a17e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 12 Jan 2015 19:40:14 +0100 Subject: [PATCH] JitVm struct stub. Forwards calls to DebugVm. --- vm/common.go | 1 + vm/vm.go | 2 ++ vm/vm_jit.go | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 vm/vm_jit.go diff --git a/vm/common.go b/vm/common.go index f19b0fe4bc..ed250dab1b 100644 --- a/vm/common.go +++ b/vm/common.go @@ -14,6 +14,7 @@ type Type int const ( StandardVmTy Type = iota DebugVmTy + JitVmTy MaxVmTy ) diff --git a/vm/vm.go b/vm/vm.go index a5ea297b32..b795bb86e6 100644 --- a/vm/vm.go +++ b/vm/vm.go @@ -15,6 +15,8 @@ func New(env Environment, typ Type) VirtualMachine { switch typ { case DebugVmTy: return NewDebugVm(env) + case JitVmTy: + return NewJitVm(env) default: return &Vm{env: env} } diff --git a/vm/vm_jit.go b/vm/vm_jit.go new file mode 100644 index 0000000000..c715abab0b --- /dev/null +++ b/vm/vm_jit.go @@ -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 \ No newline at end of file