Skip to content

Commit

Permalink
Upgrade cranelift to version 0.69
Browse files Browse the repository at this point in the history
  • Loading branch information
0xekez committed May 12, 2021
1 parent 7cdf626 commit 61da439
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 65 deletions.
81 changes: 42 additions & 39 deletions lustc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lustc/Cargo.toml
Expand Up @@ -8,8 +8,8 @@ edition = "2018"

[dependencies]
colored = "2"
cranelift = "0.68.0"
cranelift-module = "0.68.0"
cranelift-simplejit = "0.68.0"
cranelift-codegen = "0.68.0"
cranelift = "0.69.0"
cranelift-module = "0.69.0"
cranelift-jit = "0.69.0"
cranelift-codegen = "0.69.0"
clap = "~2.27.0"
12 changes: 6 additions & 6 deletions lustc/src/compiler.rs
Expand Up @@ -24,9 +24,9 @@ use crate::renamer;
use crate::Expr;
use cranelift::frontend::FunctionBuilder;
use cranelift::prelude::*;
use cranelift_jit::{JITBuilder, JITModule};
use cranelift_module::DataContext;
use cranelift_module::{Linkage, Module};
use cranelift_simplejit::{SimpleJITBuilder, SimpleJITModule};
use primitives::define_contiguous_to_list;
use primitives::string_is_primitive;
use procedures::emit_procedure;
Expand All @@ -44,7 +44,7 @@ pub struct JIT {
pub context: codegen::Context,

/// Used to emit code directly into memory for execution.
pub module: SimpleJITModule,
pub module: JITModule,

// Stores information about data objects that the JIT owns.
pub data_ctx: DataContext,
Expand All @@ -53,7 +53,7 @@ pub struct JIT {
/// Manages the state needed for compilation of a function by lustc.
pub(crate) struct Context<'a> {
pub builder: FunctionBuilder<'a>,
pub module: &'a mut SimpleJITModule,
pub module: &'a mut JITModule,
pub word: types::Type,
pub env: HashMap<String, Variable>,
pub fnmap: HashMap<String, LustFn>,
Expand All @@ -65,8 +65,8 @@ pub(crate) struct Context<'a> {

impl Default for JIT {
fn default() -> Self {
let builder = SimpleJITBuilder::new(cranelift_module::default_libcall_names());
let module = SimpleJITModule::new(builder);
let builder = JITBuilder::new(cranelift_module::default_libcall_names());
let module = JITModule::new(builder);
let mut jit = Self {
builder_context: FunctionBuilderContext::new(),
context: module.make_context(),
Expand All @@ -83,7 +83,7 @@ impl Default for JIT {
impl<'a> Context<'a> {
pub fn new(
builder: FunctionBuilder<'a>,
module: &'a mut SimpleJITModule,
module: &'a mut JITModule,
word: types::Type,
env: HashMap<String, Variable>,
fnmap: HashMap<String, LustFn>,
Expand Down
15 changes: 0 additions & 15 deletions lustc/src/lib.rs
Expand Up @@ -75,21 +75,6 @@ pub(crate) enum PreorderStatus {
impl Expr {
/// Performs a postorder traversal of the expr calling F on each
/// item it encounters.
pub(crate) fn postorder_traverse<F>(&self, f: &mut F)
where
F: FnMut(&Expr),
{
match self {
Expr::List(v) => {
for e in v {
e.postorder_traverse(f);
}
f(self);
}
_ => f(self),
}
}

pub(crate) fn postorder_traverse_res<F, E>(&self, f: &mut F) -> Result<(), E>
where
F: FnMut(&Expr) -> Result<(), E>,
Expand Down
2 changes: 1 addition & 1 deletion lustc/src/primitives.rs
Expand Up @@ -880,7 +880,7 @@ pub(crate) fn emit_contigous_to_list(
Ok(res)
}

// Defined the function contiguous-to-list which converts a contiguous
// Defines the function contiguous-to-list which converts a contiguous
// vec of values into a list.
pub(crate) fn define_contiguous_to_list(jit: &mut JIT) -> Result<(), String> {
let word = jit.module.target_config().pointer_type();
Expand Down

0 comments on commit 61da439

Please sign in to comment.