feat: at least it compiles, right?

This commit is contained in:
2025-06-12 20:12:31 +08:00
parent 7293cb9f75
commit 49255948ff
22 changed files with 383 additions and 251 deletions

View File

@@ -14,7 +14,7 @@ impl JITCompile for Attrs {
}
}
impl JITCompile for List {
impl JITCompile for List {
fn compile<'gc>(self, ctx: &JITContext<'gc>) {
todo!()
}
@@ -32,7 +32,7 @@ impl JITCompile for BinOp {
}
}
impl JITCompile for UnOp {
impl JITCompile for UnOp {
fn compile<'gc>(self, ctx: &JITContext<'gc>) {
todo!()
}
@@ -91,13 +91,13 @@ impl JITCompile for Const {
todo!()
}
}
impl JITCompile for String {
fn compile<'gc>(self, ctx: &JITContext<'gc>) {
todo!()
}
}
impl JITCompile for Var {
fn compile<'gc>(self, ctx: &JITContext<'gc>) {
todo!()
@@ -124,6 +124,6 @@ impl JITCompile for Thunk {
impl JITCompile for Path {
fn compile<'gc>(self, ctx: &JITContext<'gc>) {
todo!()
todo!()
}
}

View File

@@ -10,7 +10,7 @@ use inkwell::values::{BasicValueEnum, FunctionValue};
use crate::env::VmEnv;
use crate::eval::Engine;
use super::{JITContext, JITValue, ValueTag, JITValueData};
use super::{JITContext, JITValue, JITValueData, ValueTag};
pub struct Helpers<'ctx> {
pub int_type: IntType<'ctx>,
@@ -341,9 +341,7 @@ extern "C" fn helper_arg(idx: usize, env: *const VmEnv) -> JITValue {
}
extern "C" fn helper_lookup_let(level: usize, idx: usize, env: *const VmEnv) -> JITValue {
let env = unsafe { env.as_ref() }.unwrap();
let val: JITValue = env.lookup_let(level, idx).clone().into();
val
todo!()
}
extern "C" fn helper_lookup(sym: usize, env: *const VmEnv) -> JITValue {

View File

@@ -1,5 +1,5 @@
use std::ops::Deref;
use std::marker::PhantomData;
use std::ops::Deref;
use inkwell::OptimizationLevel;
use inkwell::builder::Builder;
@@ -10,8 +10,8 @@ use inkwell::module::Module;
use crate::env::VmEnv;
use crate::ty::internal::Value;
mod helpers;
mod compile;
mod helpers;
pub use compile::JITCompile;
use helpers::Helpers;
@@ -105,7 +105,6 @@ impl Deref for JITFunc<'_> {
}
}
pub struct JITContext<'ctx> {
context: &'ctx Context,
module: Module<'ctx>,

View File

@@ -8,8 +8,8 @@ use inkwell::context::Context;
use ecow::EcoString;
use crate::ir::downgrade;
use super::JITContext;
use crate::ir::downgrade;
use crate::ty::common::Const;
use crate::ty::public::*;