@@ -4,15 +4,15 @@ use core::cmp::min;
4
4
use primitive_types:: { H256 , U256 } ;
5
5
6
6
#[ inline]
7
- pub fn codesize ( state : & mut Machine ) -> Control {
7
+ pub fn codesize < S > ( state : & mut Machine < S > ) -> Control {
8
8
let size = U256 :: from ( state. code . len ( ) ) ;
9
9
trace_op ! ( "CodeSize: {}" , size) ;
10
10
push_u256 ! ( state, size) ;
11
11
Control :: Continue ( 1 )
12
12
}
13
13
14
14
#[ inline]
15
- pub fn codecopy ( state : & mut Machine ) -> Control {
15
+ pub fn codecopy < S > ( state : & mut Machine < S > ) -> Control {
16
16
pop_u256 ! ( state, memory_offset, code_offset, len) ;
17
17
trace_op ! ( "CodeCopy: {}" , len) ;
18
18
@@ -27,7 +27,7 @@ pub fn codecopy(state: &mut Machine) -> Control {
27
27
}
28
28
29
29
#[ inline]
30
- pub fn calldataload ( state : & mut Machine ) -> Control {
30
+ pub fn calldataload < S > ( state : & mut Machine < S > ) -> Control {
31
31
pop_u256 ! ( state, index) ;
32
32
33
33
let mut load = [ 0u8 ; 32 ] ;
@@ -48,15 +48,15 @@ pub fn calldataload(state: &mut Machine) -> Control {
48
48
}
49
49
50
50
#[ inline]
51
- pub fn calldatasize ( state : & mut Machine ) -> Control {
51
+ pub fn calldatasize < S > ( state : & mut Machine < S > ) -> Control {
52
52
let len = U256 :: from ( state. data . len ( ) ) ;
53
53
trace_op ! ( "CallDataSize: {}" , len) ;
54
54
push_u256 ! ( state, len) ;
55
55
Control :: Continue ( 1 )
56
56
}
57
57
58
58
#[ inline]
59
- pub fn calldatacopy ( state : & mut Machine ) -> Control {
59
+ pub fn calldatacopy < S > ( state : & mut Machine < S > ) -> Control {
60
60
pop_u256 ! ( state, memory_offset, data_offset, len) ;
61
61
trace_op ! ( "CallDataCopy: {}" , len) ;
62
62
@@ -75,14 +75,14 @@ pub fn calldatacopy(state: &mut Machine) -> Control {
75
75
}
76
76
77
77
#[ inline]
78
- pub fn pop ( state : & mut Machine ) -> Control {
78
+ pub fn pop < S > ( state : & mut Machine < S > ) -> Control {
79
79
pop ! ( state, _val) ;
80
80
trace_op ! ( "Pop [@{}]: {}" , state. stack. len( ) , _val) ;
81
81
Control :: Continue ( 1 )
82
82
}
83
83
84
84
#[ inline]
85
- pub fn mload ( state : & mut Machine ) -> Control {
85
+ pub fn mload < S > ( state : & mut Machine < S > ) -> Control {
86
86
pop_u256 ! ( state, index) ;
87
87
trace_op ! ( "MLoad: {}" , index) ;
88
88
try_or_fail ! ( state. memory. resize_offset( index, U256 :: from( 32 ) ) ) ;
@@ -93,7 +93,7 @@ pub fn mload(state: &mut Machine) -> Control {
93
93
}
94
94
95
95
#[ inline]
96
- pub fn mstore ( state : & mut Machine ) -> Control {
96
+ pub fn mstore < S > ( state : & mut Machine < S > ) -> Control {
97
97
pop_u256 ! ( state, index) ;
98
98
pop ! ( state, value) ;
99
99
trace_op ! ( "MStore: {}, {}" , index, value) ;
@@ -106,7 +106,7 @@ pub fn mstore(state: &mut Machine) -> Control {
106
106
}
107
107
108
108
#[ inline]
109
- pub fn mstore8 ( state : & mut Machine ) -> Control {
109
+ pub fn mstore8 < S > ( state : & mut Machine < S > ) -> Control {
110
110
pop_u256 ! ( state, index, value) ;
111
111
try_or_fail ! ( state. memory. resize_offset( index, U256 :: one( ) ) ) ;
112
112
let index = as_usize_or_fail ! ( index) ;
@@ -118,7 +118,7 @@ pub fn mstore8(state: &mut Machine) -> Control {
118
118
}
119
119
120
120
#[ inline]
121
- pub fn jump ( state : & mut Machine ) -> Control {
121
+ pub fn jump < S > ( state : & mut Machine < S > ) -> Control {
122
122
pop_u256 ! ( state, dest) ;
123
123
let dest = as_usize_or_fail ! ( dest, ExitError :: InvalidJump ) ;
124
124
trace_op ! ( "Jump: {}" , dest) ;
@@ -131,7 +131,7 @@ pub fn jump(state: &mut Machine) -> Control {
131
131
}
132
132
133
133
#[ inline]
134
- pub fn jumpi ( state : & mut Machine ) -> Control {
134
+ pub fn jumpi < S > ( state : & mut Machine < S > ) -> Control {
135
135
pop_u256 ! ( state, dest) ;
136
136
pop ! ( state, value) ;
137
137
@@ -150,20 +150,20 @@ pub fn jumpi(state: &mut Machine) -> Control {
150
150
}
151
151
152
152
#[ inline]
153
- pub fn pc ( state : & mut Machine , position : usize ) -> Control {
153
+ pub fn pc < S > ( state : & mut Machine < S > , position : usize ) -> Control {
154
154
trace_op ! ( "PC" ) ;
155
155
push_u256 ! ( state, U256 :: from( position) ) ;
156
156
Control :: Continue ( 1 )
157
157
}
158
158
159
159
#[ inline]
160
- pub fn msize ( state : & mut Machine ) -> Control {
160
+ pub fn msize < S > ( state : & mut Machine < S > ) -> Control {
161
161
push_u256 ! ( state, state. memory. effective_len( ) ) ;
162
162
Control :: Continue ( 1 )
163
163
}
164
164
165
165
#[ inline]
166
- pub fn push ( state : & mut Machine , n : usize , position : usize ) -> Control {
166
+ pub fn push < S > ( state : & mut Machine < S > , n : usize , position : usize ) -> Control {
167
167
let end = min ( position + 1 + n, state. code . len ( ) ) ;
168
168
let slice = & state. code [ ( position + 1 ) ..end] ;
169
169
let mut val = [ 0u8 ; 32 ] ;
@@ -176,7 +176,7 @@ pub fn push(state: &mut Machine, n: usize, position: usize) -> Control {
176
176
}
177
177
178
178
#[ inline]
179
- pub fn dup ( state : & mut Machine , n : usize ) -> Control {
179
+ pub fn dup < S > ( state : & mut Machine < S > , n : usize ) -> Control {
180
180
let value = match state. stack . peek ( n - 1 ) {
181
181
Ok ( value) => value,
182
182
Err ( e) => return Control :: Exit ( e. into ( ) ) ,
@@ -187,7 +187,7 @@ pub fn dup(state: &mut Machine, n: usize) -> Control {
187
187
}
188
188
189
189
#[ inline]
190
- pub fn swap ( state : & mut Machine , n : usize ) -> Control {
190
+ pub fn swap < S > ( state : & mut Machine < S > , n : usize ) -> Control {
191
191
let val1 = match state. stack . peek ( 0 ) {
192
192
Ok ( value) => value,
193
193
Err ( e) => return Control :: Exit ( e. into ( ) ) ,
@@ -209,7 +209,7 @@ pub fn swap(state: &mut Machine, n: usize) -> Control {
209
209
}
210
210
211
211
#[ inline]
212
- pub fn ret ( state : & mut Machine ) -> Control {
212
+ pub fn ret < S > ( state : & mut Machine < S > ) -> Control {
213
213
trace_op ! ( "Return" ) ;
214
214
pop_u256 ! ( state, start, len) ;
215
215
try_or_fail ! ( state. memory. resize_offset( start, len) ) ;
@@ -218,7 +218,7 @@ pub fn ret(state: &mut Machine) -> Control {
218
218
}
219
219
220
220
#[ inline]
221
- pub fn revert ( state : & mut Machine ) -> Control {
221
+ pub fn revert < S > ( state : & mut Machine < S > ) -> Control {
222
222
trace_op ! ( "Revert" ) ;
223
223
pop_u256 ! ( state, start, len) ;
224
224
try_or_fail ! ( state. memory. resize_offset( start, len) ) ;
0 commit comments