mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-15 15:44:23 -04:00
kern: devirtualize KAutoObject::DynamicCast<>()
This is an optimization that saves the most common type of virtual call in the kernel (DynamicCast) by storing class token as a member, rather than getting it via virtual call every time. This does not currently cost any memory space on 64-bit targets, due to pre-existing padding space. This optimization can be turned off via a compile-time flag for accuracy.
This commit is contained in:
parent
26c02e2019
commit
bfffe6b119
3 changed files with 40 additions and 4 deletions
|
@ -19,6 +19,11 @@ namespace ams::kern {
|
|||
|
||||
KAutoObject *KAutoObject::Create(KAutoObject *obj) {
|
||||
obj->m_ref_count = 1;
|
||||
|
||||
#if defined(MESOSPHERE_ENABLE_DEVIRTUALIZED_DYNAMIC_CAST)
|
||||
obj->m_class_token = obj->GetTypeObj().GetClassToken();
|
||||
#endif
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue