Code Monkey home page Code Monkey logo

bytebox's People

Contributors

deecellar avatar rdunnington 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

Watchers

 avatar  avatar  avatar  avatar

bytebox's Issues

Reorder run args to match wasmtime

Currently the order of args is: bytebox <FILE> [WASM_ARGS]... [OPTION].... However, wasmtime (and other runtimes) put their option args before the wasm file like so: wasmtime [OPTION]... <FILE> [WASM_ARGS].... Bytebox should match this ordering to make it easier to run as a drop-in replacement, or at the very least to make it easier to compare runtimes.

To do this, in the file run/main.zig, parseCmdOpts() will need to be updated to account for the reordering.

WASI: thread safety

The current implementation of the wasi functions are not threadsafe, as wasi file descriptors are backed by an internal data structure that isn't threadsafe, nor wrapped by any locks. This is fine for simple programs, but more complex programs that embed bytebox may invoke wasm functions from different threads. Ideally the solution will also allow compiling thread safety out if it isn't needed to avoid the overhead in single-threaded environments.

Optimization: transform stack-based bytecode to a custom register-based bytecode

Stack-based VMs have inherent performance limitations that are not present in register-based VMs. To reach or surpass performance of other WASM VMs, bytebox will need to implement a register-based VM. To do this, we will need to:

  1. Translate WASM bytecode into a sea-of-nodes IR format.
  2. Run optimization passes eliding unnecessary loads/stores as there will be many of these coming from the stack-based VM.
  3. Lower the IR to a register-based bytecode.
  4. Write a new VM capable of interpreting the new bytecode format.
    This approach will optionally allow implementation of a secondary pipeline that can JIT the IR to native asm in the future.

Write a zig program to call wast2json

A quickly-hacked together powershell script is doing the work here, but only works on windows. A zig program would be portable and could call out to either a checked-in binary or require WABT on the system if one doesn't exist for the OS.

run executable should be able to invoke function with args

wasm3 allows you to supply a wasm file and invoke a specific function, supplying it with parameteres like so:
wasm3 [options] <file> [args...]
The run exe should do the same, and utilities should be provided to autoconvert string parameters into the proper Val types the wasm function expects, if possible.

C interface

To allow for easier integration with other projects, bytebox should provide a C wrapper around the public API. Ideally this is tested with an actual integration in another project, such as wasm4.

WASI: implement the rest of preview1 functions

As of this writing, wasi-testsuite does not have full coverage of the functions in preview1, and as a result the untested functions have not been implemented. To reach parity with other runtimes, bytebox still needs to implement:

  • fd_datasync
  • fd_sync
  • path_link
  • path_readlink
  • path_rename
  • poll_oneoff
  • sched_yield
  • sock_accept
  • sock_recv
  • sock_send
  • sock_shutdown

Upgrade to latest testsuite

The current testsuite mirror is using an old version, it should be updated since the newer suite has some extra test cases and fixes for bugs in the tests.

Update build.zig to be able to invoke unit tests, wasm testsuite, and wasi testsuite

Currently zig build test runs the wasm test suite, and you have to manually invoke zig test to run unit tests. Running wasi tests is even more of a pain where you have to manually run a python command. Ideally we have a uniform interface for running all the tests from zig build:

  • zig build test: runs everything
  • zig build test-unit: only unit tests
  • zig build test-wasm: only wasm test suite
  • zig build test-wasi: only wasi test suite

WASI: add rights support

Currently the wasi_rights arg is essentially ignored for most wasi calls. To be compliant with the spec, the bytebox wasi runtime should return NOTCAPABLE when functions are called for file descriptors that don't have the particular rights. Special attention should be given to preopen rights and inheriting rights.

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.