Rename SimpleJIT to JIT as it isn't simple anymore
This commit is contained in:
42
Cargo.lock
generated
42
Cargo.lock
generated
@@ -462,6 +462,26 @@ dependencies = [
|
|||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cranelift-jit"
|
||||||
|
version = "0.68.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"cranelift",
|
||||||
|
"cranelift-codegen",
|
||||||
|
"cranelift-entity",
|
||||||
|
"cranelift-frontend",
|
||||||
|
"cranelift-module",
|
||||||
|
"cranelift-native",
|
||||||
|
"errno",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"memmap",
|
||||||
|
"region",
|
||||||
|
"target-lexicon",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-module"
|
name = "cranelift-module"
|
||||||
version = "0.68.0"
|
version = "0.68.0"
|
||||||
@@ -527,26 +547,6 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cranelift-simplejit"
|
|
||||||
version = "0.68.0"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"cranelift",
|
|
||||||
"cranelift-codegen",
|
|
||||||
"cranelift-entity",
|
|
||||||
"cranelift-frontend",
|
|
||||||
"cranelift-module",
|
|
||||||
"cranelift-native",
|
|
||||||
"errno",
|
|
||||||
"libc",
|
|
||||||
"log",
|
|
||||||
"memmap",
|
|
||||||
"region",
|
|
||||||
"target-lexicon",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-tools"
|
name = "cranelift-tools"
|
||||||
version = "0.66.0"
|
version = "0.66.0"
|
||||||
@@ -560,13 +560,13 @@ dependencies = [
|
|||||||
"cranelift-filetests",
|
"cranelift-filetests",
|
||||||
"cranelift-frontend",
|
"cranelift-frontend",
|
||||||
"cranelift-interpreter",
|
"cranelift-interpreter",
|
||||||
|
"cranelift-jit",
|
||||||
"cranelift-module",
|
"cranelift-module",
|
||||||
"cranelift-native",
|
"cranelift-native",
|
||||||
"cranelift-object",
|
"cranelift-object",
|
||||||
"cranelift-preopt",
|
"cranelift-preopt",
|
||||||
"cranelift-reader",
|
"cranelift-reader",
|
||||||
"cranelift-serde",
|
"cranelift-serde",
|
||||||
"cranelift-simplejit",
|
|
||||||
"cranelift-wasm",
|
"cranelift-wasm",
|
||||||
"file-per-thread-logger",
|
"file-per-thread-logger",
|
||||||
"filecheck",
|
"filecheck",
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ cranelift-native = { path = "native", version = "0.68.0" }
|
|||||||
cranelift-filetests = { path = "filetests", version = "0.66.0" }
|
cranelift-filetests = { path = "filetests", version = "0.66.0" }
|
||||||
cranelift-module = { path = "module", version = "0.68.0" }
|
cranelift-module = { path = "module", version = "0.68.0" }
|
||||||
cranelift-object = { path = "object", version = "0.68.0" }
|
cranelift-object = { path = "object", version = "0.68.0" }
|
||||||
cranelift-simplejit = { path = "simplejit", version = "0.68.0" }
|
cranelift-jit = { path = "jit", version = "0.68.0" }
|
||||||
cranelift-preopt = { path = "preopt", version = "0.68.0" }
|
cranelift-preopt = { path = "preopt", version = "0.68.0" }
|
||||||
cranelift = { path = "umbrella", version = "0.68.0" }
|
cranelift = { path = "umbrella", version = "0.68.0" }
|
||||||
filecheck = "0.5.0"
|
filecheck = "0.5.0"
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ into executable machine code.
|
|||||||
|
|
||||||
For more information, see [the documentation](docs/index.md).
|
For more information, see [the documentation](docs/index.md).
|
||||||
|
|
||||||
For an example of how to use the JIT, see the [SimpleJIT Demo], which
|
For an example of how to use the JIT, see the [JIT Demo], which
|
||||||
implements a toy language.
|
implements a toy language.
|
||||||
|
|
||||||
[SimpleJIT Demo]: https://github.com/bytecodealliance/simplejit-demo
|
[JIT Demo]: https://github.com/bytecodealliance/simplejit-demo
|
||||||
|
|
||||||
For an example of how to use Cranelift to run WebAssembly code, see
|
For an example of how to use Cranelift to run WebAssembly code, see
|
||||||
[Wasmtime], which implements a standalone, embeddable, VM using Cranelift.
|
[Wasmtime], which implements a standalone, embeddable, VM using Cranelift.
|
||||||
|
|||||||
@@ -52,6 +52,6 @@
|
|||||||
emits native object files using the
|
emits native object files using the
|
||||||
`object <https://github.com/gimli-rs/object>`_ library.
|
`object <https://github.com/gimli-rs/object>`_ library.
|
||||||
|
|
||||||
- [cranelift-simplejit](https://docs.rs/cranelift-simplejit)
|
- [cranelift-jit](https://docs.rs/cranelift-jit)
|
||||||
This crate provides a simple JIT backend for `cranelift-module`, which
|
This crate provides a JIT backend for `cranelift-module`, which
|
||||||
emits code and data into memory.
|
emits code and data into memory.
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ use thiserror::Error;
|
|||||||
/// `CompiledFunction`s and subsequently calling them through the use of a `Trampoline`. As its
|
/// `CompiledFunction`s and subsequently calling them through the use of a `Trampoline`. As its
|
||||||
/// name indicates, this compiler is limited: any functionality that requires knowledge of things
|
/// name indicates, this compiler is limited: any functionality that requires knowledge of things
|
||||||
/// outside the [Function] will likely not work (e.g. global values, calls). For an example of this
|
/// outside the [Function] will likely not work (e.g. global values, calls). For an example of this
|
||||||
/// "outside-of-function" functionality, see `cranelift_simplejit::backend::SimpleJITBackend`.
|
/// "outside-of-function" functionality, see `cranelift_jit::backend::JITBackend`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use cranelift_filetests::SingleFunctionCompiler;
|
/// use cranelift_filetests::SingleFunctionCompiler;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cranelift-simplejit"
|
name = "cranelift-jit"
|
||||||
version = "0.68.0"
|
version = "0.68.0"
|
||||||
authors = ["The Cranelift Project Developers"]
|
authors = ["The Cranelift Project Developers"]
|
||||||
description = "A simple JIT library backed by Cranelift"
|
description = "A JIT library backed by Cranelift"
|
||||||
repository = "https://github.com/bytecodealliance/wasmtime"
|
repository = "https://github.com/bytecodealliance/wasmtime"
|
||||||
documentation = "https://docs.rs/cranelift-simplejit"
|
documentation = "https://docs.rs/cranelift-jit"
|
||||||
license = "Apache-2.0 WITH LLVM-exception"
|
license = "Apache-2.0 WITH LLVM-exception"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
This crate provides a simple JIT library that uses
|
This crate provides a JIT library that uses
|
||||||
[Cranelift](https://crates.io/crates/cranelift).
|
[Cranelift](https://crates.io/crates/cranelift).
|
||||||
|
|
||||||
This crate is extremely experimental.
|
This crate is extremely experimental.
|
||||||
|
|
||||||
See the [example program] for a brief overview of how to use this.
|
See the [example program] for a brief overview of how to use this.
|
||||||
|
|
||||||
[example program]: https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/simplejit/examples/simplejit-minimal.rs
|
[example program]: https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/jit/examples/jit-minimal.rs
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
use cranelift::prelude::*;
|
use cranelift::prelude::*;
|
||||||
use cranelift_codegen::binemit::NullTrapSink;
|
use cranelift_codegen::binemit::NullTrapSink;
|
||||||
use cranelift_codegen::settings::{self, Configurable};
|
use cranelift_codegen::settings::{self, Configurable};
|
||||||
|
use cranelift_jit::{JITBuilder, JITModule};
|
||||||
use cranelift_module::{default_libcall_names, Linkage, Module};
|
use cranelift_module::{default_libcall_names, Linkage, Module};
|
||||||
use cranelift_simplejit::{SimpleJITBuilder, SimpleJITModule};
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@@ -14,8 +14,7 @@ fn main() {
|
|||||||
panic!("host machine is not supported: {}", msg);
|
panic!("host machine is not supported: {}", msg);
|
||||||
});
|
});
|
||||||
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
|
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
|
||||||
let mut module: SimpleJITModule =
|
let mut module = JITModule::new(JITBuilder::with_isa(isa, default_libcall_names()));
|
||||||
SimpleJITModule::new(SimpleJITBuilder::with_isa(isa, default_libcall_names()));
|
|
||||||
|
|
||||||
let mut ctx = module.make_context();
|
let mut ctx = module.make_context();
|
||||||
let mut func_ctx = FunctionBuilderContext::new();
|
let mut func_ctx = FunctionBuilderContext::new();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
//! Defines `SimpleJITModule`.
|
//! Defines `JITModule`.
|
||||||
|
|
||||||
use crate::{compiled_blob::CompiledBlob, memory::Memory};
|
use crate::{compiled_blob::CompiledBlob, memory::Memory};
|
||||||
use cranelift_codegen::isa::TargetIsa;
|
use cranelift_codegen::isa::TargetIsa;
|
||||||
@@ -31,16 +31,16 @@ const EXECUTABLE_DATA_ALIGNMENT: u64 = 0x10;
|
|||||||
const WRITABLE_DATA_ALIGNMENT: u64 = 0x8;
|
const WRITABLE_DATA_ALIGNMENT: u64 = 0x8;
|
||||||
const READONLY_DATA_ALIGNMENT: u64 = 0x1;
|
const READONLY_DATA_ALIGNMENT: u64 = 0x1;
|
||||||
|
|
||||||
/// A builder for `SimpleJITModule`.
|
/// A builder for `JITModule`.
|
||||||
pub struct SimpleJITBuilder {
|
pub struct JITBuilder {
|
||||||
isa: Box<dyn TargetIsa>,
|
isa: Box<dyn TargetIsa>,
|
||||||
symbols: HashMap<String, *const u8>,
|
symbols: HashMap<String, *const u8>,
|
||||||
libcall_names: Box<dyn Fn(ir::LibCall) -> String + Send + Sync>,
|
libcall_names: Box<dyn Fn(ir::LibCall) -> String + Send + Sync>,
|
||||||
hotswap_enabled: bool,
|
hotswap_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SimpleJITBuilder {
|
impl JITBuilder {
|
||||||
/// Create a new `SimpleJITBuilder`.
|
/// Create a new `JITBuilder`.
|
||||||
///
|
///
|
||||||
/// The `libcall_names` function provides a way to translate `cranelift_codegen`'s `ir::LibCall`
|
/// The `libcall_names` function provides a way to translate `cranelift_codegen`'s `ir::LibCall`
|
||||||
/// enum to symbols. LibCalls are inserted in the IR as part of the legalization for certain
|
/// enum to symbols. LibCalls are inserted in the IR as part of the legalization for certain
|
||||||
@@ -60,12 +60,10 @@ impl SimpleJITBuilder {
|
|||||||
Self::with_isa(isa, libcall_names)
|
Self::with_isa(isa, libcall_names)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new `SimpleJITBuilder` with an arbitrary target. This is mainly
|
/// Create a new `JITBuilder` with an arbitrary target. This is mainly
|
||||||
/// useful for testing.
|
/// useful for testing.
|
||||||
///
|
///
|
||||||
/// SimpleJIT requires a `TargetIsa` configured for non-PIC.
|
/// To create a `JITBuilder` for native use, use the `new` constructor
|
||||||
///
|
|
||||||
/// To create a `SimpleJITBuilder` for native use, use the `new` constructor
|
|
||||||
/// instead.
|
/// instead.
|
||||||
///
|
///
|
||||||
/// The `libcall_names` function provides a way to translate `cranelift_codegen`'s `ir::LibCall`
|
/// The `libcall_names` function provides a way to translate `cranelift_codegen`'s `ir::LibCall`
|
||||||
@@ -121,19 +119,21 @@ impl SimpleJITBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enable or disable hotswap support. See [`SimpleJITModule::prepare_for_function_redefine`]
|
/// Enable or disable hotswap support. See [`JITModule::prepare_for_function_redefine`]
|
||||||
/// for more information.
|
/// for more information.
|
||||||
|
///
|
||||||
|
/// Enabling hotswap support requires PIC code.
|
||||||
pub fn hotswap(&mut self, enabled: bool) -> &mut Self {
|
pub fn hotswap(&mut self, enabled: bool) -> &mut Self {
|
||||||
self.hotswap_enabled = enabled;
|
self.hotswap_enabled = enabled;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A `SimpleJITModule` implements `Module` and emits code and data into memory where it can be
|
/// A `JITModule` implements `Module` and emits code and data into memory where it can be
|
||||||
/// directly called and accessed.
|
/// directly called and accessed.
|
||||||
///
|
///
|
||||||
/// See the `SimpleJITBuilder` for a convenient way to construct `SimpleJITModule` instances.
|
/// See the `JITBuilder` for a convenient way to construct `JITModule` instances.
|
||||||
pub struct SimpleJITModule {
|
pub struct JITModule {
|
||||||
isa: Box<dyn TargetIsa>,
|
isa: Box<dyn TargetIsa>,
|
||||||
hotswap_enabled: bool,
|
hotswap_enabled: bool,
|
||||||
symbols: HashMap<String, *const u8>,
|
symbols: HashMap<String, *const u8>,
|
||||||
@@ -158,7 +158,7 @@ struct MemoryHandle {
|
|||||||
writable: Memory,
|
writable: Memory,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SimpleJITModule {
|
impl JITModule {
|
||||||
/// Free memory allocated for code and data segments of compiled functions.
|
/// Free memory allocated for code and data segments of compiled functions.
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
@@ -369,8 +369,8 @@ impl SimpleJITModule {
|
|||||||
self.memory.code.set_readable_and_executable();
|
self.memory.code.set_readable_and_executable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new `SimpleJITModule`.
|
/// Create a new `JITModule`.
|
||||||
pub fn new(builder: SimpleJITBuilder) -> Self {
|
pub fn new(builder: JITBuilder) -> Self {
|
||||||
if builder.hotswap_enabled {
|
if builder.hotswap_enabled {
|
||||||
assert!(
|
assert!(
|
||||||
builder.isa.flags().is_pic(),
|
builder.isa.flags().is_pic(),
|
||||||
@@ -450,7 +450,7 @@ impl SimpleJITModule {
|
|||||||
/// Allow a single future `define_function` on a previously defined function. This allows for
|
/// Allow a single future `define_function` on a previously defined function. This allows for
|
||||||
/// hot code swapping and lazy compilation of functions.
|
/// hot code swapping and lazy compilation of functions.
|
||||||
///
|
///
|
||||||
/// This requires hotswap support to be enabled first using [`SimpleJITBuilder::hotswap`].
|
/// This requires hotswap support to be enabled first using [`JITBuilder::hotswap`].
|
||||||
pub fn prepare_for_function_redefine(&mut self, func_id: FuncId) -> ModuleResult<()> {
|
pub fn prepare_for_function_redefine(&mut self, func_id: FuncId) -> ModuleResult<()> {
|
||||||
assert!(self.hotswap_enabled, "Hotswap support is not enabled");
|
assert!(self.hotswap_enabled, "Hotswap support is not enabled");
|
||||||
let decl = self.declarations.get_function_decl(func_id);
|
let decl = self.declarations.get_function_decl(func_id);
|
||||||
@@ -473,7 +473,7 @@ impl SimpleJITModule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'simple_jit_backend> Module for SimpleJITModule {
|
impl Module for JITModule {
|
||||||
fn isa(&self) -> &dyn TargetIsa {
|
fn isa(&self) -> &dyn TargetIsa {
|
||||||
&*self.isa
|
&*self.isa
|
||||||
}
|
}
|
||||||
@@ -533,7 +533,7 @@ impl<'simple_jit_backend> Module for SimpleJITModule {
|
|||||||
writable: bool,
|
writable: bool,
|
||||||
tls: bool,
|
tls: bool,
|
||||||
) -> ModuleResult<DataId> {
|
) -> ModuleResult<DataId> {
|
||||||
assert!(!tls, "SimpleJIT doesn't yet support TLS");
|
assert!(!tls, "JIT doesn't yet support TLS");
|
||||||
let (id, _decl) = self
|
let (id, _decl) = self
|
||||||
.declarations
|
.declarations
|
||||||
.declare_data(name, linkage, writable, tls)?;
|
.declare_data(name, linkage, writable, tls)?;
|
||||||
@@ -627,7 +627,7 @@ impl<'simple_jit_backend> Module for SimpleJITModule {
|
|||||||
.allocate(size, EXECUTABLE_DATA_ALIGNMENT)
|
.allocate(size, EXECUTABLE_DATA_ALIGNMENT)
|
||||||
.expect("TODO: handle OOM etc.");
|
.expect("TODO: handle OOM etc.");
|
||||||
|
|
||||||
let mut reloc_sink = SimpleJITRelocSink::default();
|
let mut reloc_sink = JITRelocSink::default();
|
||||||
let mut stack_map_sink = binemit::NullStackMapSink {};
|
let mut stack_map_sink = binemit::NullStackMapSink {};
|
||||||
unsafe {
|
unsafe {
|
||||||
ctx.emit_to_memory(
|
ctx.emit_to_memory(
|
||||||
@@ -750,7 +750,7 @@ impl<'simple_jit_backend> Module for SimpleJITModule {
|
|||||||
return Err(ModuleError::DuplicateDefinition(decl.name.to_owned()));
|
return Err(ModuleError::DuplicateDefinition(decl.name.to_owned()));
|
||||||
}
|
}
|
||||||
|
|
||||||
assert!(!decl.tls, "SimpleJIT doesn't yet support TLS");
|
assert!(!decl.tls, "JIT doesn't yet support TLS");
|
||||||
|
|
||||||
let &DataDescription {
|
let &DataDescription {
|
||||||
ref init,
|
ref init,
|
||||||
@@ -850,11 +850,11 @@ fn lookup_with_dlsym(name: &str) -> Option<*const u8> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct SimpleJITRelocSink {
|
struct JITRelocSink {
|
||||||
relocs: Vec<RelocRecord>,
|
relocs: Vec<RelocRecord>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RelocSink for SimpleJITRelocSink {
|
impl RelocSink for JITRelocSink {
|
||||||
fn reloc_external(
|
fn reloc_external(
|
||||||
&mut self,
|
&mut self,
|
||||||
offset: CodeOffset,
|
offset: CodeOffset,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
//! Top-level lib.rs for `cranelift_simplejit`.
|
//! Top-level lib.rs for `cranelift_jit`.
|
||||||
|
|
||||||
#![deny(
|
#![deny(
|
||||||
missing_docs,
|
missing_docs,
|
||||||
@@ -27,7 +27,7 @@ mod backend;
|
|||||||
mod compiled_blob;
|
mod compiled_blob;
|
||||||
mod memory;
|
mod memory;
|
||||||
|
|
||||||
pub use crate::backend::{SimpleJITBuilder, SimpleJITModule};
|
pub use crate::backend::{JITBuilder, JITModule};
|
||||||
|
|
||||||
/// Version number of this crate.
|
/// Version number of this crate.
|
||||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
@@ -5,8 +5,8 @@ use cranelift_codegen::settings::{self, Configurable};
|
|||||||
use cranelift_codegen::{ir::types::I16, Context};
|
use cranelift_codegen::{ir::types::I16, Context};
|
||||||
use cranelift_entity::EntityRef;
|
use cranelift_entity::EntityRef;
|
||||||
use cranelift_frontend::*;
|
use cranelift_frontend::*;
|
||||||
|
use cranelift_jit::*;
|
||||||
use cranelift_module::*;
|
use cranelift_module::*;
|
||||||
use cranelift_simplejit::*;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn error_on_incompatible_sig_in_declare_function() {
|
fn error_on_incompatible_sig_in_declare_function() {
|
||||||
@@ -18,8 +18,7 @@ fn error_on_incompatible_sig_in_declare_function() {
|
|||||||
panic!("host machine is not supported: {}", msg);
|
panic!("host machine is not supported: {}", msg);
|
||||||
});
|
});
|
||||||
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
|
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
|
||||||
let mut module: SimpleJITModule =
|
let mut module = JITModule::new(JITBuilder::with_isa(isa, default_libcall_names()));
|
||||||
SimpleJITModule::new(SimpleJITBuilder::with_isa(isa, default_libcall_names()));
|
|
||||||
|
|
||||||
let mut sig = Signature {
|
let mut sig = Signature {
|
||||||
params: vec![AbiParam::new(types::I64)],
|
params: vec![AbiParam::new(types::I64)],
|
||||||
@@ -36,7 +35,7 @@ fn error_on_incompatible_sig_in_declare_function() {
|
|||||||
.unwrap(); // Make sure this is an error
|
.unwrap(); // Make sure this is an error
|
||||||
}
|
}
|
||||||
|
|
||||||
fn define_simple_function(module: &mut SimpleJITModule) -> FuncId {
|
fn define_simple_function(module: &mut JITModule) -> FuncId {
|
||||||
let sig = Signature {
|
let sig = Signature {
|
||||||
params: vec![],
|
params: vec![],
|
||||||
returns: vec![],
|
returns: vec![],
|
||||||
@@ -76,8 +75,7 @@ fn panic_on_define_after_finalize() {
|
|||||||
panic!("host machine is not supported: {}", msg);
|
panic!("host machine is not supported: {}", msg);
|
||||||
});
|
});
|
||||||
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
|
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
|
||||||
let mut module: SimpleJITModule =
|
let mut module = JITModule::new(JITBuilder::with_isa(isa, default_libcall_names()));
|
||||||
SimpleJITModule::new(SimpleJITBuilder::with_isa(isa, default_libcall_names()));
|
|
||||||
|
|
||||||
define_simple_function(&mut module);
|
define_simple_function(&mut module);
|
||||||
define_simple_function(&mut module);
|
define_simple_function(&mut module);
|
||||||
@@ -166,8 +164,7 @@ fn libcall_function() {
|
|||||||
panic!("host machine is not supported: {}", msg);
|
panic!("host machine is not supported: {}", msg);
|
||||||
});
|
});
|
||||||
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
|
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
|
||||||
let mut module: SimpleJITModule =
|
let mut module = JITModule::new(JITBuilder::with_isa(isa, default_libcall_names()));
|
||||||
SimpleJITModule::new(SimpleJITBuilder::with_isa(isa, default_libcall_names()));
|
|
||||||
|
|
||||||
let sig = Signature {
|
let sig = Signature {
|
||||||
params: vec![],
|
params: vec![],
|
||||||
@@ -10,10 +10,8 @@ A module is a collection of functions and data objects that are linked
|
|||||||
together. The `Module` trait that defines a common interface for various kinds
|
together. The `Module` trait that defines a common interface for various kinds
|
||||||
of modules. Most users will use one of the following `Module` implementations:
|
of modules. Most users will use one of the following `Module` implementations:
|
||||||
|
|
||||||
- `SimpleJITModule`, provided by [cranelift-simplejit], which JITs
|
- `JITModule`, provided by [cranelift-jit], which JITs code to memory for direct execution.
|
||||||
code to memory for direct execution.
|
- `ObjectModule`, provided by [cranelift-object], which emits native object files.
|
||||||
- `ObjectModule`, provided by [cranelift-object], which emits native
|
|
||||||
object files.
|
|
||||||
|
|
||||||
[cranelift-simplejit]: https://crates.io/crates/cranelift-simplejit
|
[cranelift-jit]: https://crates.io/crates/cranelift-jit
|
||||||
[cranelift-object]: https://crates.io/crates/cranelift-object
|
[cranelift-object]: https://crates.io/crates/cranelift-object
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const CRATES_TO_PUBLISH: &[&str] = &[
|
|||||||
"cranelift-object",
|
"cranelift-object",
|
||||||
"cranelift-interpreter",
|
"cranelift-interpreter",
|
||||||
"cranelift",
|
"cranelift",
|
||||||
"cranelift-simplejit",
|
"cranelift-jit",
|
||||||
// wig/wiggle
|
// wig/wiggle
|
||||||
"wiggle-generate",
|
"wiggle-generate",
|
||||||
"wiggle-macro",
|
"wiggle-macro",
|
||||||
|
|||||||
Reference in New Issue
Block a user