mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +00:00
Kernel: Track KCOVInstance via Process instead of HashMap
While this clutters Process.cpp a tiny bit, I feel that it's worth it: - 2x speed on the kcov_loop benchmark. Likely more during fuzzing. - Overall code complexity is going down with this change. - By reducing the code reachable from __sanitizer_cov_trace_pc code, we can now instrument more code.
This commit is contained in:
committed by
Andrew Kaster
parent
83020a48a8
commit
a721e4d507
@@ -9,23 +9,18 @@
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Time.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/API/Syscall.h>
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/Devices/DeviceManagement.h>
|
||||
#include <Kernel/Interrupts/InterruptDisabler.h>
|
||||
#include <Kernel/Security/Credentials.h>
|
||||
#include <Kernel/Tasks/Coredump.h>
|
||||
#ifdef ENABLE_KERNEL_COVERAGE_COLLECTION
|
||||
# include <Kernel/Devices/KCOVDevice.h>
|
||||
#endif
|
||||
#include <Kernel/API/POSIX/errno.h>
|
||||
#include <Kernel/API/POSIX/sys/limits.h>
|
||||
#include <Kernel/API/Syscall.h>
|
||||
#include <Kernel/Arch/PageDirectory.h>
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/Devices/DeviceManagement.h>
|
||||
#include <Kernel/Devices/Generic/NullDevice.h>
|
||||
#include <Kernel/Devices/TTY/TTY.h>
|
||||
#include <Kernel/FileSystem/Custody.h>
|
||||
#include <Kernel/FileSystem/OpenFileDescription.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/Interrupts/InterruptDisabler.h>
|
||||
#include <Kernel/KSyms.h>
|
||||
#include <Kernel/Library/KBufferBuilder.h>
|
||||
#include <Kernel/Library/Panic.h>
|
||||
@@ -33,6 +28,8 @@
|
||||
#include <Kernel/Memory/AnonymousVMObject.h>
|
||||
#include <Kernel/Memory/SharedInodeVMObject.h>
|
||||
#include <Kernel/Sections.h>
|
||||
#include <Kernel/Security/Credentials.h>
|
||||
#include <Kernel/Tasks/Coredump.h>
|
||||
#include <Kernel/Tasks/PerformanceEventBuffer.h>
|
||||
#include <Kernel/Tasks/PerformanceManager.h>
|
||||
#include <Kernel/Tasks/Process.h>
|
||||
@@ -561,6 +558,21 @@ void Process::crash(int signal, Optional<RegisterState const&> regs, bool out_of
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_KERNEL_COVERAGE_COLLECTION
|
||||
bool Process::is_kcov_busy()
|
||||
{
|
||||
bool is_busy = false;
|
||||
Kernel::Process::current().for_each_thread([&](auto& thread) {
|
||||
if (thread.m_kcov_enabled) {
|
||||
is_busy = true;
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return is_busy;
|
||||
}
|
||||
#endif
|
||||
|
||||
RefPtr<Process> Process::from_pid_in_same_jail(ProcessID pid)
|
||||
{
|
||||
return Process::current().m_jail_process_list.with([&](auto const& list_ptr) -> RefPtr<Process> {
|
||||
@@ -964,9 +976,6 @@ void Process::die()
|
||||
});
|
||||
|
||||
kill_all_threads();
|
||||
#ifdef ENABLE_KERNEL_COVERAGE_COLLECTION
|
||||
KCOVDevice::free_process();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Process::terminate_due_to_signal(u8 signal)
|
||||
|
||||
Reference in New Issue
Block a user