good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
a289a77d
Commit
a289a77d
authored
Aug 21, 2014
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
DUP n SWAP n
parent
3def9258
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ethvm/stack.go
+12
-0
12 additions, 0 deletions
ethvm/stack.go
ethvm/types.go
+34
-0
34 additions, 0 deletions
ethvm/types.go
ethvm/vm.go
+12
-8
12 additions, 8 deletions
ethvm/vm.go
peer.go
+1
-1
1 addition, 1 deletion
peer.go
with
59 additions
and
9 deletions
ethvm/stack.go
+
12
−
0
View file @
a289a77d
...
...
@@ -64,6 +64,18 @@ func (st *Stack) Peekn() (*big.Int, *big.Int) {
return
ints
[
0
],
ints
[
1
]
}
func
(
st
*
Stack
)
Swapn
(
n
int
)
(
*
big
.
Int
,
*
big
.
Int
)
{
st
.
data
[
n
],
st
.
data
[
0
]
=
st
.
data
[
0
],
st
.
data
[
n
]
return
st
.
data
[
n
],
st
.
data
[
0
]
}
func
(
st
*
Stack
)
Dupn
(
n
int
)
*
big
.
Int
{
st
.
Push
(
st
.
data
[
n
])
return
st
.
Peek
()
}
func
(
st
*
Stack
)
Push
(
d
*
big
.
Int
)
{
st
.
data
=
append
(
st
.
data
,
new
(
big
.
Int
)
.
Set
(
d
))
}
...
...
This diff is collapsed.
Click to expand it.
ethvm/types.go
+
34
−
0
View file @
a289a77d
...
...
@@ -105,6 +105,40 @@ const (
PUSH31
=
0x7e
PUSH32
=
0x7f
DUP1
=
0x80
DUP2
=
0x81
DUP3
=
0x82
DUP4
=
0x83
DUP5
=
0x84
DUP6
=
0x85
DUP7
=
0x86
DUP8
=
0x87
DUP9
=
0x88
DUP10
=
0x89
DUP11
=
0x8a
DUP12
=
0x8b
DUP13
=
0x8c
DUP14
=
0x8d
DUP15
=
0x8e
DUP16
=
0x8f
SWAP1
=
0x90
SWAP2
=
0x91
SWAP3
=
0x92
SWAP4
=
0x93
SWAP5
=
0x94
SWAP6
=
0x95
SWAP7
=
0x96
SWAP8
=
0x97
SWAP9
=
0x98
SWAP10
=
0x99
SWAP11
=
0x9a
SWAP12
=
0x9b
SWAP13
=
0x9c
SWAP14
=
0x9d
SWAP15
=
0x9e
SWAP16
=
0x9f
// 0xf0 range - closures
CREATE
=
0xf0
CALL
=
0xf1
...
...
This diff is collapsed.
Click to expand it.
ethvm/vm.go
+
12
−
8
View file @
a289a77d
...
...
@@ -600,16 +600,20 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
case
POP
:
require
(
1
)
stack
.
Pop
()
case
DUP
:
require
(
1
)
stack
.
Push
(
stack
.
Peek
())
case
DUP1
,
DUP2
,
DUP3
,
DUP4
,
DUP5
,
DUP6
,
DUP7
,
DUP8
,
DUP9
,
DUP10
,
DUP11
,
DUP12
,
DUP13
,
DUP14
,
DUP15
,
DUP16
:
n
:=
int
(
op
-
DUP1
+
1
)
stack
.
Dupn
(
n
)
self
.
Printf
(
" => [%d] 0x%x"
,
n
,
stack
.
Peek
()
.
Bytes
())
case
SWAP1
,
SWAP2
,
SWAP3
,
SWAP4
,
SWAP5
,
SWAP6
,
SWAP7
,
SWAP8
,
SWAP9
,
SWAP10
,
SWAP11
,
SWAP12
,
SWAP13
,
SWAP14
,
SWAP15
,
SWAP16
:
n
:=
int
(
op
-
SWAP1
+
1
)
x
,
y
:=
stack
.
Swapn
(
n
)
self
.
Printf
(
" => 0x%x"
,
stack
.
Peek
()
.
Bytes
())
self
.
Printf
(
" => [%d] %x [0] %x"
,
n
,
x
.
Bytes
(),
y
.
Bytes
())
case
DUP
:
// NOP
case
SWAP
:
require
(
2
)
x
,
y
:=
stack
.
Popn
()
stack
.
Push
(
y
)
stack
.
Push
(
x
)
// NOP
case
MLOAD
:
require
(
1
)
offset
:=
stack
.
Pop
()
...
...
This diff is collapsed.
Click to expand it.
peer.go
+
1
−
1
View file @
a289a77d
...
...
@@ -24,7 +24,7 @@ const (
// The size of the output buffer for writing messages
outputBufferSize
=
50
// Current protocol version
ProtocolVersion
=
2
7
ProtocolVersion
=
2
8
// Interval for ping/pong message
pingPongTimer
=
2
*
time
.
Second
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment