From be07cbe49de8d8511e63c2df47e52c84e2e81d98 Mon Sep 17 00:00:00 2001 From: Folkert Date: Thu, 17 Mar 2022 19:48:35 +0100 Subject: [PATCH] remove instrumentation --- compiler/load/src/file.rs | 6 --- compiler/types/src/types.rs | 82 +------------------------------------ 2 files changed, 1 insertion(+), 87 deletions(-) diff --git a/compiler/load/src/file.rs b/compiler/load/src/file.rs index d9fd865828..04f2b034f7 100644 --- a/compiler/load/src/file.rs +++ b/compiler/load/src/file.rs @@ -2039,12 +2039,6 @@ fn finish_specialization( subs: Subs, exposed_to_host: ExposedToHost, ) -> Result { - if false { - println!( - "total Type clones: {} ", - roc_types::types::get_type_clone_count() - ); - } let module_ids = Arc::try_unwrap(state.arc_modules) .unwrap_or_else(|_| panic!("There were still outstanding Arc references to module_ids")) .into_inner() diff --git a/compiler/types/src/types.rs b/compiler/types/src/types.rs index fad33a245c..0d6d560927 100644 --- a/compiler/types/src/types.rs +++ b/compiler/types/src/types.rs @@ -176,7 +176,7 @@ impl LambdaSet { } } -#[derive(PartialEq, Eq)] +#[derive(PartialEq, Eq, Clone)] pub enum Type { EmptyRec, EmptyTagUnion, @@ -237,19 +237,6 @@ impl TypeExtension { } } -impl IntoIterator for TypeExtension { - type Item = Box; - - type IntoIter = std::option::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - match self { - TypeExtension::Open(ext) => Some(ext).into_iter(), - TypeExtension::Closed => None.into_iter(), - } - } -} - impl<'a> IntoIterator for &'a TypeExtension { type Item = &'a Type; @@ -263,73 +250,6 @@ impl<'a> IntoIterator for &'a TypeExtension { } } -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 { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self {