Skip to content
This repository was archived by the owner on Jan 5, 2019. It is now read-only.

Commit 6a24b67

Browse files
committed
More logic cleanup
1 parent c5c9b2e commit 6a24b67

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

wasm/generateInterface.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -334,20 +334,16 @@ function generateManifest (interfaceManifest, opts) {
334334
call += '(get_local $callback)'
335335
}
336336

337+
let wrapper
337338
if (opcode === 'CALL' || opcode === 'CALLCODE' || opcode === 'DELEGATECALL') {
338-
call =
339-
`(i64.store
340-
(i32.add (get_global $sp) (i32.const ${spOffset * 32}))
341-
(i64.extend_u/i32
342-
(i32.eqz ${call}) ;; flip CALL result from EEI to EVM convention (0 -> 1, 1,2,.. -> 1)
343-
)))`
339+
// flip CALL result from EEI to EVM convention (0 -> 1, 1,2,.. -> 0)
340+
wrapper = `(i32.eqz ${call})`
344341
} else {
345-
call =
346-
`(i64.store
347-
(i32.add (get_global $sp) (i32.const ${spOffset * 32}))
348-
(i64.extend_u/i32
349-
${call})))`
342+
wrapper = call
350343
}
344+
call = `(i64.store
345+
(i32.add (get_global $sp) (i32.const ${spOffset * 32}))
346+
(i64.extend_u/i32 ${wrapper})))`
351347

352348
call += `
353349
;; zero out mem

0 commit comments

Comments
 (0)