Skip to content

Conversation

@stupendoussuperpowers
Copy link
Contributor

Closes: #2

@@ -0,0 +1,4 @@
#!/bin/bash

/home/lind/lind-wasm/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin/clang -pthread --target=wasm32-unknown-wasi --sysroot /home/lind/lind-wasm/src/glibc/sysroot -Wl,--import-memory,--export-memory,--max-memory=1570242560,--export=signal_callback,--export=__stack_pointer,--export=__stack_low,--export=open_grate,--export=close_grate,--export=lseek_grate,--export=read_grate,--export=write_grate,--export=fcntl_grate,--export-table imfs_grate.c imfs.c -g -DLIB -DDIAG -D_GNU_SOURCE -O0 -o imfs_grate.wasm && /home/lind/lind-wasm/tools/binaryen/bin/wasm-opt --epoch-injection --asyncify -O2 --debuginfo imfs_grate.wasm -o imfs_grate.wasm && /home/lind/lind-wasm/src/wasmtime/target/release/wasmtime compile imfs_grate.wasm -o imfs_grate.cwasm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this custom per grate or extensible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now it is per grate since we need to specify which grate functions are exported. I believe Alice is working on a way around this, so that we don't need to do function dispatches based on exports.

Copy link

@marcelamelara marcelamelara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've reviewed the README, and have a few places where I think clarification would help. I also think we should revisit some default settings, if possible.

- Fix comments on the README

- Working version compatible with lind-wasm changes

- New folder structure + compile script for grates

- Add tests, remove random logs

- clang-format
@stupendoussuperpowers
Copy link
Contributor Author

Re-requesting review from @rennergade and @Yaxuan-w. Need inputs on this:

  • I've changed the structure to be more uniform, with source code in the src/ folder and the tests in the tests/ folder.
  • Additionally, there's a build.conf file that is expected in the root of every grate, this is because we need to know the entry point for this grate. Optionally, you can also pass down --max-memory or C_FLAGS as needed, they were needed for IMFS and will likely be needed for other grates as well.
  • Right now, I've added a compile_grate.sh in the imfs folder, which works like ./compile_grate.sh <folder for the grate>. This will be moved outside of the example repo once I file an Issue to provide general purpose tools/templates to this repo.

My basic logic is that we should ideally have a uniform way for building and running these example grates.

@J7-7-7
Copy link

J7-7-7 commented Dec 29, 2025

compile_grate.sh hard-codes toolchain paths under /home/lind/..., could we make these env-overridable (or derived from LIND_WASM_ROOT) so it's easier?

build.conf sets C_FLAGS=... but the script only reads EXTRA_CFLAGS, so those flags never get applied unless users manually set EXTRA_CFLAGS

Copy link
Contributor

@rennergade rennergade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good. @Yaxuan-w can you review when you have a chance? Feel free to merge if you approve

Copy link
Member

@Yaxuan-w Yaxuan-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! Would be helpful to have comments about general description and functionality at top of each file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need more comments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments on usage

@Yaxuan-w
Copy link
Member

Yaxuan-w commented Jan 7, 2026

Also, would be helpful to open up an issue about adding more tests about imfs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add IMFS Example Grate.

5 participants