@@ -248,7 +248,7 @@ function generateManifest (interfaceManifest, opts) {
248
248
(i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 } )))
249
249
(i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 2 } )))
250
250
(i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 3 } ))))`
251
- } else if ( input === 'i64' && opcode !== 'CALL' ) {
251
+ } else if ( input === 'i64' ) {
252
252
call += `(call $check_overflow_i64
253
253
(i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 } )))
254
254
(i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 } )))
@@ -263,11 +263,7 @@ function generateManifest (interfaceManifest, opts) {
263
263
(i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 2 } )))
264
264
(i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 3 } )))))`
265
265
call += `(get_local $offset${ numOfLocals } )`
266
- } else if ( input === 'length' && ( opcode === 'CALL' || opcode === 'CALLCODE' ) ) {
267
- // CALLs in EVM have 7 arguments
268
- // but in ewasm CALLs only have 5 arguments
269
- // so delete the bottom two stack elements, after processing the 5th argument
270
-
266
+ } else if ( input === 'length' ) {
271
267
locals += `(local $length${ numOfLocals } i32)`
272
268
body += `(set_local $length${ numOfLocals }
273
269
(call $check_overflow
@@ -282,25 +278,13 @@ function generateManifest (interfaceManifest, opts) {
282
278
call += `(get_local $length${ numOfLocals } )`
283
279
numOfLocals ++
284
280
285
- // delete 6th stack element
286
- spOffset --
287
-
288
- // delete 7th stack element
289
- spOffset --
290
- } else if ( input === 'length' && ( opcode !== 'CALL' && opcode !== 'CALLCODE' ) ) {
291
- locals += `(local $length${ numOfLocals } i32)`
292
- body += `(set_local $length${ numOfLocals }
293
- (call $check_overflow
294
- (i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 } )))
295
- (i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 } )))
296
- (i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 2 } )))
297
- (i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 3 } )))))
298
-
299
- (call $memusegas (get_local $offset${ numOfLocals } ) (get_local $length${ numOfLocals } ))
300
- (set_local $offset${ numOfLocals } (i32.add (get_global $memstart) (get_local $offset${ numOfLocals } )))`
301
-
302
- call += `(get_local $length${ numOfLocals } )`
303
- numOfLocals ++
281
+ // CALLs in EVM have 7 arguments
282
+ // but in ewasm CALLs only have 5 arguments
283
+ // so delete the bottom two stack elements, after processing the 5th argument
284
+ if ( opcode === 'CALL' || opcode === 'CALLCODE' ) {
285
+ spOffset --
286
+ spOffset --
287
+ }
304
288
}
305
289
spOffset --
306
290
} )
0 commit comments