mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-04-29 12:37:56 +00:00
organizing samples
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
int ops = 0;
|
||||
|
||||
void log(int block_ops) {
|
||||
ops += block_ops;
|
||||
}
|
||||
|
||||
int call(int x) {
|
||||
log(5);
|
||||
return 2 * x;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#![feature(link_args)]
|
||||
#![feature(drop_types_in_const)]
|
||||
#![no_main]
|
||||
|
||||
#[link_args = "-s WASM=1 -s NO_EXIT_RUNTIME=1 -s NO_FILESYSTEM=1"]
|
||||
extern {}
|
||||
|
||||
static mut DATA: Option<Vec<u8>> = None;
|
||||
|
||||
#[no_mangle]
|
||||
pub fn call() {
|
||||
let mut vec = Vec::new();
|
||||
unsafe { if let Some(ref v) = DATA { vec.extend(v); }; }
|
||||
vec.push(1u8);
|
||||
unsafe {
|
||||
DATA = Some(vec);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user