Skip to content

Commit

Permalink
Try #567:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Sep 1, 2019
2 parents 179b3a3 + 9015b79 commit 645a763
Show file tree
Hide file tree
Showing 30 changed files with 2,416 additions and 438 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ backend-singlepass = [
"wasmer-wasi-tests/singlepass"
]
wasi = ["wasmer-wasi"]
managed = ["backend-singlepass", "wasmer-runtime-core/managed"]
# vfs = ["wasmer-runtime-abi"]

[[example]]
Expand Down
17 changes: 15 additions & 2 deletions examples/iterative_hash/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
use blake2::{Blake2b, Digest};
use std::time::{Duration, SystemTime};

fn main() {
let mut data: Vec<u8> = b"test".to_vec();
let now = SystemTime::now();

let mut last_millis: u128 = 0;
let mut round_count: usize = 0;
let mut record_count: usize = 0;

for i in 0.. {
let mut hasher = Blake2b::new();
hasher.input(&data);
let out = hasher.result();
data = out.to_vec();

if i % 1000000 == 0 {
println!("Round {}: {:?}", i, data);
if i != 0 && i % 1000 == 0 {
let millis = now.elapsed().unwrap().as_millis();
let diff = millis - last_millis;
if diff >= 100 {
record_count += 1;
println!("{}", (i - round_count) as f64 / diff as f64);
last_millis = millis;
round_count = i;
}
}
}
}
57 changes: 57 additions & 0 deletions examples/many_params.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
;; Test case for correctness of reading state with the presence of parameters passed on (machine) stack.
;; Usage: Run with a backend with support for OSR. Interrupt execution randomly.
;; Should see the stack frame for `$foo` to have locals `[0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 5, [5] = 6, [6] = 7, [7] = 8` with high probability.
;; If the logic for reading stack parameters is broken, it's likely to see `[0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 5, [5] = ?, [6] = ?, [7] = ?`.

(module
(import "wasi_unstable" "proc_exit" (func $__wasi_proc_exit (param i32)))
(func $long_running
(local $count i32)
(loop
(if (i32.eq (get_local $count) (i32.const 1000000)) (then (return)))
(set_local $count (i32.add (i32.const 1) (get_local $count)))
(br 0)
)
(unreachable)
)

(func $foo (param i32) (param i64) (param i32) (param i32) (param i32) (param i64) (param i64) (param i64) (result i32)
(set_local 2 (i32.const 3))
(call $long_running)
(i32.add
(i32.mul (i32.const 2) (get_local 0))
(i32.add
(i32.mul (i32.const 3) (i32.wrap/i64 (get_local 1)))
(i32.add
(i32.mul (i32.const 5) (get_local 2))
(i32.add
(i32.mul (i32.const 7) (get_local 3))
(i32.add
(i32.mul (i32.const 11) (get_local 4))
(i32.add
(i32.mul (i32.const 13) (i32.wrap/i64 (get_local 5)))
(i32.add
(i32.mul (i32.const 17) (i32.wrap/i64 (get_local 6)))
(i32.mul (i32.const 19) (i32.wrap/i64 (get_local 7)))
)
)
)
)
)
)
)
)
(func $_start (export "_start")
(local $count i32)
(loop
(if (i32.eq (get_local $count) (i32.const 10000)) (then (return)))
(set_local $count (i32.add (i32.const 1) (get_local $count)))
(call $foo (i32.const 1) (i64.const 2) (i32.const 30) (i32.const 4) (i32.const 5) (i64.const 6) (i64.const 7) (i64.const 8))
(if (i32.ne (i32.const 455))
(then unreachable)
)
(br 0)
)
(unreachable)
)
)
1 change: 1 addition & 0 deletions lib/emscripten-tests/emtests/ignores.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ test_i16_emcc_intrinsic
test_i64
test_i64_7z
test_i64_varargs
test_indirectbr_many
test_llvm_intrinsics
test_longjmp_exc
test_lower_intrinsics
Expand Down
1 change: 1 addition & 0 deletions lib/emscripten-tests/tests/emtests/test_indirectbr_many.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[test]
#[ignore]
fn test_test_indirectbr_many() {
assert_emscripten_output!(
"../../emtests/test_indirectbr_many.wasm",
Expand Down
1 change: 1 addition & 0 deletions lib/llvm-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ smallvec = "0.6.10"
goblin = "0.0.24"
libc = "0.2.60"
capstone = { version = "0.6.0", optional = true }
byteorder = "1"

[dependencies.inkwell]
git = "https://github.com/wasmerio/inkwell"
Expand Down
Loading

0 comments on commit 645a763

Please sign in to comment.