mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-20 18:05:11 -04:00
kern: devirtualize most things that are free to devirtualize (see #1672)
This commit is contained in:
parent
aaa3770806
commit
d0cd511c0e
13 changed files with 89 additions and 89 deletions
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <mesosphere.hpp>
|
||||
|
||||
namespace ams::kern {
|
||||
|
||||
|
||||
void KAutoObjectWithListContainer::Register(KAutoObjectWithList *obj) {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
|
||||
KScopedLightLock lk(m_lock);
|
||||
|
||||
m_object_list.insert(*obj);
|
||||
}
|
||||
|
||||
void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList *obj) {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
|
||||
KScopedLightLock lk(m_lock);
|
||||
|
||||
m_object_list.erase(m_object_list.iterator_to(*obj));
|
||||
}
|
||||
|
||||
size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess *owner) {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
|
||||
KScopedLightLock lk(m_lock);
|
||||
|
||||
size_t count = 0;
|
||||
|
||||
for (auto &obj : m_object_list) {
|
||||
if (obj.GetOwner() == owner) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
|
@ -528,7 +528,8 @@ namespace ams::kern {
|
|||
}
|
||||
|
||||
/* Get the thread context. */
|
||||
return this->GetThreadContextImpl(out, thread, context_flags);
|
||||
static_assert(std::derived_from<KDebug, KDebugBase>);
|
||||
return static_cast<KDebug *>(this)->GetThreadContextImpl(out, thread, context_flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -619,7 +620,8 @@ namespace ams::kern {
|
|||
}
|
||||
|
||||
/* Set the thread context. */
|
||||
return this->SetThreadContextImpl(ctx, thread, context_flags);
|
||||
static_assert(std::derived_from<KDebug, KDebugBase>);
|
||||
return static_cast<KDebug *>(this)->SetThreadContextImpl(ctx, thread, context_flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -984,6 +986,14 @@ namespace ams::kern {
|
|||
return this->GetDebugEventInfoImpl(out);
|
||||
}
|
||||
|
||||
void KDebugBase::Finalize() {
|
||||
/* Perform base finalization. */
|
||||
KSynchronizationObject::Finalize();
|
||||
|
||||
/* Perform post-synchronization finalization. */
|
||||
this->OnFinalizeSynchronizationObject();
|
||||
}
|
||||
|
||||
void KDebugBase::OnFinalizeSynchronizationObject() {
|
||||
/* Detach from our process, if we have one. */
|
||||
if (this->IsAttached() && this->OpenProcess()) {
|
||||
|
|
|
@ -83,7 +83,8 @@ namespace ams::kern {
|
|||
}
|
||||
#endif
|
||||
|
||||
this->OnFinalizeSynchronizationObject();
|
||||
/* NOTE: In Nintendo's kernel, the following is virtual and called here. */
|
||||
/* this->OnFinalizeSynchronizationObject(); */
|
||||
}
|
||||
|
||||
Result KSynchronizationObject::Wait(s32 *out_index, KSynchronizationObject **objects, const s32 num_objects, s64 timeout) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue