aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/instructions_test.go
diff options
context:
space:
mode:
authorGuillaume Ballet <gballet@gmail.com>2018-07-03 18:06:42 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-07-03 18:06:42 +0800
commit4e5d1f1c39159de42511770bd390ad583ebd57a5 (patch)
treed1ce3fb28c78dc6bdc73026eacfee92fa71ce447 /core/vm/instructions_test.go
parentd57e85ecc91608a9095479365308a285f05c755d (diff)
downloaddexon-4e5d1f1c39159de42511770bd390ad583ebd57a5.tar
dexon-4e5d1f1c39159de42511770bd390ad583ebd57a5.tar.gz
dexon-4e5d1f1c39159de42511770bd390ad583ebd57a5.tar.bz2
dexon-4e5d1f1c39159de42511770bd390ad583ebd57a5.tar.lz
dexon-4e5d1f1c39159de42511770bd390ad583ebd57a5.tar.xz
dexon-4e5d1f1c39159de42511770bd390ad583ebd57a5.tar.zst
dexon-4e5d1f1c39159de42511770bd390ad583ebd57a5.zip
core/vm: reuse bigint pools across transactions (#17070)
* core/vm: A pool for int pools * core/vm: fix rebase issue * core/vm: push leftover stack items after execution, not before
Diffstat (limited to 'core/vm/instructions_test.go')
-rw-r--r--core/vm/instructions_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/vm/instructions_test.go b/core/vm/instructions_test.go
index f51e6363f..1643da967 100644
--- a/core/vm/instructions_test.go
+++ b/core/vm/instructions_test.go
@@ -36,6 +36,7 @@ func testTwoOperandOp(t *testing.T, tests []twoOperandTest, opFn func(pc *uint64
stack = newstack()
pc = uint64(0)
)
+ env.interpreter.intPool = poolOfIntPools.get()
for i, test := range tests {
x := new(big.Int).SetBytes(common.Hex2Bytes(test.x))
shift := new(big.Int).SetBytes(common.Hex2Bytes(test.y))
@@ -64,6 +65,7 @@ func testTwoOperandOp(t *testing.T, tests []twoOperandTest, opFn func(pc *uint64
}
}
}
+ poolOfIntPools.put(env.interpreter.intPool)
}
func TestByteOp(t *testing.T) {
@@ -71,6 +73,7 @@ func TestByteOp(t *testing.T) {
env = NewEVM(Context{}, nil, params.TestChainConfig, Config{})
stack = newstack()
)
+ env.interpreter.intPool = poolOfIntPools.get()
tests := []struct {
v string
th uint64
@@ -97,6 +100,7 @@ func TestByteOp(t *testing.T) {
t.Fatalf("Expected [%v] %v:th byte to be %v, was %v.", test.v, test.th, test.expected, actual)
}
}
+ poolOfIntPools.put(env.interpreter.intPool)
}
func TestSHL(t *testing.T) {
@@ -432,6 +436,7 @@ func TestOpMstore(t *testing.T) {
stack = newstack()
mem = NewMemory()
)
+ env.interpreter.intPool = poolOfIntPools.get()
mem.Resize(64)
pc := uint64(0)
v := "abcdef00000000000000abba000000000deaf000000c0de00100000000133700"
@@ -445,6 +450,7 @@ func TestOpMstore(t *testing.T) {
if common.Bytes2Hex(mem.Get(0, 32)) != "0000000000000000000000000000000000000000000000000000000000000001" {
t.Fatalf("Mstore failed to overwrite previous value")
}
+ poolOfIntPools.put(env.interpreter.intPool)
}
func BenchmarkOpMstore(bench *testing.B) {