mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Thread LayoutInterner trait through
This commit is contained in:
parent
b1424afefd
commit
fdbc0ebdad
5 changed files with 53 additions and 54 deletions
|
@ -7,8 +7,7 @@ The user needs to analyse the Wasm module's memory to decode the result.
|
||||||
use bumpalo::{collections::Vec, Bump};
|
use bumpalo::{collections::Vec, Bump};
|
||||||
|
|
||||||
use roc_builtins::bitcode::{FloatWidth, IntWidth};
|
use roc_builtins::bitcode::{FloatWidth, IntWidth};
|
||||||
use roc_intern::Interner;
|
use roc_mono::layout::{Builtin, Layout, LayoutInterner, UnionLayout};
|
||||||
use roc_mono::layout::{Builtin, Layout, UnionLayout};
|
|
||||||
use roc_std::{RocDec, RocList, RocOrder, RocResult, RocStr, I128, U128};
|
use roc_std::{RocDec, RocList, RocOrder, RocResult, RocStr, I128, U128};
|
||||||
use roc_target::TargetInfo;
|
use roc_target::TargetInfo;
|
||||||
use roc_wasm_module::{
|
use roc_wasm_module::{
|
||||||
|
@ -39,7 +38,7 @@ pub trait Wasm32Result {
|
||||||
/// Layout-driven wrapper generation
|
/// Layout-driven wrapper generation
|
||||||
pub fn insert_wrapper_for_layout<'a>(
|
pub fn insert_wrapper_for_layout<'a>(
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
interner: &impl Interner<'a, Layout<'a>>,
|
interner: &impl LayoutInterner<'a>,
|
||||||
module: &mut WasmModule<'a>,
|
module: &mut WasmModule<'a>,
|
||||||
wrapper_name: &'static str,
|
wrapper_name: &'static str,
|
||||||
main_fn_index: u32,
|
main_fn_index: u32,
|
||||||
|
|
|
@ -11,7 +11,9 @@ use crate::code_gen_help::let_lowlevel;
|
||||||
use crate::ir::{
|
use crate::ir::{
|
||||||
BranchInfo, Call, CallType, Expr, JoinPointId, Literal, ModifyRc, Param, Stmt, UpdateModeId,
|
BranchInfo, Call, CallType, Expr, JoinPointId, Literal, ModifyRc, Param, Stmt, UpdateModeId,
|
||||||
};
|
};
|
||||||
use crate::layout::{Builtin, InLayout, Layout, STLayoutInterner, TagIdIntType, UnionLayout};
|
use crate::layout::{
|
||||||
|
Builtin, InLayout, Layout, LayoutInterner, STLayoutInterner, TagIdIntType, UnionLayout,
|
||||||
|
};
|
||||||
|
|
||||||
use super::{CodeGenHelp, Context, HelperOp};
|
use super::{CodeGenHelp, Context, HelperOp};
|
||||||
|
|
||||||
|
@ -420,7 +422,7 @@ pub fn refcount_reset_proc_body<'a>(
|
||||||
// progress incrementally. Kept in sync with generate_procs using assertions.
|
// progress incrementally. Kept in sync with generate_procs using assertions.
|
||||||
pub fn is_rc_implemented_yet<'a, I>(interner: &I, layout: &Layout<'a>) -> bool
|
pub fn is_rc_implemented_yet<'a, I>(interner: &I, layout: &Layout<'a>) -> bool
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
use UnionLayout::*;
|
use UnionLayout::*;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
use roc_intern::Interner;
|
|
||||||
use roc_module::symbol::{Interns, Symbol};
|
use roc_module::symbol::{Interns, Symbol};
|
||||||
use ven_pretty::{Arena, DocAllocator, DocBuilder};
|
use ven_pretty::{Arena, DocAllocator, DocBuilder};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ir::{Parens, ProcLayout},
|
ir::{Parens, ProcLayout},
|
||||||
layout::Layout,
|
layout::{Layout, LayoutInterner},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
@ -20,7 +19,7 @@ pub fn format_problems<'a, I>(
|
||||||
problems: Problems<'a>,
|
problems: Problems<'a>,
|
||||||
) -> impl Display
|
) -> impl Display
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let Problems(problems) = problems;
|
let Problems(problems) = problems;
|
||||||
let f = Arena::new();
|
let f = Arena::new();
|
||||||
|
@ -44,7 +43,7 @@ fn format_problem<'a, 'd, I>(
|
||||||
) -> Doc<'d>
|
) -> Doc<'d>
|
||||||
where
|
where
|
||||||
'a: 'd,
|
'a: 'd,
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let Problem {
|
let Problem {
|
||||||
proc,
|
proc,
|
||||||
|
@ -118,7 +117,7 @@ fn format_kind<'a, 'd, I>(
|
||||||
kind: ProblemKind<'a>,
|
kind: ProblemKind<'a>,
|
||||||
) -> (&'static str, Vec<(usize, Doc<'d>)>, Doc<'d>)
|
) -> (&'static str, Vec<(usize, Doc<'d>)>, Doc<'d>)
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let title;
|
let title;
|
||||||
let docs_before;
|
let docs_before;
|
||||||
|
@ -445,7 +444,7 @@ fn format_proc_spec<'a, 'd, I>(
|
||||||
proc_layout: ProcLayout<'a>,
|
proc_layout: ProcLayout<'a>,
|
||||||
) -> Doc<'d>
|
) -> Doc<'d>
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
f.concat([
|
f.concat([
|
||||||
f.as_string(symbol.as_str(interns)),
|
f.as_string(symbol.as_str(interns)),
|
||||||
|
@ -460,7 +459,7 @@ fn format_proc_layout<'a, 'd, I>(
|
||||||
proc_layout: ProcLayout<'a>,
|
proc_layout: ProcLayout<'a>,
|
||||||
) -> Doc<'d>
|
) -> Doc<'d>
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let ProcLayout {
|
let ProcLayout {
|
||||||
arguments,
|
arguments,
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
use crate::layout::{
|
use crate::layout::{
|
||||||
self, Builtin, ClosureCallOptions, ClosureRepresentation, EnumDispatch, LambdaName, LambdaSet,
|
self, Builtin, ClosureCallOptions, ClosureRepresentation, EnumDispatch, LambdaName, LambdaSet,
|
||||||
Layout, LayoutCache, LayoutProblem, Niche, RawFunctionLayout, STLayoutInterner, TagIdIntType,
|
Layout, LayoutCache, LayoutInterner, LayoutProblem, Niche, RawFunctionLayout, STLayoutInterner,
|
||||||
UnionLayout, WrappedVariant,
|
TagIdIntType, UnionLayout, WrappedVariant,
|
||||||
};
|
};
|
||||||
use bumpalo::collections::{CollectIn, Vec};
|
use bumpalo::collections::{CollectIn, Vec};
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
|
@ -22,7 +22,6 @@ use roc_debug_flags::{
|
||||||
use roc_derive::SharedDerivedModule;
|
use roc_derive::SharedDerivedModule;
|
||||||
use roc_error_macros::{internal_error, todo_abilities};
|
use roc_error_macros::{internal_error, todo_abilities};
|
||||||
use roc_exhaustive::{Ctor, CtorName, ListArity, RenderAs, TagId};
|
use roc_exhaustive::{Ctor, CtorName, ListArity, RenderAs, TagId};
|
||||||
use roc_intern::Interner;
|
|
||||||
use roc_late_solve::storage::{ExternalModuleStorage, ExternalModuleStorageSnapshot};
|
use roc_late_solve::storage::{ExternalModuleStorage, ExternalModuleStorageSnapshot};
|
||||||
use roc_late_solve::{resolve_ability_specialization, AbilitiesView, Resolved, UnificationFailed};
|
use roc_late_solve::{resolve_ability_specialization, AbilitiesView, Resolved, UnificationFailed};
|
||||||
use roc_module::ident::{ForeignSymbol, Lowercase, TagName};
|
use roc_module::ident::{ForeignSymbol, Lowercase, TagName};
|
||||||
|
@ -339,7 +338,7 @@ impl<'a> Proc<'a> {
|
||||||
D: DocAllocator<'b, A>,
|
D: DocAllocator<'b, A>,
|
||||||
D::Doc: Clone,
|
D::Doc: Clone,
|
||||||
A: Clone,
|
A: Clone,
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let args_doc = self.args.iter().map(|(layout, symbol)| {
|
let args_doc = self.args.iter().map(|(layout, symbol)| {
|
||||||
let arg_doc = symbol_to_doc(alloc, *symbol, pretty);
|
let arg_doc = symbol_to_doc(alloc, *symbol, pretty);
|
||||||
|
@ -382,7 +381,7 @@ impl<'a> Proc<'a> {
|
||||||
|
|
||||||
pub fn to_pretty<I>(&self, interner: &I, width: usize, pretty: bool) -> String
|
pub fn to_pretty<I>(&self, interner: &I, width: usize, pretty: bool) -> String
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let allocator = BoxAllocator;
|
let allocator = BoxAllocator;
|
||||||
let mut w = std::vec::Vec::new();
|
let mut w = std::vec::Vec::new();
|
||||||
|
@ -2173,7 +2172,7 @@ impl<'a> Stmt<'a> {
|
||||||
D: DocAllocator<'b, A>,
|
D: DocAllocator<'b, A>,
|
||||||
D::Doc: Clone,
|
D::Doc: Clone,
|
||||||
A: Clone,
|
A: Clone,
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
use Stmt::*;
|
use Stmt::*;
|
||||||
|
|
||||||
|
@ -2329,7 +2328,7 @@ impl<'a> Stmt<'a> {
|
||||||
|
|
||||||
pub fn to_pretty<I>(&self, interner: &I, width: usize, pretty: bool) -> String
|
pub fn to_pretty<I>(&self, interner: &I, width: usize, pretty: bool) -> String
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let allocator = BoxAllocator;
|
let allocator = BoxAllocator;
|
||||||
let mut w = std::vec::Vec::new();
|
let mut w = std::vec::Vec::new();
|
||||||
|
|
|
@ -743,7 +743,7 @@ impl<'a> UnionLayout<'a> {
|
||||||
D: DocAllocator<'b, A>,
|
D: DocAllocator<'b, A>,
|
||||||
D::Doc: Clone,
|
D::Doc: Clone,
|
||||||
A: Clone,
|
A: Clone,
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
use UnionLayout::*;
|
use UnionLayout::*;
|
||||||
|
|
||||||
|
@ -982,7 +982,7 @@ impl<'a> UnionLayout<'a> {
|
||||||
target_info: TargetInfo,
|
target_info: TargetInfo,
|
||||||
) -> u32
|
) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
tags.iter()
|
tags.iter()
|
||||||
.map(|field_layouts| {
|
.map(|field_layouts| {
|
||||||
|
@ -994,7 +994,7 @@ impl<'a> UnionLayout<'a> {
|
||||||
|
|
||||||
pub fn allocation_alignment_bytes<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
pub fn allocation_alignment_bytes<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let allocation = match self {
|
let allocation = match self {
|
||||||
UnionLayout::NonRecursive(tags) => {
|
UnionLayout::NonRecursive(tags) => {
|
||||||
|
@ -1019,7 +1019,7 @@ impl<'a> UnionLayout<'a> {
|
||||||
/// Size of the data in memory, whether it's stack or heap (for non-null tag ids)
|
/// Size of the data in memory, whether it's stack or heap (for non-null tag ids)
|
||||||
pub fn data_size_and_alignment<I>(&self, interner: &I, target_info: TargetInfo) -> (u32, u32)
|
pub fn data_size_and_alignment<I>(&self, interner: &I, target_info: TargetInfo) -> (u32, u32)
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let (data_width, data_align) =
|
let (data_width, data_align) =
|
||||||
self.data_size_and_alignment_help_match(interner, target_info);
|
self.data_size_and_alignment_help_match(interner, target_info);
|
||||||
|
@ -1052,7 +1052,7 @@ impl<'a> UnionLayout<'a> {
|
||||||
/// Returns None if the tag_id is not stored as data in the layout.
|
/// Returns None if the tag_id is not stored as data in the layout.
|
||||||
pub fn data_size_without_tag_id<I>(&self, interner: &I, target_info: TargetInfo) -> Option<u32>
|
pub fn data_size_without_tag_id<I>(&self, interner: &I, target_info: TargetInfo) -> Option<u32>
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
if !self.stores_tag_id_as_data(target_info) {
|
if !self.stores_tag_id_as_data(target_info) {
|
||||||
return None;
|
return None;
|
||||||
|
@ -1070,7 +1070,7 @@ impl<'a> UnionLayout<'a> {
|
||||||
target_info: TargetInfo,
|
target_info: TargetInfo,
|
||||||
) -> (u32, u32)
|
) -> (u32, u32)
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
Self::NonRecursive(tags) => {
|
Self::NonRecursive(tags) => {
|
||||||
|
@ -1093,7 +1093,7 @@ impl<'a> UnionLayout<'a> {
|
||||||
|
|
||||||
pub fn tag_id_offset<I>(&self, interner: &I, target_info: TargetInfo) -> Option<u32>
|
pub fn tag_id_offset<I>(&self, interner: &I, target_info: TargetInfo) -> Option<u32>
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
UnionLayout::NonRecursive(tags)
|
UnionLayout::NonRecursive(tags)
|
||||||
|
@ -1111,7 +1111,7 @@ impl<'a> UnionLayout<'a> {
|
||||||
target_info: TargetInfo,
|
target_info: TargetInfo,
|
||||||
) -> u32
|
) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let (data_width, data_align) =
|
let (data_width, data_align) =
|
||||||
Layout::stack_size_and_alignment_slices(interner, layouts, target_info);
|
Layout::stack_size_and_alignment_slices(interner, layouts, target_info);
|
||||||
|
@ -1122,7 +1122,7 @@ impl<'a> UnionLayout<'a> {
|
||||||
/// Very important to use this when doing a memcpy!
|
/// Very important to use this when doing a memcpy!
|
||||||
fn stack_size_without_alignment<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
fn stack_size_without_alignment<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
UnionLayout::NonRecursive(_) => {
|
UnionLayout::NonRecursive(_) => {
|
||||||
|
@ -1281,7 +1281,7 @@ impl<'a> Niche<'a> {
|
||||||
D: DocAllocator<'b, A>,
|
D: DocAllocator<'b, A>,
|
||||||
D::Doc: Clone,
|
D::Doc: Clone,
|
||||||
A: Clone,
|
A: Clone,
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
match self.0 {
|
match self.0 {
|
||||||
NichePriv::Captures(captures) => alloc.concat([
|
NichePriv::Captures(captures) => alloc.concat([
|
||||||
|
@ -1394,7 +1394,7 @@ pub enum ClosureCallOptions<'a> {
|
||||||
impl<'a> LambdaSet<'a> {
|
impl<'a> LambdaSet<'a> {
|
||||||
pub fn runtime_representation<I>(&self, interner: &I) -> Layout<'a>
|
pub fn runtime_representation<I>(&self, interner: &I) -> Layout<'a>
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
*interner.get(self.representation)
|
*interner.get(self.representation)
|
||||||
}
|
}
|
||||||
|
@ -1406,7 +1406,7 @@ impl<'a> LambdaSet<'a> {
|
||||||
|
|
||||||
pub fn is_represented<I>(&self, interner: &I) -> Option<Layout<'a>>
|
pub fn is_represented<I>(&self, interner: &I) -> Option<Layout<'a>>
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
if self.has_unwrapped_capture_repr() {
|
if self.has_unwrapped_capture_repr() {
|
||||||
let repr = interner.get(self.representation);
|
let repr = interner.get(self.representation);
|
||||||
|
@ -1450,7 +1450,7 @@ impl<'a> LambdaSet<'a> {
|
||||||
lambda_name: LambdaName,
|
lambda_name: LambdaName,
|
||||||
) -> ClosureRepresentation<'a>
|
) -> ClosureRepresentation<'a>
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
debug_assert!(self.contains(lambda_name.name));
|
debug_assert!(self.contains(lambda_name.name));
|
||||||
|
|
||||||
|
@ -1475,7 +1475,7 @@ impl<'a> LambdaSet<'a> {
|
||||||
captures_layouts: &[Layout],
|
captures_layouts: &[Layout],
|
||||||
) -> LambdaName<'a>
|
) -> LambdaName<'a>
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
self.contains(function_symbol),
|
self.contains(function_symbol),
|
||||||
|
@ -1516,7 +1516,7 @@ impl<'a> LambdaSet<'a> {
|
||||||
/// Resolves recursive pointers to the layout of the lambda set.
|
/// Resolves recursive pointers to the layout of the lambda set.
|
||||||
fn capture_layouts_eq<I>(&self, interner: &I, left: &InLayout<'a>, right: &Layout) -> bool
|
fn capture_layouts_eq<I>(&self, interner: &I, left: &InLayout<'a>, right: &Layout) -> bool
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let left = interner.get(*left);
|
let left = interner.get(*left);
|
||||||
if left == right {
|
if left == right {
|
||||||
|
@ -1550,7 +1550,7 @@ impl<'a> LambdaSet<'a> {
|
||||||
|
|
||||||
fn layout_for_member<I, F>(&self, interner: &I, comparator: F) -> ClosureRepresentation<'a>
|
fn layout_for_member<I, F>(&self, interner: &I, comparator: F) -> ClosureRepresentation<'a>
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
F: Fn(Symbol, &[InLayout]) -> bool,
|
F: Fn(Symbol, &[InLayout]) -> bool,
|
||||||
{
|
{
|
||||||
if self.has_unwrapped_capture_repr() {
|
if self.has_unwrapped_capture_repr() {
|
||||||
|
@ -1663,7 +1663,7 @@ impl<'a> LambdaSet<'a> {
|
||||||
|
|
||||||
pub fn call_by_name_options<I>(&self, interner: &I) -> ClosureCallOptions<'a>
|
pub fn call_by_name_options<I>(&self, interner: &I) -> ClosureCallOptions<'a>
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let repr = interner.get(self.representation);
|
let repr = interner.get(self.representation);
|
||||||
|
|
||||||
|
@ -1907,7 +1907,7 @@ impl<'a> LambdaSet<'a> {
|
||||||
|
|
||||||
pub fn stack_size<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
pub fn stack_size<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
interner
|
interner
|
||||||
.get(self.representation)
|
.get(self.representation)
|
||||||
|
@ -1915,7 +1915,7 @@ impl<'a> LambdaSet<'a> {
|
||||||
}
|
}
|
||||||
pub fn contains_refcounted<I>(&self, interner: &I) -> bool
|
pub fn contains_refcounted<I>(&self, interner: &I) -> bool
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
interner
|
interner
|
||||||
.get(self.representation)
|
.get(self.representation)
|
||||||
|
@ -1923,14 +1923,14 @@ impl<'a> LambdaSet<'a> {
|
||||||
}
|
}
|
||||||
pub fn safe_to_memcpy<I>(&self, interner: &I) -> bool
|
pub fn safe_to_memcpy<I>(&self, interner: &I) -> bool
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
interner.get(self.representation).safe_to_memcpy(interner)
|
interner.get(self.representation).safe_to_memcpy(interner)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alignment_bytes<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
pub fn alignment_bytes<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
interner
|
interner
|
||||||
.get(self.representation)
|
.get(self.representation)
|
||||||
|
@ -2399,7 +2399,7 @@ impl<'a> Layout<'a> {
|
||||||
|
|
||||||
pub fn safe_to_memcpy<I>(&self, interner: &I) -> bool
|
pub fn safe_to_memcpy<I>(&self, interner: &I) -> bool
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
use Layout::*;
|
use Layout::*;
|
||||||
|
|
||||||
|
@ -2445,7 +2445,7 @@ impl<'a> Layout<'a> {
|
||||||
|
|
||||||
pub fn is_passed_by_reference<I>(&self, interner: &I, target_info: TargetInfo) -> bool
|
pub fn is_passed_by_reference<I>(&self, interner: &I, target_info: TargetInfo) -> bool
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
Layout::Builtin(builtin) => {
|
Layout::Builtin(builtin) => {
|
||||||
|
@ -2472,7 +2472,7 @@ impl<'a> Layout<'a> {
|
||||||
|
|
||||||
pub fn stack_size<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
pub fn stack_size<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let width = self.stack_size_without_alignment(interner, target_info);
|
let width = self.stack_size_without_alignment(interner, target_info);
|
||||||
let alignment = self.alignment_bytes(interner, target_info);
|
let alignment = self.alignment_bytes(interner, target_info);
|
||||||
|
@ -2482,7 +2482,7 @@ impl<'a> Layout<'a> {
|
||||||
|
|
||||||
pub fn stack_size_and_alignment<I>(&self, interner: &I, target_info: TargetInfo) -> (u32, u32)
|
pub fn stack_size_and_alignment<I>(&self, interner: &I, target_info: TargetInfo) -> (u32, u32)
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let width = self.stack_size_without_alignment(interner, target_info);
|
let width = self.stack_size_without_alignment(interner, target_info);
|
||||||
let alignment = self.alignment_bytes(interner, target_info);
|
let alignment = self.alignment_bytes(interner, target_info);
|
||||||
|
@ -2494,7 +2494,7 @@ impl<'a> Layout<'a> {
|
||||||
/// Very important to use this when doing a memcpy!
|
/// Very important to use this when doing a memcpy!
|
||||||
pub fn stack_size_without_alignment<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
pub fn stack_size_without_alignment<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
use Layout::*;
|
use Layout::*;
|
||||||
|
|
||||||
|
@ -2520,7 +2520,7 @@ impl<'a> Layout<'a> {
|
||||||
|
|
||||||
pub fn alignment_bytes<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
pub fn alignment_bytes<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
Layout::Struct { field_layouts, .. } => field_layouts
|
Layout::Struct { field_layouts, .. } => field_layouts
|
||||||
|
@ -2572,7 +2572,7 @@ impl<'a> Layout<'a> {
|
||||||
|
|
||||||
pub fn allocation_alignment_bytes<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
pub fn allocation_alignment_bytes<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let ptr_width = target_info.ptr_width() as u32;
|
let ptr_width = target_info.ptr_width() as u32;
|
||||||
|
|
||||||
|
@ -2598,7 +2598,7 @@ impl<'a> Layout<'a> {
|
||||||
target_info: TargetInfo,
|
target_info: TargetInfo,
|
||||||
) -> (u32, u32)
|
) -> (u32, u32)
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let mut data_align = 1;
|
let mut data_align = 1;
|
||||||
let mut data_width = 0;
|
let mut data_width = 0;
|
||||||
|
@ -2642,7 +2642,7 @@ impl<'a> Layout<'a> {
|
||||||
/// goes out of scope, the refcount on those values/fields must be decremented.
|
/// goes out of scope, the refcount on those values/fields must be decremented.
|
||||||
pub fn contains_refcounted<I>(&self, interner: &I) -> bool
|
pub fn contains_refcounted<I>(&self, interner: &I) -> bool
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
use Layout::*;
|
use Layout::*;
|
||||||
|
|
||||||
|
@ -2683,7 +2683,7 @@ impl<'a> Layout<'a> {
|
||||||
D: DocAllocator<'b, A>,
|
D: DocAllocator<'b, A>,
|
||||||
D::Doc: Clone,
|
D::Doc: Clone,
|
||||||
A: Clone,
|
A: Clone,
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
use Layout::*;
|
use Layout::*;
|
||||||
|
|
||||||
|
@ -2725,7 +2725,7 @@ impl<'a> Layout<'a> {
|
||||||
|
|
||||||
pub fn runtime_representation<I>(&self, interner: &I) -> Self
|
pub fn runtime_representation<I>(&self, interner: &I) -> Self
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
Layout::LambdaSet(lambda_set) => lambda_set.runtime_representation(interner),
|
Layout::LambdaSet(lambda_set) => lambda_set.runtime_representation(interner),
|
||||||
|
@ -2927,7 +2927,7 @@ impl<'a> Builtin<'a> {
|
||||||
D: DocAllocator<'b, A>,
|
D: DocAllocator<'b, A>,
|
||||||
D::Doc: Clone,
|
D::Doc: Clone,
|
||||||
A: Clone,
|
A: Clone,
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
use Builtin::*;
|
use Builtin::*;
|
||||||
|
|
||||||
|
@ -2973,7 +2973,7 @@ impl<'a> Builtin<'a> {
|
||||||
|
|
||||||
pub fn allocation_alignment_bytes<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
pub fn allocation_alignment_bytes<I>(&self, interner: &I, target_info: TargetInfo) -> u32
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let ptr_width = target_info.ptr_width() as u32;
|
let ptr_width = target_info.ptr_width() as u32;
|
||||||
|
|
||||||
|
@ -4377,7 +4377,7 @@ pub fn cmp_fields<'a, L: Ord, I>(
|
||||||
target_info: TargetInfo,
|
target_info: TargetInfo,
|
||||||
) -> Ordering
|
) -> Ordering
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let size1 = layout1.alignment_bytes(interner, target_info);
|
let size1 = layout1.alignment_bytes(interner, target_info);
|
||||||
let size2 = layout2.alignment_bytes(interner, target_info);
|
let size2 = layout2.alignment_bytes(interner, target_info);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue