Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pepyakin committed Jan 17, 2018
0 parents commit 49347a6
Show file tree
Hide file tree
Showing 48 changed files with 73,337 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

/target/
**/*.rs.bk
Cargo.lock
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "parity-wasm-interp"
version = "0.1.0"
authors = ["Sergey Pepyakin <[email protected]>"]

[dependencies]
# parity-wasm = "0.20"
parity-wasm = { path = "/Users/pepyakin/dev/parity/parity-wasm" }
wabt = "0.1"
byteorder = "1.0"
Binary file added res/cases/v1/accumulate_u8.wasm
Binary file not shown.
94 changes: 94 additions & 0 deletions res/cases/v1/accumulate_u8.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
;; /// @file accumulate_u8.cpp
;; #include <emscripten.h> // macro EMSCRIPTEN_KEEPALIVE
;; #include <stdint.h>
;; #include <vector>
;; #include <numeric>
;; extern "C" {
;; int32_t EMSCRIPTEN_KEEPALIVE accumulate_u8(const int32_t arlen, const uint8_t *ar) {
;; int32_t arsum = 0;
;; for (int32_t i=0; i<arlen; ++i)
;; arsum += (int32_t) ar[i];
;; return arsum;
;; }
;; } // extern "C"
(module
(type $0 (func (param i32 i32) (result i32)))
(type $1 (func))
(import "env" "memoryBase" (global $import$0 i32))
(import "env" "memory" (memory $0 256))
(import "env" "table" (table 0 anyfunc))
(import "env" "tableBase" (global $import$3 i32))
(global $global$0 (mut i32) (i32.const 0))
(global $global$1 (mut i32) (i32.const 0))
(export "__post_instantiate" (func $2))
(export "_accumulate_u8" (func $0))
(func $0 (type $0) (param $var$0 i32) (param $var$1 i32) (result i32)
(local $var$2 i32)
(local $var$3 i32)
(block $label$0 (result i32)
(if
(i32.gt_s
(get_local $var$0)
(i32.const 0)
)
(block $label$1
(set_local $var$2
(i32.const 0)
)
(set_local $var$3
(i32.const 0)
)
)
(block $label$2
(return
(i32.const 0)
)
)
)
(loop $label$3
(set_local $var$3
(i32.add
(i32.load8_u
(i32.add
(get_local $var$1)
(get_local $var$2)
)
)
(get_local $var$3)
)
)
(br_if $label$3
(i32.ne
(tee_local $var$2
(i32.add
(get_local $var$2)
(i32.const 1)
)
)
(get_local $var$0)
)
)
)
(get_local $var$3)
)
)
(func $1 (type $1)
(nop)
)
(func $2 (type $1)
(block $label$0
(set_global $global$0
(get_global $import$0)
)
(set_global $global$1
(i32.add
(get_global $global$0)
(i32.const 5242880)
)
)
(call $1)
)
)
;; custom section "dylink", size 5
)

Binary file added res/cases/v1/const.wasm
Binary file not shown.
24 changes: 24 additions & 0 deletions res/cases/v1/const.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(module
(type (;0;) (func (result i32)))
(func (;0;) (type 0) (result i32)
i64.const 9223372036854775807
i64.const -9223372036854775808
i64.const -1152894205662152753
i64.const -8192
i32.const 1024
i32.const 2048
i32.const 4096
i32.const 8192
i32.const 16384
i32.const 32767
i32.const -1024
i32.const -2048
i32.const -4096
i32.const -8192
i32.const -16384
i32.const -32768
i32.const -2147483648
i32.const 2147483647
return
)
)
Binary file added res/cases/v1/hello.wasm
Binary file not shown.
Loading

0 comments on commit 49347a6

Please sign in to comment.