feat: get rid of gc and cyclic thunk

This commit is contained in:
2025-06-05 16:43:47 +08:00
parent 51f8df9cca
commit 484cfa4610
17 changed files with 342 additions and 595 deletions

View File

@@ -1,5 +1,4 @@
use ecow::EcoString;
use gc_arena::Collect;
use hashbrown::HashMap;
use crate::ty::common::Const;
@@ -9,8 +8,7 @@ type Slice<T> = Box<[T]>;
pub type OpCodes = Slice<OpCode>;
#[derive(Debug, Clone, Copy, Collect)]
#[collect(no_drop)]
#[derive(Debug, Clone, Copy)]
pub enum OpCode {
/// load a constant onto stack
Const { idx: usize },
@@ -90,8 +88,7 @@ pub enum OpCode {
Illegal,
}
#[derive(Debug, Clone, Copy, Collect)]
#[collect(no_drop)]
#[derive(Debug, Clone, Copy)]
pub enum BinOp {
Add,
Sub,
@@ -105,15 +102,13 @@ pub enum BinOp {
Upd,
}
#[derive(Debug, Clone, Copy, Collect)]
#[collect(no_drop)]
#[derive(Debug, Clone, Copy)]
pub enum UnOp {
Neg,
Not,
}
#[derive(Debug, Collect)]
#[collect(no_drop)]
#[derive(Debug)]
pub struct Func {
pub param: Param,
pub opcodes: OpCodes,