1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

Kernel: Make sys$perf_register_string() generate the string ID's

Making userspace provide a global string ID was silly, and made the API
extremely difficult to use correctly in a global profiling context.

Instead, simply make the kernel do the string ID allocation for us.
This also allows us to convert the string storage to a Vector in the
kernel (and an array in the JSON profile data.)
This commit is contained in:
Andreas Kling 2021-08-11 20:41:29 +02:00
parent 56e84a63ca
commit 1e90a3a542
8 changed files with 24 additions and 24 deletions

View file

@ -26,7 +26,7 @@
namespace JS {
#ifdef __serenity__
static constexpr FlatPtr gc_perf_string_id = 0x13378086;
static int gc_perf_string_id;
#endif
Heap::Heap(VM& vm)
@ -34,7 +34,7 @@ Heap::Heap(VM& vm)
{
#ifdef __serenity__
auto gc_signpost_string = "Garbage collection"sv;
perf_register_string(gc_perf_string_id, gc_signpost_string.characters_without_null_termination(), gc_signpost_string.length());
gc_perf_string_id = perf_register_string(gc_signpost_string.characters_without_null_termination(), gc_signpost_string.length());
#endif
if constexpr (HeapBlock::min_possible_cell_size <= 16) {