Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
a0f77719
Unverified
Commit
a0f77719
authored
Dec 03, 2021
by
Alex Beregszaszi
Committed by
GitHub
Dec 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/vm: remove stack.pushN (#24040)
parent
5e78fc03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
instructions_test.go
core/vm/instructions_test.go
+8
-4
stack.go
core/vm/stack.go
+0
-4
No files found.
core/vm/instructions_test.go
View file @
a0f77719
...
...
@@ -525,12 +525,14 @@ func TestOpMstore(t *testing.T) {
mem
.
Resize
(
64
)
pc
:=
uint64
(
0
)
v
:=
"abcdef00000000000000abba000000000deaf000000c0de00100000000133700"
stack
.
pushN
(
*
new
(
uint256
.
Int
)
.
SetBytes
(
common
.
Hex2Bytes
(
v
)),
*
new
(
uint256
.
Int
))
stack
.
push
(
new
(
uint256
.
Int
)
.
SetBytes
(
common
.
Hex2Bytes
(
v
)))
stack
.
push
(
new
(
uint256
.
Int
))
opMstore
(
&
pc
,
evmInterpreter
,
&
ScopeContext
{
mem
,
stack
,
nil
})
if
got
:=
common
.
Bytes2Hex
(
mem
.
GetCopy
(
0
,
32
));
got
!=
v
{
t
.
Fatalf
(
"Mstore fail, got %v, expected %v"
,
got
,
v
)
}
stack
.
pushN
(
*
new
(
uint256
.
Int
)
.
SetUint64
(
0x1
),
*
new
(
uint256
.
Int
))
stack
.
push
(
new
(
uint256
.
Int
)
.
SetUint64
(
0x1
))
stack
.
push
(
new
(
uint256
.
Int
))
opMstore
(
&
pc
,
evmInterpreter
,
&
ScopeContext
{
mem
,
stack
,
nil
})
if
common
.
Bytes2Hex
(
mem
.
GetCopy
(
0
,
32
))
!=
"0000000000000000000000000000000000000000000000000000000000000001"
{
t
.
Fatalf
(
"Mstore failed to overwrite previous value"
)
...
...
@@ -553,7 +555,8 @@ func BenchmarkOpMstore(bench *testing.B) {
bench
.
ResetTimer
()
for
i
:=
0
;
i
<
bench
.
N
;
i
++
{
stack
.
pushN
(
*
value
,
*
memStart
)
stack
.
push
(
value
)
stack
.
push
(
memStart
)
opMstore
(
&
pc
,
evmInterpreter
,
&
ScopeContext
{
mem
,
stack
,
nil
})
}
}
...
...
@@ -572,7 +575,8 @@ func BenchmarkOpKeccak256(bench *testing.B) {
bench
.
ResetTimer
()
for
i
:=
0
;
i
<
bench
.
N
;
i
++
{
stack
.
pushN
(
*
uint256
.
NewInt
(
32
),
*
start
)
stack
.
push
(
uint256
.
NewInt
(
32
))
stack
.
push
(
start
)
opKeccak256
(
&
pc
,
evmInterpreter
,
&
ScopeContext
{
mem
,
stack
,
nil
})
}
}
...
...
core/vm/stack.go
View file @
a0f77719
...
...
@@ -54,10 +54,6 @@ func (st *Stack) push(d *uint256.Int) {
// NOTE push limit (1024) is checked in baseCheck
st
.
data
=
append
(
st
.
data
,
*
d
)
}
func
(
st
*
Stack
)
pushN
(
ds
...
uint256
.
Int
)
{
// FIXME: Is there a way to pass args by pointers.
st
.
data
=
append
(
st
.
data
,
ds
...
)
}
func
(
st
*
Stack
)
pop
()
(
ret
uint256
.
Int
)
{
ret
=
st
.
data
[
len
(
st
.
data
)
-
1
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment