Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with wasmtime; 集成 wasmtime 运行时 #732

Closed
zhenjunMa opened this issue Jul 23, 2022 · 7 comments · Fixed by #833
Closed

Integrate with wasmtime; 集成 wasmtime 运行时 #732

zhenjunMa opened this issue Jul 23, 2022 · 7 comments · Fixed by #833
Assignees
Labels
area/wasm good first issue Good for newcomers help wanted Extra attention is needed kind/hard wasm WebAssembly technology

Comments

@zhenjunMa
Copy link
Contributor

1. Background

Currently, Layotto supports load and run *.wasm files by integrating wasmer-go and wasmer, now we want to support wasmtime as another WebAssembly Runtime.

2. Why is this needed?

Compared with wasmer, wasmtime has more advanced features, which allow us to make more settings for the running *.wasm files. For details, please refer to #607

3. draft design

  1. Related code paths
    image

  2. Reference Code

MOSN has provided extension points. the interface is located in the file: pkg/types/wasm.go. In theory, we can use the wasmtime API to implement several interfaces in Layotto.

4. Other references

  1. https://github.com/bytecodealliance/wasmtime
  2. https://github.com/bytecodealliance/wasmtime-go

中文

一、背景

目前 Layotto 是通过集成 wasmer-gowasmer 来支持 *.wasm 文件的加载运行,现在我们希望支持 wasmtime 来加载运行 *.wasm 文件

二、意义&价值

相比于 wasmer,wasmtime 具备更多的高级特性,可以让我们对运行着的 *.wasm 文件做更多设置,具体可以参考 #607

三、设计草案

  1. 相关代码路径
    image

  2. 参考代码

MOSN 已经留好了扩展点,接口所在文件:pkg/types/wasm.go,理论上应该在 Layotto 中结合 wasmtime 的 API 实现里面的几个接口即可。

四、其他参考资料

  1. https://github.com/bytecodealliance/wasmtime
  2. https://github.com/bytecodealliance/wasmtime-go
@zhenjunMa zhenjunMa added good first issue Good for newcomers help wanted Extra attention is needed wasm WebAssembly technology labels Jul 23, 2022
@seeflood seeflood changed the title Integrate with wasmtime Integrate with wasmtime; 集成 wasmtime 运行时 Jul 29, 2022
@rayowang
Copy link
Member

/assign

@seeflood
Copy link
Member

进展:

  • 不需要写到 mosn 仓库里,可以注册进去
  • 函数有差异,有适配成本

@seeflood
Copy link
Member

进展:
因为wasmtime对function注册相关的支持没有wasmer完备,还在单元测试

@rayowang
Copy link
Member

rayowang commented Sep 3, 2022

目前集成wasmtime单测通过,集成测试有点问题,给bytecodealliance提了issue
bytecodealliance/wasmtime-go#145

@rayowang
Copy link
Member

rayowang commented Sep 4, 2022

@rayowang
Copy link
Member

目前demo中function2可以正常加载及运行,function1有点问题
bytecodealliance/wasmtime-go#149

@rayowang
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/wasm good first issue Good for newcomers help wanted Extra attention is needed kind/hard wasm WebAssembly technology
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants