Last active
September 4, 2018 11:09
-
-
Save iamtakingiteasy/23628ba2c3689858ba407ae9c0227633 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define EXPORT __attribute__((used)) __attribute__ ((visibility ("default"))) | |
| #define NULL ((void*)0) | |
| extern void _console_log(void *ptr, int length); | |
| EXPORT int foo(int tag, ...) { | |
| _console_log(NULL, (int)&tag); | |
| return tag+1; | |
| } | |
| EXPORT void init() { | |
| foo(231, 1, 2, 3); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (module | |
| (type (;0;) (func (param i32 i32))) | |
| (type (;1;) (func (param i32 i32) (result i32))) | |
| (type (;2;) (func)) | |
| (import "env" "memory" (memory (;0;) 32 32)) | |
| (import "env" "STACKTOP" (global (;0;) i32)) | |
| (import "env" "__console_log" (func (;0;) (type 0))) | |
| (func (;1;) (type 1) (param i32 i32) (result i32) | |
| get_global 1 | |
| set_local 1 | |
| get_global 1 | |
| i32.const 16 | |
| i32.add | |
| set_global 1 | |
| get_local 1 | |
| get_local 0 | |
| i32.store | |
| i32.const 0 | |
| get_local 1 | |
| call 0 | |
| get_local 1 | |
| i32.load | |
| i32.const 1 | |
| i32.add | |
| set_local 0 | |
| get_local 1 | |
| set_global 1 | |
| get_local 0) | |
| (func (;2;) (type 2) | |
| (local i32) | |
| get_global 1 | |
| set_local 0 | |
| get_global 1 | |
| i32.const 16 | |
| i32.add | |
| set_global 1 | |
| get_local 0 | |
| i32.const 1 | |
| i32.store | |
| get_local 0 | |
| i32.const 2 | |
| i32.store offset=4 | |
| get_local 0 | |
| i32.const 3 | |
| i32.store offset=8 | |
| i32.const 231 | |
| get_local 0 | |
| call 1 | |
| drop | |
| get_local 0 | |
| set_global 1) | |
| (global (;1;) (mut i32) (get_global 0)) | |
| (export "_foo" (func 1)) | |
| (export "_init" (func 2))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment