Skip to content

Commit

Permalink
chore: update cranelift-module (apache#5094)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener committed Jan 28, 2023
1 parent 9653796 commit 0ef2a3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion datafusion/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pyarrow = ["pyo3", "arrow/pyarrow"]
apache-avro = { version = "0.14", default-features = false, features = ["snappy"], optional = true }
arrow = { version = "31.0.0", default-features = false }
chrono = { version = "0.4", default-features = false }
cranelift-module = { version = "0.89.0", optional = true }
cranelift-module = { version = "0.92.0", optional = true }
num_cpus = "1.13.0"
object_store = { version = "0.5.0", default-features = false, optional = true }
parquet = { version = "31.0.0", default-features = false, optional = true }
Expand Down
21 changes: 15 additions & 6 deletions datafusion/jit/src/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,26 @@ impl JIT {

// Next, declare the function to jit. Functions must be declared
// before they can be called, or defined.
let id = self.module.declare_function(
&name,
Linkage::Export,
&self.ctx.func.signature,
)?;
let id = self
.module
.declare_function(&name, Linkage::Export, &self.ctx.func.signature)
.map_err(|e| {
DataFusionError::Internal(format!(
"failed in declare the function to jit: {e:?}"
))
})?;

// Define the function to jit. This finishes compilation, although
// there may be outstanding relocations to perform. Currently, jit
// cannot finish relocations until all functions to be called are
// defined. For now, we'll just finalize the function below.
self.module.define_function(id, &mut self.ctx)?;
self.module
.define_function(id, &mut self.ctx)
.map_err(|e| {
DataFusionError::Internal(format!(
"failed in define the function to jit: {e:?}"
))
})?;

// Now that compilation is finished, we can clear out the context state.
self.module.clear_context(&mut self.ctx);
Expand Down

0 comments on commit 0ef2a3a

Please sign in to comment.