2014-10-18 11:31:20 +00:00
|
|
|
package vm
|
2014-07-22 09:54:48 +00:00
|
|
|
|
2014-12-03 16:06:54 +00:00
|
|
|
import "math/big"
|
2014-07-22 09:54:48 +00:00
|
|
|
|
2014-10-15 15:12:26 +00:00
|
|
|
// BIG FAT WARNING. THIS VM IS NOT YET IS USE!
|
|
|
|
// I want to get all VM tests pass first before updating this VM
|
|
|
|
|
2014-07-22 09:54:48 +00:00
|
|
|
type Vm struct {
|
2014-10-14 09:48:52 +00:00
|
|
|
env Environment
|
|
|
|
err error
|
2014-10-10 22:41:37 +00:00
|
|
|
depth int
|
2014-07-22 09:54:48 +00:00
|
|
|
}
|
|
|
|
|
2014-10-14 09:48:52 +00:00
|
|
|
func New(env Environment, typ Type) VirtualMachine {
|
|
|
|
switch typ {
|
|
|
|
case DebugVmTy:
|
|
|
|
return NewDebugVm(env)
|
2015-01-12 18:40:14 +00:00
|
|
|
case JitVmTy:
|
|
|
|
return NewJitVm(env)
|
2014-10-14 09:48:52 +00:00
|
|
|
default:
|
|
|
|
return &Vm{env: env}
|
2014-07-22 09:54:48 +00:00
|
|
|
}
|
2014-09-14 23:11:01 +00:00
|
|
|
}
|
|
|
|
|
2015-01-02 15:14:12 +00:00
|
|
|
func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.Int, data []byte) (ret []byte, err error) {
|
2014-12-12 21:24:27 +00:00
|
|
|
panic("not implemented")
|
2014-07-22 09:54:48 +00:00
|
|
|
}
|
|
|
|
|
2014-10-14 09:48:52 +00:00
|
|
|
func (self *Vm) Env() Environment {
|
|
|
|
return self.env
|
2014-07-22 09:54:48 +00:00
|
|
|
}
|
|
|
|
|
2014-10-14 09:48:52 +00:00
|
|
|
func (self *Vm) Depth() int {
|
|
|
|
return self.depth
|
2014-09-19 11:19:19 +00:00
|
|
|
}
|
2014-10-14 11:37:26 +00:00
|
|
|
|
|
|
|
func (self *Vm) Printf(format string, v ...interface{}) VirtualMachine { return self }
|
|
|
|
func (self *Vm) Endl() VirtualMachine { return self }
|