Commit e5a684bd authored by Luke Sandberg's avatar Luke Sandberg

filter self as well

parent 7e7440f5
...@@ -670,7 +670,12 @@ impl<B: Backend + 'static> TurboTasks<B> { ...@@ -670,7 +670,12 @@ impl<B: Backend + 'static> TurboTasks<B> {
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc { ) -> RawVc {
let arg = trait_impl.arg_meta.filter_owned(arg); let arg = trait_impl.arg_meta.filter_owned(arg);
return self.dynamic_call(trait_impl, Some(this), arg, persistence); return self.dynamic_call(
trait_impl,
(!trait_impl.filters_this).then_some(this),
arg,
persistence,
);
} }
pub fn trait_call( pub fn trait_call(
......
...@@ -156,6 +156,8 @@ pub struct NativeFunction { ...@@ -156,6 +156,8 @@ pub struct NativeFunction {
// The globally unique name for this function, used when persisting // The globally unique name for this function, used when persisting
pub(crate) global_name: &'static str, pub(crate) global_name: &'static str,
pub(crate) filters_this: bool,
} }
impl Debug for NativeFunction { impl Debug for NativeFunction {
...@@ -181,6 +183,7 @@ impl NativeFunction { ...@@ -181,6 +183,7 @@ impl NativeFunction {
global_name, global_name,
arg_meta: ArgMeta::new::<Inputs>(), arg_meta: ArgMeta::new::<Inputs>(),
implementation: Box::new(implementation.into_task_fn()), implementation: Box::new(implementation.into_task_fn()),
filters_this: false,
} }
} }
...@@ -203,6 +206,7 @@ impl NativeFunction { ...@@ -203,6 +206,7 @@ impl NativeFunction {
ArgMeta::new::<Inputs>() ArgMeta::new::<Inputs>()
}, },
implementation: Box::new(implementation.into_task_fn()), implementation: Box::new(implementation.into_task_fn()),
filters_this: true,
} }
} }
...@@ -226,6 +230,7 @@ impl NativeFunction { ...@@ -226,6 +230,7 @@ impl NativeFunction {
ArgMeta::new::<Inputs>() ArgMeta::new::<Inputs>()
}, },
implementation: Box::new(implementation.into_task_fn_with_this()), implementation: Box::new(implementation.into_task_fn_with_this()),
filters_this: false,
} }
} }
......
...@@ -202,8 +202,9 @@ static DEVIRTUALIZED_TRAIT_METHODS: Lazy<FxHashMap<&'static TraitMethod, &'stati ...@@ -202,8 +202,9 @@ static DEVIRTUALIZED_TRAIT_METHODS: Lazy<FxHashMap<&'static TraitMethod, &'stati
trait_method_to_impls.entry(tm).or_default().push(nf); trait_method_to_impls.entry(tm).or_default().push(nf);
} }
} }
let num_trait_methods = trait_method_to_impls.len();
trait_method_to_impls let devirtualized = trait_method_to_impls
.into_iter() .into_iter()
.filter_map(|(k, v)| { .filter_map(|(k, v)| {
if let Impls::One(f) = v { if let Impls::One(f) = v {
...@@ -212,7 +213,13 @@ static DEVIRTUALIZED_TRAIT_METHODS: Lazy<FxHashMap<&'static TraitMethod, &'stati ...@@ -212,7 +213,13 @@ static DEVIRTUALIZED_TRAIT_METHODS: Lazy<FxHashMap<&'static TraitMethod, &'stati
None None
} }
}) })
.collect() .collect::<FxHashMap<_, _>>();
eprintln!(
"devirtualized {} out of {} trait methods",
devirtualized.len(),
num_trait_methods,
);
devirtualized
}); });
pub fn get_devirtualized_trait_impl( pub fn get_devirtualized_trait_impl(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment