mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
remove full() function
This commit is contained in:
parent
daa1374678
commit
fe81eabbfa
4 changed files with 12 additions and 12 deletions
|
@ -6,6 +6,7 @@ use roc_gen_llvm::{run_jit_function, run_jit_function_dynamic_type};
|
||||||
use roc_module::ident::{Lowercase, TagName};
|
use roc_module::ident::{Lowercase, TagName};
|
||||||
use roc_module::operator::CalledVia;
|
use roc_module::operator::CalledVia;
|
||||||
use roc_module::symbol::{Interns, ModuleId, Symbol};
|
use roc_module::symbol::{Interns, ModuleId, Symbol};
|
||||||
|
use roc_mono::ir::TopLevelFunctionLayout;
|
||||||
use roc_mono::layout::{union_sorted_tags_help, Builtin, Layout, UnionLayout, UnionVariant};
|
use roc_mono::layout::{union_sorted_tags_help, Builtin, Layout, UnionLayout, UnionVariant};
|
||||||
use roc_parse::ast::{AssignedField, Expr, StrLiteral};
|
use roc_parse::ast::{AssignedField, Expr, StrLiteral};
|
||||||
use roc_region::all::{Located, Region};
|
use roc_region::all::{Located, Region};
|
||||||
|
@ -37,7 +38,7 @@ pub unsafe fn jit_to_ast<'a>(
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
lib: Library,
|
lib: Library,
|
||||||
main_fn_name: &str,
|
main_fn_name: &str,
|
||||||
layout: &Layout<'a>,
|
layout: TopLevelFunctionLayout<'a>,
|
||||||
content: &Content,
|
content: &Content,
|
||||||
interns: &Interns,
|
interns: &Interns,
|
||||||
home: ModuleId,
|
home: ModuleId,
|
||||||
|
@ -53,11 +54,14 @@ pub unsafe fn jit_to_ast<'a>(
|
||||||
};
|
};
|
||||||
|
|
||||||
match layout {
|
match layout {
|
||||||
Layout::FunctionPointer(&[], result) => {
|
TopLevelFunctionLayout {
|
||||||
|
arguments: [],
|
||||||
|
result,
|
||||||
|
} => {
|
||||||
// this is a thunk
|
// this is a thunk
|
||||||
jit_to_ast_help(&env, lib, main_fn_name, result, content)
|
jit_to_ast_help(&env, lib, main_fn_name, &result, content)
|
||||||
}
|
}
|
||||||
_ => jit_to_ast_help(&env, lib, main_fn_name, layout, content),
|
_ => Err(ToAstProblem::FunctionLayout),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ pub fn gen_and_eval<'a>(
|
||||||
&arena,
|
&arena,
|
||||||
lib,
|
lib,
|
||||||
main_fn_name,
|
main_fn_name,
|
||||||
&arena.alloc(main_fn_layout).full(),
|
main_fn_layout,
|
||||||
&content,
|
&content,
|
||||||
&env.interns,
|
&env.interns,
|
||||||
home,
|
home,
|
||||||
|
|
|
@ -118,7 +118,7 @@ impl<'ctx> Iterator for FunctionIterator<'ctx> {
|
||||||
#[derive(Default, Debug, Clone, PartialEq)]
|
#[derive(Default, Debug, Clone, PartialEq)]
|
||||||
pub struct Scope<'a, 'ctx> {
|
pub struct Scope<'a, 'ctx> {
|
||||||
symbols: ImMap<Symbol, (Layout<'a>, BasicValueEnum<'ctx>)>,
|
symbols: ImMap<Symbol, (Layout<'a>, BasicValueEnum<'ctx>)>,
|
||||||
pub top_level_thunks: ImMap<Symbol, (Layout<'a>, FunctionValue<'ctx>)>,
|
pub top_level_thunks: ImMap<Symbol, (TopLevelFunctionLayout<'a>, FunctionValue<'ctx>)>,
|
||||||
join_points: ImMap<JoinPointId, (BasicBlock<'ctx>, &'a [PointerValue<'ctx>])>,
|
join_points: ImMap<JoinPointId, (BasicBlock<'ctx>, &'a [PointerValue<'ctx>])>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ impl<'a, 'ctx> Scope<'a, 'ctx> {
|
||||||
function_value: FunctionValue<'ctx>,
|
function_value: FunctionValue<'ctx>,
|
||||||
) {
|
) {
|
||||||
self.top_level_thunks
|
self.top_level_thunks
|
||||||
.insert(symbol, (layout.full(), function_value));
|
.insert(symbol, (*layout, function_value));
|
||||||
}
|
}
|
||||||
fn remove(&mut self, symbol: &Symbol) {
|
fn remove(&mut self, symbol: &Symbol) {
|
||||||
self.symbols.remove(symbol);
|
self.symbols.remove(symbol);
|
||||||
|
|
|
@ -2624,10 +2624,6 @@ impl<'a> TopLevelFunctionLayout<'a> {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn full(&'a self) -> Layout<'a> {
|
|
||||||
Layout::FunctionPointer(self.arguments, &self.result)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn specialize_naked_symbol<'a>(
|
fn specialize_naked_symbol<'a>(
|
||||||
|
@ -6788,7 +6784,7 @@ fn call_specialized_proc<'a>(
|
||||||
arguments: field_symbols,
|
arguments: field_symbols,
|
||||||
};
|
};
|
||||||
|
|
||||||
build_call(env, call, assigned, function_layout.full(), hole)
|
build_call(env, call, assigned, function_layout.result, hole)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue