Giter Site home page Giter Site logo

wasm-rust-chibiwasm-rs's Introduction

chibiwasm

This repository was created for the purpose of learning how Wasm works. Please do not use it in production.

Usage

$ cat
(module
  (func $add (export "add") (param i32 i32) (result i32)
    (local.get 0)
    (local.get 1)
    (i32.add)
  )
)
$ wat2wasm add.wat
$ cargo run -- add.wasm add 1 2
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/chibiwasm add.wasm add 1 2`
3

Use as a crate

use chibiwasm::{Runtime, Value};

fn main() -> anyhow::Result<()> {
    let mut runtime = Runtime::from_file("examples/fib.wasm", None)?;
    if let Some(output) = runtime.call("fib".into(), vec![Value::I32(10)])? {
        println!("output: {}", output);
    }
    Ok(())
}
$ cargo run -q --example fib
output: 89

Test

$ cargo make test

Spec

Base on core 1.

https://www.w3.org/TR/wasm-core-1/

tests

The list is base on https://github.com/WebAssembly/spec/tree/wg-1.0/test/core

NOTE: Checking only the test cases that have passed both assert_return and assert_trap.

  • address.wast
  • align.wast
  • binary_leb128.wast
  • binary.wast
  • block.wast
  • br.wast
  • br_if.wast
  • br_table.wast
  • break_drop.wast
  • call.wast
  • call_indirect.wast
  • comments.wast
  • const.wast
  • conversions.wast
  • custom.wast
  • data.wast
  • elem.wast
  • endianness.wast
  • exports.wast
  • f32.wast
  • f32_bitwise.wast
  • f32_cmp.wast
  • f64.wast
  • f64_bitwise.wast
  • f64_cmp.wast
  • fac.wast
  • float_exprs.wast
  • float_literals.wast
  • float_memory.wast
  • float_misc.wast
  • forward.wast
  • func.wast
  • func_ptrs.wast
  • globals.wast
  • i32.wast
  • i64.wast
  • if.wast
  • imports.wast
  • inline_module.wast
  • int_exprs.wast
  • int_literals.wast
  • labels.wast
  • left_to_right.wast
  • linking.wast
  • load.wast
  • local_get.wast
  • local_set.wast
  • local_tee.wast
  • loop.wast
  • memory.wast
  • memory_grow.wast
  • memory_redundancy.wast
  • memory_size.wast
  • memory_trap.wast
  • names.wast
  • nop.wast
  • return.wast
  • select.wast
  • skip_stack_guard_page.wast
  • stack.wast
  • start.wast
  • store.wast
  • switch.wast
  • token.wast
  • traps.wast
  • type.wast
  • unreachable.wast
  • unreached_invalid.wast
  • unwind.wast
  • utf8_custom_section_id.wast
  • utf8_import_field.wast
  • utf8_import_module.wast
  • utf8_invalid_encoding.wast

LICENSE

This software includes the work that is distributed in the Apache License 2.0.

wasm-rust-chibiwasm-rs's People

Contributors

dependabot[bot] avatar skanehira avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.