mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
removed refcount type from proc
This commit is contained in:
parent
93cc2e579f
commit
d8f1b1bfe4
1 changed files with 1 additions and 18 deletions
|
@ -31,12 +31,6 @@ pub fn insert_inc_dec_operations<'a>(
|
||||||
layout_interner: &STLayoutInterner<'a>,
|
layout_interner: &STLayoutInterner<'a>,
|
||||||
procedures: &mut HashMap<(Symbol, ProcLayout), Proc<'a>, BuildHasherDefault<WyHash>>,
|
procedures: &mut HashMap<(Symbol, ProcLayout), Proc<'a>, BuildHasherDefault<WyHash>>,
|
||||||
) {
|
) {
|
||||||
// Create a SymbolRcTypesEnv for the procedures as they get referenced but should be marked as non reference counted.
|
|
||||||
let mut symbol_rc_types_env = SymbolRcTypesEnv::from_layout_interner(layout_interner);
|
|
||||||
for proc_symbol in procedures.keys().map(|(symbol, _layout)| *symbol) {
|
|
||||||
symbol_rc_types_env.insert_proc_symbol(proc_symbol);
|
|
||||||
}
|
|
||||||
|
|
||||||
// All calls to lowlevels are wrapped in another function to help with type inference and return/parameter layouts.
|
// All calls to lowlevels are wrapped in another function to help with type inference and return/parameter layouts.
|
||||||
// But this lowlevel might get inlined into the caller of the wrapper and thus removing any reference counting operations.
|
// But this lowlevel might get inlined into the caller of the wrapper and thus removing any reference counting operations.
|
||||||
// Thus, these rc operations are performed on the caller of the wrapper instead, and we skip rc on the lowlevel.
|
// Thus, these rc operations are performed on the caller of the wrapper instead, and we skip rc on the lowlevel.
|
||||||
|
@ -47,9 +41,7 @@ pub fn insert_inc_dec_operations<'a>(
|
||||||
LowLevelWrapperType::from_symbol(*symbol),
|
LowLevelWrapperType::from_symbol(*symbol),
|
||||||
LowLevelWrapperType::NotALowLevelWrapper
|
LowLevelWrapperType::NotALowLevelWrapper
|
||||||
) {
|
) {
|
||||||
// Clone the symbol_rc_types_env and insert the symbols in the current procedure.
|
let symbol_rc_types_env = SymbolRcTypesEnv::from_layout_interner(layout_interner);
|
||||||
// As the symbols should be limited in scope for the current proc.
|
|
||||||
let symbol_rc_types_env = symbol_rc_types_env.clone();
|
|
||||||
insert_inc_dec_operations_proc(arena, symbol_rc_types_env, proc);
|
insert_inc_dec_operations_proc(arena, symbol_rc_types_env, proc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,15 +119,6 @@ impl<'a, 'i> SymbolRcTypesEnv<'a, 'i> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Insert the reference count type of top level functions.
|
|
||||||
As functions are not reference counted, they can be marked as such.
|
|
||||||
*/
|
|
||||||
fn insert_proc_symbol(&mut self, proc_symbol: Symbol) {
|
|
||||||
self.symbols_rc_type
|
|
||||||
.insert(proc_symbol, VarRcType::NotReferenceCounted);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Insert the reference count types of all symbols in a procedure.
|
Insert the reference count types of all symbols in a procedure.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue