Skip to content

Commit

Permalink
make page_shift and table_size constant
Browse files Browse the repository at this point in the history
Signed-off-by: Hyeonggon Yoo <[email protected]>
  • Loading branch information
hygoni committed Apr 14, 2024
1 parent c44e365 commit 7a2111a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler-rt/lib/plsan/plsan.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ const uptr kUserMapSize = 1 << 16;
const uptr kMetaMapSize = 1 << 16;
const uptr kMetadataSize = sizeof(struct Metadata);
extern uptr *metadata_table;
const uptr page_shift = 12;
const uptr table_size = 1LL << (48 - page_shift);

inline struct Metadata *GetMetadata(const void *p) {
uptr addr = reinterpret_cast<uptr>(p);
uptr page_shift = __builtin_ctz(GetPageSizeCached());
uptr page_idx = addr >> page_shift;
uptr table_size = 1LL << (48 - page_shift);
if (page_idx >= table_size)
return nullptr;

Expand Down

0 comments on commit 7a2111a

Please sign in to comment.