wasm-utils/samples/empty_contract.rs

27 lines
615 B
Rust
Raw Normal View History

2017-05-04 10:36:49 +03:00
#![feature(link_args)]
#![no_main]
// as it is experimental preamble
#![allow(dead_code)]
2017-05-04 10:38:59 +03:00
#[link_args = "-s WASM=1 -s NO_EXIT_RUNTIME=1 -s NO_FILESYSTEM=1"]
2017-05-04 10:36:49 +03:00
extern {}
#[no_mangle]
pub fn call() {
2017-05-04 10:38:04 +03:00
}
/* This produces the following code (after injecting gas counter & optimizing)
(module
2017-05-04 12:16:45 +03:00
(type (;0;) (func))
(type (;1;) (func (param i32)))
2017-05-04 10:38:04 +03:00
(import "env" "memory" (memory (;0;) 256 256))
(import "env" "table" (table (;0;) 0 0 anyfunc))
2017-05-04 12:16:45 +03:00
(import "env" "gas" (func (;0;) (type 1)))
(func (;1;) (type 0)
2017-05-04 10:38:04 +03:00
i32.const 2
call 0
nop)
(export "_call" (func 1))
(data (i32.const 1212) "\1c\05"))
*/