diff --git a/Cargo.toml b/Cargo.toml index 9c92dea..f747b99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,14 +4,11 @@ version = "0.0.0" edition = "2024" [features] -default = ["vm", "jit", "repl"] -vm = [] -jit = ["dep:inkwell"] repl = ["dep:rustyline"] [[bin]] -name = "repl-vm" -required-features = ["vm", "repl"] +name = "repl" +required-features = ["repl"] [profile.perf] debug = 1 @@ -26,6 +23,6 @@ derive_more = { version = "2.0", features = [ "full" ] } ecow = "0.2" regex = "1.11" -inkwell = { version = "0.6.0", features = ["llvm18-1"], optional = true } +inkwell = { version = "0.6.0", features = ["llvm18-1"] } rustyline = { version = "15.0", optional = true } diff --git a/src/bin/repl-vm.rs b/src/bin/repl.rs similarity index 100% rename from src/bin/repl-vm.rs rename to src/bin/repl.rs diff --git a/src/ir.rs b/src/ir.rs index 5504dea..339367e 100644 --- a/src/ir.rs +++ b/src/ir.rs @@ -5,8 +5,6 @@ use rnix::ast::{self, Expr}; use crate::compile::*; use crate::error::*; -#[cfg(feature = "jit")] -use crate::jit::*; use crate::ty::internal as i; pub fn downgrade(expr: Expr) -> Result { @@ -62,15 +60,6 @@ macro_rules! ir { } } - #[cfg(feature = "jit")] - impl CodeGen for Ir { - fn codegen(self, ctx: &JITContext<'_>) { - match self { - $(Ir::$ty(ir) => ir.codegen(ctx),)* - } - } - } - $( $( #[$($x)*] diff --git a/src/jit/codegen.rs b/src/jit/codegen.rs deleted file mode 100644 index d390e68..0000000 --- a/src/jit/codegen.rs +++ /dev/null @@ -1,111 +0,0 @@ -#![allow(unused_variables)] - -use crate::ir::*; - -use super::JITContext; - -pub trait CodeGen { - fn codegen(self, ctx: &JITContext); -} - -impl CodeGen for Attrs { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for List { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for HasAttr { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for BinOp { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for UnOp { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for Select { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for If { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for LoadFunc { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for Call { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for Let { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for With { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for Assert { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for ConcatStrings { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for Const { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for Var { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for Thunk { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} - -impl CodeGen for Path { - fn codegen(self, ctx: &JITContext) { - todo!() - } -} diff --git a/src/jit/mod.rs b/src/jit/mod.rs deleted file mode 100644 index 468e83a..0000000 --- a/src/jit/mod.rs +++ /dev/null @@ -1,30 +0,0 @@ -use inkwell::OptimizationLevel; -use inkwell::builder::Builder; -use inkwell::context::Context; -use inkwell::execution_engine::ExecutionEngine; -use inkwell::module::Module; - -mod codegen; - -pub use codegen::CodeGen; - -pub struct JITContext<'ctx> { - context: &'ctx Context, - module: Module<'ctx>, - builder: Builder<'ctx>, - execution_engine: ExecutionEngine<'ctx>, -} - -impl<'ctx> JITContext<'ctx> { - pub fn new(context: &Context) -> JITContext { - let module = context.create_module("nixjit"); - JITContext { - execution_engine: module - .create_jit_execution_engine(OptimizationLevel::None) - .unwrap(), - builder: context.create_builder(), - context, - module, - } - } -} diff --git a/src/lib.rs b/src/lib.rs index 09c0095..a72a6e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,9 +7,6 @@ mod ty; pub mod compile; pub mod error; pub mod ir; -#[cfg(feature = "jit")] -pub mod jit; -#[cfg(feature = "vm")] pub mod vm; pub use ty::public::Value;