remove Pointer

This commit is contained in:
Folkert 2021-05-26 14:18:19 +02:00
parent ca5e9518d9
commit bfe49d2188
8 changed files with 2 additions and 28 deletions

View file

@ -241,7 +241,6 @@ fn jit_to_ast_help<'a>(
Layout::Closure(_, _, _) => Err(ToAstProblem::FunctionLayout),
Layout::FunctionPointer(_, _) => Err(ToAstProblem::FunctionLayout),
Layout::Pointer(_) => todo!("add support for rendering pointers in the REPL"),
}
}

View file

@ -3363,7 +3363,6 @@ pub fn build_proc<'a, 'ctx, 'env>(
Layout::Struct(_) => {}
Layout::Union(_) => {}
Layout::RecursivePointer => {}
Layout::Pointer(_) => {}
}
}
}

View file

@ -86,10 +86,6 @@ fn build_hash_layout<'a, 'ctx, 'env>(
}
},
Layout::Pointer(_) => {
unreachable!("unused")
}
Layout::FunctionPointer(_, _) | Layout::Closure(_, _, _) => {
unreachable!("the type system will guarantee these are never hashed")
}

View file

@ -192,10 +192,6 @@ fn build_eq<'a, 'ctx, 'env>(
}
},
Layout::Pointer(_) => {
unreachable!("unused")
}
Layout::FunctionPointer(_, _) | Layout::Closure(_, _, _) => {
unreachable!("the type system will guarantee these are never compared")
}
@ -337,10 +333,6 @@ fn build_neq<'a, 'ctx, 'env>(
unreachable!("recursion pointers should never be compared directly")
}
Layout::Pointer(_) => {
unreachable!("unused")
}
Layout::FunctionPointer(_, _) | Layout::Closure(_, _, _) => {
unreachable!("the type system will guarantee these are never compared")
}

View file

@ -112,9 +112,6 @@ pub fn basic_type_from_layout<'a, 'ctx, 'env>(
let closure_data_layout = closure_layout.runtime_representation();
basic_type_from_layout(env, &closure_data_layout)
}
Pointer(layout) => basic_type_from_layout(env, &layout)
.ptr_type(AddressSpace::Generic)
.into(),
Struct(sorted_fields) => basic_type_from_record(env, sorted_fields),
Union(variant) => {
use UnionLayout::*;

View file

@ -744,7 +744,7 @@ fn modify_refcount_layout_build_function<'a, 'ctx, 'env>(
}
},
FunctionPointer(_, _) | Pointer(_) => None,
FunctionPointer(_, _) => None,
}
}

View file

@ -533,7 +533,6 @@ fn layout_spec(builder: &mut FuncDefBuilder, layout: &Layout) -> Result<TypeId>
RecursivePointer => todo!(),
FunctionPointer(_, _) => todo!(),
Closure(_, _, _) => todo!(),
Pointer(_) => todo!(),
}
}

View file

@ -42,7 +42,6 @@ pub enum Layout<'a> {
/// A function. The types of its arguments, then the type of its return value.
FunctionPointer(&'a [Layout<'a>], &'a Layout<'a>),
Closure(&'a [Layout<'a>], LambdaSet<'a>, &'a Layout<'a>),
Pointer(&'a Layout<'a>),
}
impl<'a> Layout<'a> {
@ -502,10 +501,6 @@ impl<'a> Layout<'a> {
true
}
Closure(_, closure_layout, _) => closure_layout.safe_to_memcpy(),
Pointer(_) => {
// We cannot memcpy pointers, because then we would have the same pointer in multiple places!
false
}
RecursivePointer => {
// We cannot memcpy pointers, because then we would have the same pointer in multiple places!
false
@ -558,7 +553,6 @@ impl<'a> Layout<'a> {
Closure(_, lambda_set, _) => lambda_set.stack_size(pointer_size),
FunctionPointer(_, _) => pointer_size,
RecursivePointer => pointer_size,
Pointer(_) => pointer_size,
}
}
@ -590,7 +584,6 @@ impl<'a> Layout<'a> {
Layout::Builtin(builtin) => builtin.alignment_bytes(pointer_size),
Layout::RecursivePointer => pointer_size,
Layout::FunctionPointer(_, _) => pointer_size,
Layout::Pointer(_) => pointer_size,
Layout::Closure(_, captured, _) => {
pointer_size.max(captured.alignment_bytes(pointer_size))
}
@ -645,7 +638,7 @@ impl<'a> Layout<'a> {
}
RecursivePointer => true,
Closure(_, closure_layout, _) => closure_layout.contains_refcounted(),
FunctionPointer(_, _) | Pointer(_) => false,
FunctionPointer(_, _) => false,
}
}
@ -691,7 +684,6 @@ impl<'a> Layout<'a> {
.append(" |} -> ")
.append(result.to_doc(alloc, Parens::InFunction))
}
Pointer(_) => todo!(),
}
}
}