跳转到主要内容

为`wasmer`包提供的Cranelift编译器(用于编译WebAssembly模块)

项目描述

Wasmer logo Wasmer Python,Cranelift编译器 PyPI版本 Wasmer Python 文档 Wasmer PyPI 下载 Wasmer Slack频道

wasmer 是一个完整且成熟的 Python WebAssembly 运行时。 wasmer_compiler_craneliftwasmer 提供了 Cranelift 编译器,从而使 wasmer 能够编译 WebAssembly 模块。

其他编译器也存在

  • wasmer_compiler_llvm,
  • wasmer_compiler_singlepass.

为了获得更全面的了解,请参阅 wasmer 包本身的文档

安装

此包必须与 wasmer 包一起使用,因此

$ pip install wasmer
$ pip install wasmer_compiler_cranelift

用法

wasmer.engine 中的任何引擎都可以将 wasmer_compiler_cranelift.Compiler 类作为参数

from wasmer import engine, Store, Module, Instance
from wasmer_compiler_cranelift import Compiler

# Let's use the Cranelift compiler with the JIT engine…
store = Store(engine.JIT(Compiler))

# … or with the native engine!
store = Store(engine.Native(Compiler))

# And now, compile the module.
module = Module(store, open('my_program.wasm', 'rb').read())

# Now it's compiled, let's instantiate it.
instance = Instance(module)

# And get fun, for example by calling the `sum` exported function!
print(instance.exports.sum(1, 2))

文档

请访问 https://wasmerio.github.io/wasmer-python/api/wasmer_compiler_cranelift/ 查看文档。

或者,运行 just build compiler-cranelift 然后运行 just doc 以在 docs/api/wasmer_compiler_cranelift.html 内生成文档。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源分发

此发布版本没有源分发文件。请参阅有关 生成分发存档 的教程。

构建分发

wasmer_compiler_cranelift-1.1.0-py3-none-any.whl (1.9 kB 查看哈希值)

上传时间 Python 3

wasmer_compiler_cranelift-1.1.0-cp310-none-win_amd64.whl (1.7 MB 查看哈希值)

上传时间 CPython 3.10 Windows x86-64

wasmer_compiler_cranelift-1.1.0-cp310-cp310-manylinux_2_24_x86_64.whl (1.9 MB 查看哈希值)

上传时间 CPython 3.10 manylinux: glibc 2.24+ x86-64

wasmer_compiler_cranelift-1.1.0-cp310-cp310-macosx_10_7_x86_64.whl (1.7 MB 查看哈希值)

上传时间 CPython 3.10 macOS 10.7+ x86-64

wasmer_compiler_cranelift-1.1.0-cp39-none-win_amd64.whl (1.7 MB 查看哈希值)

上传时间 CPython 3.9 Windows x86-64

wasmer_compiler_cranelift-1.1.0-cp39-cp39-manylinux_2_24_x86_64.whl (1.9 MB 查看哈希值)

上传时间 CPython 3.9 manylinux: glibc 2.24+ x86-64

wasmer_compiler_cranelift-1.1.0-cp39-cp39-macosx_11_0_arm64.whl (1.6 MB 查看哈希值)

上传于 CPython 3.9 macOS 11.0+ ARM64

wasmer_compiler_cranelift-1.1.0-cp39-cp39-macosx_10_7_x86_64.whl (1.7 MB 查看哈希值)

上传于 CPython 3.9 macOS 10.7+ x86-64

wasmer_compiler_cranelift-1.1.0-cp38-none-win_amd64.whl (1.7 MB 查看哈希值)

上传于 CPython 3.8 Windows x86-64

wasmer_compiler_cranelift-1.1.0-cp38-cp38-manylinux_2_24_x86_64.whl (1.9 MB 查看哈希值)

上传于 CPython 3.8 manylinux: glibc 2.24+ x86-64

wasmer_compiler_cranelift-1.1.0-cp38-cp38-macosx_10_7_x86_64.whl (1.7 MB 查看哈希值)

上传于 CPython 3.8 macOS 10.7+ x86-64

wasmer_compiler_cranelift-1.1.0-cp37-none-win_amd64.whl (1.7 MB 查看哈希值)

上传于 CPython 3.7 Windows x86-64

wasmer_compiler_cranelift-1.1.0-cp37-cp37m-manylinux_2_24_x86_64.whl (1.9 MB 查看哈希值)

上传于 CPython 3.7m manylinux: glibc 2.24+ x86-64

wasmer_compiler_cranelift-1.1.0-cp37-cp37m-macosx_10_7_x86_64.whl (1.7 MB 查看哈希值)

上传于 CPython 3.7m macOS 10.7+ x86-64

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面