Coder Social home page Coder Social logo

twvm's Introduction

TWVM

TWVM is still under continuously construction, not production-ready yet!

GitHub Actions status

A tiny, lightweight, and efficient WebAssembly virtual machine.

Getting Started

Compile & Install

Please install the following softwares beforehand:

Then, run the following command to compile and install:

npm run build

How to use?

You can use the below command to invoke an exported function from a WebAssemly binary module:

# Invoke function `fib` with value 10.
twvm ./tests/modules/fibonacci.wasm -i=fib,10  # 55.

For further information, please run the below command for help:

twvm -h

Other Information

  • Limitations:

Currently, TWVM can only run standard WebAssembly binary modules with the instructions in MVP standard. Also, please make sure the module doesn't require any import objects (.e.g memory, function, table, and etc).

  • Memory Check:

Install "valgrind" on MacOS according to the following articles first:

How to Install Valgrind on macOS High Sierra

Valgrind on macOS 10.14/10.15

And then, run the below command to check the memory leak of the program:

npm run memcheck

Roadmap

  • Architecture refactoring.
  • Run simple fibonacci function successfully.
  • Full Wasm spec version 1.0 support.
  • Pass all basic testcases.
  • DCT optimization.
  • WAT support.

Copyright and License

Licensed under the MIT License.

twvm's People

Contributors

becavalier avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

twvm's Issues

Add some examples and guidelines

I have compile the project successfully but I can't find some guides to play with it.

I just build a hello.c with emscripten to hello.wasm, and then it fails..

twvm --debug hello.wasm

//////    //    //
  // //  ////  ////
  //  ////  ////  //
  //   //    //    //

  V.under-construction

twvm: info: - [LOADING PHASE] -
twvm: info: parsing type section.
twvm: info: parsing import section.
twvm: info: parsing function section.
twvm: info: parsing table section.
twvm: info: parsing memory section.
twvm: info: parsing global section.
twvm: info: parsing export section.
twvm: info: parsing element section.
twvm: info: parsing code section.
twvm: error: invalid opcode found.

Consider TTC instead of DCT?

With TTC, we can have a much more compact action frame that replaces the current 64bytes address value with an uint32_t relative offset.

TODO: Abstraction.

  1. Separating the whole arch into different abstractions.
  2. Adding sound type check analysis.
  3. etc.

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.