Added pre processing of script data

This commit is contained in:
obscuren
2014-04-12 00:13:42 -04:00
parent 116516158d
commit 086acd122b
3 changed files with 35 additions and 3 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ func (c *Closure) Address() []byte {
return c.object.Address()
}
type DebugHook func(op OpCode, mem *Memory, stack *Stack)
type DebugHook func(step int, op OpCode, mem *Memory, stack *Stack)
func (c *Closure) Call(vm *Vm, args []byte, hook DebugHook) []byte {
c.Args = args
+3 -2
View File
@@ -312,6 +312,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) []byte {
stack.Push(val)
pc.Add(pc, big.NewInt(31))
step++
case oPUSH20:
pc.Add(pc, ethutil.Big1)
data := closure.Gets(pc, big.NewInt(20))
@@ -321,7 +322,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) []byte {
stack.Push(val)
pc.Add(pc, big.NewInt(19))
step++
case oPOP:
stack.Pop()
case oDUP:
@@ -410,7 +411,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) []byte {
pc.Add(pc, ethutil.Big1)
if hook != nil {
hook(op, mem, stack)
hook(step-1, op, mem, stack)
}
}
}