feat(jit): fix segfault
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use inkwell::execution_engine::JitFunction;
|
||||
use std::cell::{Cell, OnceCell, RefCell};
|
||||
|
||||
use crate::builtins::env;
|
||||
@@ -81,8 +82,8 @@ impl<'vm, 'jit: 'vm> VM<'jit> {
|
||||
pub fn eval(
|
||||
&'vm self,
|
||||
opcodes: impl Iterator<Item = OpCode>,
|
||||
mut env: Env<'vm>,
|
||||
) -> Result<Value<'vm>> {
|
||||
mut env: Env<'jit, 'vm>,
|
||||
) -> Result<Value<'jit, 'vm>> {
|
||||
let mut stack = Stack::<_, STACK_SIZE>::new();
|
||||
let mut iter = opcodes.into_iter();
|
||||
while let Some(opcode) = iter.next() {
|
||||
@@ -101,8 +102,8 @@ impl<'vm, 'jit: 'vm> VM<'jit> {
|
||||
fn single_op<'s, const CAP: usize>(
|
||||
&'vm self,
|
||||
opcode: OpCode,
|
||||
stack: &'s mut Stack<Value<'vm>, CAP>,
|
||||
env: &mut Env<'vm>,
|
||||
stack: &'s mut Stack<Value<'jit, 'vm>, CAP>,
|
||||
env: &mut Env<'jit, 'vm>,
|
||||
) -> Result<usize> {
|
||||
match opcode {
|
||||
OpCode::Illegal => panic!("illegal opcode"),
|
||||
@@ -264,7 +265,7 @@ impl<'vm, 'jit: 'vm> VM<'jit> {
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
pub fn compile_func(&'vm self, func: &'vm F) -> &'vm JITFunc<'vm> {
|
||||
pub fn compile_func(&'vm self, func: &'vm F) -> JitFunction<'jit, JITFunc<'jit, 'vm>> {
|
||||
self.jit.compile_function(func, self).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user