Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
[Docs] Update README for renaming ssvm to WasmEdge
Browse files Browse the repository at this point in the history
  • Loading branch information
hydai authored and dm4 committed Oct 8, 2021
1 parent 803d935 commit 7c79281
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Second State WebAssembly VM for Node.js Addon
# WasmEdge for Node.js Addon

The [Second State VM (SSVM)](https://github.com/second-state/ssvm) is a high-performance WebAssembly runtime optimized for server-side applications. This project provides support for accessing SSVM as a Node.js addon. It allows Node.js applications to call WebAssembly functions written in Rust or other high-performance languages. [Why do you want to run WebAssembly on the server-side?](https://cloud.secondstate.io/server-side-webassembly/why) The SSVM addon could interact with the wasm files generated by the [ssvmup](https://github.com/second-state/ssvmup) compiler tool.
The [WasmEdge (previously known as Second State VM, SSVM)](https://github.com/WasmEdge/WasmEdge) is a high-performance WebAssembly runtime optimized for server-side applications. This project provides support for accessing WasmEdge as a Node.js addon. It allows Node.js applications to call WebAssembly functions written in Rust or other high-performance languages. [Why do you want to run WebAssembly on the server-side?](https://cloud.secondstate.io/server-side-webassembly/why) The WasmEdge addon could interact with the wasm files generated by the [rustwasmc](https://github.com/second-state/rustwasmc) compiler tool.

## NOTICE

SSVM Node.js Addon is in active development.

In the current stage, our prebuilt version **only supports** x86\_64 and aarch64 Linux.
Or you could use `--build-from-source` flag to build from source during addon installation.

## Requirements
Or you could use `--build-from-source` flag to build from the source during addon installation.

After SSVM Napi 0.4.0 release, we upgrade the base image from `Ubuntu 18.04` to `Ubuntu 20.04`.
## Development Requirements

Users should install the dependencies by the following requirments:

Expand All @@ -21,38 +17,40 @@ Users should install the dependencies by the following requirments:
* libstdc++6 >= 6.0.28 (GLIBCXX >= 3.4.28)
* g++ version >= 9.0 (Optional, if you have to build from source)

## Prepare environment
## Prepare the environment

### Use our docker image (recommended)

```bash
$ docker pull secondstate/ssvm
docker pull wasmedge/wasmedge
```

### For ubuntu 20.04

```bash
# Tools and libraries
$ sudo apt install -y \
sudo apt install -y \
software-properties-common \
cmake \
libboost-all-dev

# And you will need to install llvm for ssvm-aot tools
$ sudo apt install -y \
# And you will need to install llvm for wasmedge-aot tools
sudo apt install -y \
llvm-dev \
liblld-10-dev

# SSVM supports both clang++ and g++ compilers
# WasmEdge supports both clang++ and g++ compilers
# You can choose one of them for building this project
$ sudo apt install -y gcc g++
$ sudo apt install -y clang
sudo apt install -y gcc g++
sudo apt install -y clang
```

### Verify the version of llvm

```bash
$ sudo apt list | grep llvm
sudo apt list | grep llvm

# Expected output
...omitted...
llvm-dev/focal,now 1:10.0-50~exp1 amd64 [installed]
llvm-runtime/focal,now 1:10.0-50~exp1 amd64 [installed,automatic]
Expand All @@ -65,7 +63,9 @@ llvm/focal,now 1:10.0-50~exp1 amd64 [installed,automatic]
### Verify the version of libstdc++6

```bash
$ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX

# Expected output
...omitted...
GLIBCXX_3.4.24
GLIBCXX_3.4.25
Expand All @@ -87,24 +87,24 @@ Please refer to [Tutorial: A standalone wasm32-wasi application](./Tutorial_Wasm

## APIs

### Constructor: `ssvm.VM(wasm, ssvm_options) -> vm_instance`
* Create a ssvm instance by given wasm file and options.
### Constructor: `wasmedge.VM(wasm, wasmedge_options) -> vm_instance`
* Create a WasmEdge instance by given wasm file and options.
* Arguments:
* `wasm`: Input wasm file, can be the following three formats:
1. Wasm file path (String, e.g. `/tmp/hello.wasm`)
2. Wasm bytecode format which is the content of a wasm binary file (Uint8Array)
* `options`: An options object for setup the SSVM execution environment.
* `options`: An options object for setup the WasmEdge execution environment.
* `options` <JS Object>
* `args` <JS Array>: An array of strings that Wasm application will get as function arguments. Default: `[]`.
* `args` <JS Array>: An array of strings that the Wasm application will get as function arguments. Default: `[]`.
* `env` <JS Object>: An object like `process.env` that Wasm application will get as its environment variables. Default: `{}`.
* `preopens` <JS Object>: An object which maps '<guest_path>:<host_path>'. E.g. `{'/sandbox': '/some/real/path/that/wasm/can/access'}` Default: `{}`.
* `EnableWasiStartFunction` <Boolean>: This option will disable wasm-bindgen mode and prepare the working environment for standalone wasm program. If you want to run an appliation with `main()`, you should set this to `true`. Default: `false`.
* `EnableAOT` <Boolean>: This option will enable ssvm aot mode. Default: `false`.
* `EnableWasiStartFunction` <Boolean>: This option will disable wasm-bindgen mode and prepare the working environment for the standalone wasm program. If you want to run an application with `main()`, you should set this to `true`. Default: `false`.
* `EnableAOT` <Boolean>: This option will enable WasmEdge AoT mode. Default: `false`.
* `EnableMeasurement` <Boolean>: This option will enable measurement but decrease its performance. Default: `false`.
* `AllowCommands` <JS Array>: An array of strings that indicate what commands are allowed to execute in the SSVM Process Module. Default `[]`.
* `AllowAllCommands` <Boolean>: Allow users to call any command in the SSVM Process Module. This option will overwrite the `AllowCommands`. Default: `false`.
* `AllowCommands` <JS Array>: An array of strings that indicate what commands are allowed to execute in the WasmEdge Process Module. Default `[]`.
* `AllowAllCommands` <Boolean>: Allow users to call any command in the WasmEdge Process Module. This option will overwrite the `AllowCommands`. Default: `false`.
* Return value:
* `vm_instance`: A ssvm instance.
* `vm_instance`: A WasmEdge instance.

### Methods

Expand Down Expand Up @@ -195,15 +195,15 @@ let result = RunUint8Array("Hash", "Hello, world!");

#### `Compile(output_filename) -> boolean`
* Compile a given wasm file (can be a file path or a byte array) into a native binary whose name is the given `output_filename`.
* This function uses SSVM AOT compiler.
* This function uses WasmEdge AoT compiler.
* Return `false` when the compilation failed.
```javascript
// Compile only
let vm = ssvm.VM("/path/to/wasm/file", options);
let vm = wasmedge.VM("/path/to/wasm/file", options);
vm.Compile("/path/to/aot/file");

// When you want to run the compiled file
let vm = ssvm.VM("/path/to/aot/file", options);
let vm = wasmedge.VM("/path/to/aot/file", options);
vm.RunXXX("Func", args);
```

Expand Down

0 comments on commit 7c79281

Please sign in to comment.