1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 11:45:11 +00:00

AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*)

Use this instead of uintptr_t throughout the codebase. This makes it
possible to pass a FlatPtr to something that has u32 and u64 overloads.
This commit is contained in:
Andreas Kling 2020-03-08 10:36:51 +01:00
parent b98d8ad5b0
commit b1058b33fb
36 changed files with 164 additions and 161 deletions

View file

@ -84,7 +84,7 @@ void Profile::rebuild_tree()
return new_root;
};
HashTable<uintptr_t> live_allocations;
HashTable<FlatPtr> live_allocations;
for (auto& event : m_events) {
if (has_timestamp_filter_range()) {
@ -207,10 +207,10 @@ OwnPtr<Profile> Profile::load_from_perfcore_file(const StringView& path)
event.type = perf_event.get("type").to_string();
if (event.type == "malloc") {
event.ptr = perf_event.get("ptr").to_number<uintptr_t>();
event.ptr = perf_event.get("ptr").to_number<FlatPtr>();
event.size = perf_event.get("size").to_number<size_t>();
} else if (event.type == "free") {
event.ptr = perf_event.get("ptr").to_number<uintptr_t>();
event.ptr = perf_event.get("ptr").to_number<FlatPtr>();
}
auto stack_array = perf_event.get("stack").as_array();
@ -239,7 +239,7 @@ OwnPtr<Profile> Profile::load_from_perfcore_file(const StringView& path)
if (event.frames.size() < 2)
continue;
uintptr_t innermost_frame_address = event.frames.at(1).address;
FlatPtr innermost_frame_address = event.frames.at(1).address;
event.in_kernel = innermost_frame_address >= 0xc0000000;
events.append(move(event));

View file

@ -120,7 +120,7 @@ public:
struct Event {
u64 timestamp { 0 };
String type;
uintptr_t ptr { 0 };
FlatPtr ptr { 0 };
size_t size { 0 };
bool in_kernel { false };
Vector<Frame> frames;