aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/vm.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-21 02:11:40 +0800
committerobscuren <geffobscura@gmail.com>2014-06-21 02:11:40 +0800
commit7fb5e993e3a1cc2251bba7af1c85ed1d024b4b50 (patch)
tree11a2b586b466fd6a43eac6c9c9166ca7930fb62a /ethchain/vm.go
parent0251fae5ccf6984c558d59cd2b36ef89116c061e (diff)
downloadgo-tangerine-7fb5e993e3a1cc2251bba7af1c85ed1d024b4b50.tar
go-tangerine-7fb5e993e3a1cc2251bba7af1c85ed1d024b4b50.tar.gz
go-tangerine-7fb5e993e3a1cc2251bba7af1c85ed1d024b4b50.tar.bz2
go-tangerine-7fb5e993e3a1cc2251bba7af1c85ed1d024b4b50.tar.lz
go-tangerine-7fb5e993e3a1cc2251bba7af1c85ed1d024b4b50.tar.xz
go-tangerine-7fb5e993e3a1cc2251bba7af1c85ed1d024b4b50.tar.zst
go-tangerine-7fb5e993e3a1cc2251bba7af1c85ed1d024b4b50.zip
Moved 0 check to state object for now
Diffstat (limited to 'ethchain/vm.go')
-rw-r--r--ethchain/vm.go26
1 files changed, 14 insertions, 12 deletions
diff --git a/ethchain/vm.go b/ethchain/vm.go
index b9e8353fb..bacd05ba5 100644
--- a/ethchain/vm.go
+++ b/ethchain/vm.go
@@ -325,21 +325,21 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
stack.Push(base)
case LT:
require(2)
- y, x := stack.Popn()
- vm.Printf(" %v < %v", x, y)
+ x, y := stack.Popn()
+ vm.Printf(" %v < %v", y, x)
// x < y
- if x.Cmp(y) < 0 {
+ if y.Cmp(x) < 0 {
stack.Push(ethutil.BigTrue)
} else {
stack.Push(ethutil.BigFalse)
}
case GT:
require(2)
- y, x := stack.Popn()
- vm.Printf(" %v > %v", x, y)
+ x, y := stack.Popn()
+ vm.Printf(" %v > %v", y, x)
// x > y
- if x.Cmp(y) > 0 {
+ if y.Cmp(x) > 0 {
stack.Push(ethutil.BigTrue)
} else {
stack.Push(ethutil.BigFalse)
@@ -520,7 +520,10 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case MLOAD:
require(1)
offset := stack.Pop()
- stack.Push(ethutil.BigD(mem.Get(offset.Int64(), 32)))
+ val := ethutil.BigD(mem.Get(offset.Int64(), 32))
+ stack.Push(val)
+
+ vm.Printf(" => 0x%x", val.Bytes())
case MSTORE: // Store the value at stack top-1 in to memory at location stack top
require(2)
// Pop value of the stack
@@ -541,15 +544,14 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
val := closure.GetMem(loc)
stack.Push(val.BigInt())
- vm.Printf(" {} 0x%x", val)
+ vm.Printf(" {0x%x} 0x%x", loc.Bytes(), val)
case SSTORE:
require(2)
val, loc := stack.Popn()
- // FIXME This should be handled in the Trie it self
- if val.Cmp(big.NewInt(0)) != 0 {
- closure.SetStorage(loc, ethutil.NewValue(val))
- }
+ //if val.Cmp(big.NewInt(0)) != 0 {
+ closure.SetStorage(loc, ethutil.NewValue(val))
+ //}
// Add the change to manifest
vm.state.manifest.AddStorageChange(closure.Object(), loc.Bytes(), val)