Skip to content

A simple implementation of some string functions from libc in WebAssembly.

License

Notifications You must be signed in to change notification settings

anachan01h/string-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple implementation of some string functions from libc in WebAssembly.

Modules

Contains a simple implementation of strcat, strcmp, strcpy and strlen functions from libc.

For now, contains only an optimized version of strlen function, that reads four bytes per iteration.

Building and Testing

Prerequisites:

  • wat2wasm (from WebAssembly Binary Toolkit)
  • Node.js (only for running tests)

Build .wasm files

To build string.wasm:

$ wat2wasm -o build/string.wasm src/string.wat

To build string_opt.wasm:

$ wat2wasm -o build/string_opt.wasm src/string_opt.wat

Or build the two using Makefile:

$ make all

Test the .wasm modules

First, build the tests.wasm module:

$ wat2wasm -o tests/tests.wasm tests/tests.wat

Then, run the tests with Node.js:

$ node tests/tests.js

Note: For now, only string.wasm is tested.

Build .wasm files and run tests (using Makefile)

$ make tests