This repository was archived by the owner on Jan 5, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,14 @@ function checkOverflowStackItem256 (spOffset) {
222222 (i64.load (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 3 } ))))`
223223}
224224
225+ // assumes the stack contains 160 bits of value and clears the rest
226+ function cleanupStackItem160 ( spOffset ) {
227+ return `
228+ ;; zero out mem
229+ (i64.store (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 3 } )) (i64.const 0))
230+ (i32.store (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 2 + 4 } )) (i32.const 0))`
231+ }
232+
225233// assumes the stack contains 128 bits of value and clears the rest
226234function cleanupStackItem128 ( spOffset ) {
227235 return `
@@ -383,11 +391,8 @@ function generateManifest (interfaceManifest, opts) {
383391 call += '(get_local $callback)'
384392 }
385393
386- // FIXME: implement support in cleanupStackItem160
387- call += `)
388- ;; zero out mem
389- (i64.store (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 3 } )) (i64.const 0))
390- (i32.store (i32.add (get_global $sp) (i32.const ${ spOffset * 32 + 8 * 2 + 4 } )) (i32.const 0))`
394+ call += ')'
395+ call += cleanupStackItem160 ( spOffset )
391396 } else if ( output === 'i256' ) {
392397 call = `${ call }
393398 (i32.add (get_global $sp)
You can’t perform that action at this time.
0 commit comments