mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
the setup
This commit is contained in:
parent
dca9404772
commit
8144d7b390
2 changed files with 80 additions and 1 deletions
|
@ -2039,6 +2039,12 @@ fn finish_specialization(
|
||||||
subs: Subs,
|
subs: Subs,
|
||||||
exposed_to_host: ExposedToHost,
|
exposed_to_host: ExposedToHost,
|
||||||
) -> Result<MonomorphizedModule, LoadingProblem> {
|
) -> Result<MonomorphizedModule, LoadingProblem> {
|
||||||
|
if true {
|
||||||
|
println!(
|
||||||
|
"total Type clones: {} ",
|
||||||
|
roc_types::types::get_type_clone_count()
|
||||||
|
);
|
||||||
|
}
|
||||||
let module_ids = Arc::try_unwrap(state.arc_modules)
|
let module_ids = Arc::try_unwrap(state.arc_modules)
|
||||||
.unwrap_or_else(|_| panic!("There were still outstanding Arc references to module_ids"))
|
.unwrap_or_else(|_| panic!("There were still outstanding Arc references to module_ids"))
|
||||||
.into_inner()
|
.into_inner()
|
||||||
|
|
|
@ -166,7 +166,7 @@ impl LambdaSet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone)]
|
#[derive(PartialEq, Eq)]
|
||||||
pub enum Type {
|
pub enum Type {
|
||||||
EmptyRec,
|
EmptyRec,
|
||||||
EmptyTagUnion,
|
EmptyTagUnion,
|
||||||
|
@ -203,6 +203,79 @@ pub enum Type {
|
||||||
Erroneous(Problem),
|
Erroneous(Problem),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq, Eq, Clone)]
|
||||||
|
enum TypeExtension {
|
||||||
|
Open(Box<Type>),
|
||||||
|
Closed,
|
||||||
|
}
|
||||||
|
|
||||||
|
static mut TYPE_CLONE_COUNT: std::sync::atomic::AtomicUsize =
|
||||||
|
std::sync::atomic::AtomicUsize::new(0);
|
||||||
|
|
||||||
|
pub fn get_type_clone_count() -> usize {
|
||||||
|
unsafe { TYPE_CLONE_COUNT.load(std::sync::atomic::Ordering::SeqCst) }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Clone for Type {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
match self {
|
||||||
|
Self::EmptyRec => {
|
||||||
|
unsafe { TYPE_CLONE_COUNT.fetch_add(1, std::sync::atomic::Ordering::SeqCst) };
|
||||||
|
Self::EmptyRec
|
||||||
|
}
|
||||||
|
Self::EmptyTagUnion => {
|
||||||
|
unsafe { TYPE_CLONE_COUNT.fetch_add(1, std::sync::atomic::Ordering::SeqCst) };
|
||||||
|
Self::EmptyTagUnion
|
||||||
|
}
|
||||||
|
Self::Function(arg0, arg1, arg2) => {
|
||||||
|
Self::Function(arg0.clone(), arg1.clone(), arg2.clone())
|
||||||
|
}
|
||||||
|
Self::Record(arg0, arg1) => Self::Record(arg0.clone(), arg1.clone()),
|
||||||
|
Self::TagUnion(arg0, arg1) => Self::TagUnion(arg0.clone(), arg1.clone()),
|
||||||
|
Self::FunctionOrTagUnion(arg0, arg1, arg2) => {
|
||||||
|
Self::FunctionOrTagUnion(arg0.clone(), arg1.clone(), arg2.clone())
|
||||||
|
}
|
||||||
|
Self::ClosureTag { name, ext } => Self::ClosureTag {
|
||||||
|
name: name.clone(),
|
||||||
|
ext: ext.clone(),
|
||||||
|
},
|
||||||
|
Self::Alias {
|
||||||
|
symbol,
|
||||||
|
type_arguments,
|
||||||
|
lambda_set_variables,
|
||||||
|
actual,
|
||||||
|
kind,
|
||||||
|
} => Self::Alias {
|
||||||
|
symbol: symbol.clone(),
|
||||||
|
type_arguments: type_arguments.clone(),
|
||||||
|
lambda_set_variables: lambda_set_variables.clone(),
|
||||||
|
actual: actual.clone(),
|
||||||
|
kind: kind.clone(),
|
||||||
|
},
|
||||||
|
Self::HostExposedAlias {
|
||||||
|
name,
|
||||||
|
type_arguments,
|
||||||
|
lambda_set_variables,
|
||||||
|
actual_var,
|
||||||
|
actual,
|
||||||
|
} => Self::HostExposedAlias {
|
||||||
|
name: name.clone(),
|
||||||
|
type_arguments: type_arguments.clone(),
|
||||||
|
lambda_set_variables: lambda_set_variables.clone(),
|
||||||
|
actual_var: actual_var.clone(),
|
||||||
|
actual: actual.clone(),
|
||||||
|
},
|
||||||
|
Self::RecursiveTagUnion(arg0, arg1, arg2) => {
|
||||||
|
Self::RecursiveTagUnion(arg0.clone(), arg1.clone(), arg2.clone())
|
||||||
|
}
|
||||||
|
Self::Apply(arg0, arg1, arg2) => Self::Apply(arg0.clone(), arg1.clone(), arg2.clone()),
|
||||||
|
Self::Variable(arg0) => Self::Variable(arg0.clone()),
|
||||||
|
Self::RangedNumber(arg0, arg1) => Self::RangedNumber(arg0.clone(), arg1.clone()),
|
||||||
|
Self::Erroneous(arg0) => Self::Erroneous(arg0.clone()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Type {
|
impl fmt::Debug for Type {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue