From 9e3f75255e0c85b6ec054b4929adfed63c364a53 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 25 Dec 2021 22:17:06 +0800 Subject: [PATCH] update inkwell. Closes #67 --- Cargo.lock | 10 ++++++---- Cargo.toml | 1 - flake.nix | 9 ++++++--- nac3artiq/Cargo.toml | 3 +-- nac3artiq/src/codegen.rs | 4 ++-- nac3artiq/src/timeline.rs | 4 ++-- nac3core/Cargo.toml | 3 +-- nac3core/src/codegen/expr.rs | 4 ++-- nac3core/src/codegen/mod.rs | 2 +- nac3core/src/toplevel/builtins.rs | 12 ++++++------ nac3standalone/Cargo.toml | 3 +-- 11 files changed, 28 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d46da03..117eacad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -316,8 +316,9 @@ dependencies = [ [[package]] name = "inkwell" -version = "0.1.0" -source = "git+https://github.com/TheDan64/inkwell?branch=master#d018ee22e4b5241dec2bc32ca67f3d4caaecee47" +version = "0.1.0-beta.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2223d0eba0ae6d40a3e4680c6a3209143471e1f38b41746ea309aa36dde9f90b" dependencies = [ "either", "inkwell_internals", @@ -330,8 +331,9 @@ dependencies = [ [[package]] name = "inkwell_internals" -version = "0.3.0" -source = "git+https://github.com/TheDan64/inkwell?branch=master#d018ee22e4b5241dec2bc32ca67f3d4caaecee47" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c7090af3d300424caa81976b8c97bca41cd70e861272c072e188ae082fb49f9" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index caaef051..b0ba2bbf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,4 +10,3 @@ members = [ [profile.release] debug = true - diff --git a/flake.nix b/flake.nix index 60d18c67..c00b660a 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,6 @@ }) ]; }; - cargoSha256 = "sha256-otKLhr58HYMjVXAof6AdObNpggPnvK6qOl7I+4LWIP8="; msys2-python-tar = pkgs.fetchurl { url = "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-python-3.9.7-4-any.pkg.tar.zst"; sha256 = "0iwlgbk4b457yn9djwqswid55xhyyi35qymz1lfh42xwdpxdm47c"; @@ -54,7 +53,9 @@ pkgs.rustPlatform.buildRustPackage { name = "nac3artiq"; src = self; - inherit cargoSha256; + cargoLock = { + lockFile = ./Cargo.lock; + }; nativeBuildInputs = [ pkgs.python3 llvm-nac3 ]; buildInputs = [ pkgs.python3 llvm-nac3 ]; cargoBuildFlags = [ "--package" "nac3artiq" ]; @@ -75,7 +76,9 @@ pkgs-mingw.rustPlatform.buildRustPackage { name = "nac3artiq"; src = self; - inherit cargoSha256; + cargoLock = { + lockFile = ./Cargo.lock; + }; nativeBuildInputs = [ pkgs.zip ]; buildInputs = [ pkgs-mingw.zlib ]; configurePhase = diff --git a/nac3artiq/Cargo.toml b/nac3artiq/Cargo.toml index 8b4c8e13..c452aecb 100644 --- a/nac3artiq/Cargo.toml +++ b/nac3artiq/Cargo.toml @@ -16,7 +16,6 @@ nac3parser = { path = "../nac3parser" } nac3core = { path = "../nac3core" } [dependencies.inkwell] -git = "https://github.com/TheDan64/inkwell" -branch = "master" +version = "0.1.0-beta.4" default-features = false features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] diff --git a/nac3artiq/src/codegen.rs b/nac3artiq/src/codegen.rs index 0b2bc784..38d9ecd3 100644 --- a/nac3artiq/src/codegen.rs +++ b/nac3artiq/src/codegen.rs @@ -68,7 +68,7 @@ impl<'b> CodeGenerator for ArtiqCodeGenerator<'b> { }); let max = ctx .builder - .build_call(smax, &[old_end, now], "smax") + .build_call(smax, &[old_end.into(), now.into()], "smax") .try_as_basic_value() .left() .unwrap(); @@ -185,7 +185,7 @@ impl<'b> CodeGenerator for ArtiqCodeGenerator<'b> { }); let max = ctx .builder - .build_call(smax, &[end_val, outer_end_val], "smax") + .build_call(smax, &[end_val.into(), outer_end_val.into()], "smax") .try_as_basic_value() .left() .unwrap(); diff --git a/nac3artiq/src/timeline.rs b/nac3artiq/src/timeline.rs index 2e7f3321..b9c3ddc6 100644 --- a/nac3artiq/src/timeline.rs +++ b/nac3artiq/src/timeline.rs @@ -332,7 +332,7 @@ impl TimeFns for ExternTimeFns { .get_function("at_mu") .unwrap_or_else(|| ctx.module.add_function("at_mu", ctx.ctx.void_type().fn_type(&[ctx.ctx.i64_type().into()], false), None)); ctx.builder - .build_call(at_mu, &[t], "at_mu"); + .build_call(at_mu, &[t.into()], "at_mu"); } fn emit_delay_mu<'ctx, 'a>(&self, ctx: &mut CodeGenContext<'ctx, 'a>, dt: BasicValueEnum<'ctx>) { @@ -341,7 +341,7 @@ impl TimeFns for ExternTimeFns { .get_function("delay_mu") .unwrap_or_else(|| ctx.module.add_function("delay_mu", ctx.ctx.void_type().fn_type(&[ctx.ctx.i64_type().into()], false), None)); ctx.builder - .build_call(delay_mu, &[dt], "delay_mu"); + .build_call(delay_mu, &[dt.into()], "delay_mu"); } } diff --git a/nac3core/Cargo.toml b/nac3core/Cargo.toml index d69f4c0a..27a24d3a 100644 --- a/nac3core/Cargo.toml +++ b/nac3core/Cargo.toml @@ -14,8 +14,7 @@ rayon = "1.5.1" nac3parser = { path = "../nac3parser" } [dependencies.inkwell] -git = "https://github.com/TheDan64/inkwell" -branch = "master" +version = "0.1.0-beta.4" default-features = false features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] diff --git a/nac3core/src/codegen/expr.rs b/nac3core/src/codegen/expr.rs index 9f2cd93f..940c9df7 100644 --- a/nac3core/src/codegen/expr.rs +++ b/nac3core/src/codegen/expr.rs @@ -420,7 +420,7 @@ pub fn gen_call<'ctx, 'a, G: CodeGenerator>( }; param_vals = real_params .into_iter() - .map(|p| p.to_basic_value_enum(ctx, generator)) + .map(|p| p.to_basic_value_enum(ctx, generator).into()) .collect_vec(); instance_to_symbol.get(&key).cloned() } @@ -437,7 +437,7 @@ pub fn gen_call<'ctx, 'a, G: CodeGenerator>( if let Some(obj) = &obj { args.insert(0, FuncArg { name: "self".into(), ty: obj.0, default_value: None }); } - let params = args.iter().map(|arg| ctx.get_llvm_type(generator, arg.ty)).collect_vec(); + let params = args.iter().map(|arg| ctx.get_llvm_type(generator, arg.ty).into()).collect_vec(); let fun_ty = if ctx.unifier.unioned(fun.0.ret, ctx.primitives.none) { ctx.ctx.void_type().fn_type(¶ms, false) } else { diff --git a/nac3core/src/codegen/mod.rs b/nac3core/src/codegen/mod.rs index 4d2583e1..1ff7c3cd 100644 --- a/nac3core/src/codegen/mod.rs +++ b/nac3core/src/codegen/mod.rs @@ -352,7 +352,7 @@ pub fn gen_func<'ctx, G: CodeGenerator>( let params = args .iter() .map(|arg| { - get_llvm_type(context, generator, &mut unifier, top_level_ctx.as_ref(), &mut type_cache, arg.ty) + get_llvm_type(context, generator, &mut unifier, top_level_ctx.as_ref(), &mut type_cache, arg.ty).into() }) .collect_vec(); diff --git a/nac3core/src/toplevel/builtins.rs b/nac3core/src/toplevel/builtins.rs index e8a523a7..6978ac07 100644 --- a/nac3core/src/toplevel/builtins.rs +++ b/nac3core/src/toplevel/builtins.rs @@ -214,7 +214,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { }); let val = ctx .builder - .build_call(round_intrinsic, &[arg], "round") + .build_call(round_intrinsic, &[arg.into()], "round") .try_as_basic_value() .left() .unwrap(); @@ -251,7 +251,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { }); let val = ctx .builder - .build_call(round_intrinsic, &[arg], "round") + .build_call(round_intrinsic, &[arg.into()], "round") .try_as_basic_value() .left() .unwrap(); @@ -431,7 +431,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { }); let val = ctx .builder - .build_call(floor_intrinsic, &[arg], "floor") + .build_call(floor_intrinsic, &[arg.into()], "floor") .try_as_basic_value() .left() .unwrap(); @@ -468,7 +468,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { }); let val = ctx .builder - .build_call(floor_intrinsic, &[arg], "floor") + .build_call(floor_intrinsic, &[arg.into()], "floor") .try_as_basic_value() .left() .unwrap(); @@ -505,7 +505,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { }); let val = ctx .builder - .build_call(ceil_intrinsic, &[arg], "ceil") + .build_call(ceil_intrinsic, &[arg.into()], "ceil") .try_as_basic_value() .left() .unwrap(); @@ -542,7 +542,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { }); let val = ctx .builder - .build_call(ceil_intrinsic, &[arg], "ceil") + .build_call(ceil_intrinsic, &[arg.into()], "ceil") .try_as_basic_value() .left() .unwrap(); diff --git a/nac3standalone/Cargo.toml b/nac3standalone/Cargo.toml index c538886a..5d248bcf 100644 --- a/nac3standalone/Cargo.toml +++ b/nac3standalone/Cargo.toml @@ -10,7 +10,6 @@ nac3parser = { path = "../nac3parser" } nac3core = { path = "../nac3core" } [dependencies.inkwell] -git = "https://github.com/TheDan64/inkwell" -branch = "master" +version = "0.1.0-beta.4" default-features = false features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]