Skip to content

Commit

Permalink
use static duration for slow part of alloc fns
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwight Guth committed Jun 4, 2024
1 parent 9616ccf commit 1daf389
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions runtime/alloc/alloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@ __attribute__((always_inline)) void *kore_alloc_floating_old(size_t requested) {
void *kore_alloc_map(size_t requested) {
void *mem = kore_alloc(sizeof(blockheader) + sizeof(map) + sizeof(uint64_t));
auto *hdr = (blockheader *)mem;
std::string name = get_raw_symbol_name(kllvm::sort_category::Map) + "{}";
*hdr = get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
static std::string name
= get_raw_symbol_name(kllvm::sort_category::Map) + "{}";
static blockheader hdr_val
= get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
*hdr = hdr_val;
auto *offset = (uint64_t *)(hdr + 1);
*offset = 16;
auto *child = (map *)(hdr + 2);
Expand All @@ -166,8 +169,11 @@ void *kore_alloc_map(size_t requested) {
void *kore_alloc_set(size_t requested) {
void *mem = kore_alloc(sizeof(blockheader) + sizeof(set) + sizeof(uint64_t));
auto *hdr = (blockheader *)mem;
std::string name = get_raw_symbol_name(kllvm::sort_category::Set) + "{}";
*hdr = get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
static std::string name
= get_raw_symbol_name(kllvm::sort_category::Set) + "{}";
static blockheader hdr_val
= get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
*hdr = hdr_val;
auto *offset = (uint64_t *)(hdr + 1);
*offset = 16;
auto *child = (set *)(hdr + 2);
Expand All @@ -177,8 +183,11 @@ void *kore_alloc_set(size_t requested) {
void *kore_alloc_list(size_t requested) {
void *mem = kore_alloc(sizeof(blockheader) + sizeof(list) + sizeof(uint64_t));
auto *hdr = (blockheader *)mem;
std::string name = get_raw_symbol_name(kllvm::sort_category::List) + "{}";
*hdr = get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
static std::string name
= get_raw_symbol_name(kllvm::sort_category::List) + "{}";
static blockheader hdr_val
= get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
*hdr = hdr_val;
auto *offset = (uint64_t *)(hdr + 1);
*offset = 16;
auto *child = (list *)(hdr + 2);
Expand All @@ -189,8 +198,11 @@ void *kore_alloc_rangemap(size_t requested) {
void *mem
= kore_alloc(sizeof(blockheader) + sizeof(rangemap) + sizeof(uint64_t));
auto *hdr = (blockheader *)mem;
std::string name = get_raw_symbol_name(kllvm::sort_category::RangeMap) + "{}";
*hdr = get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
static std::string name
= get_raw_symbol_name(kllvm::sort_category::RangeMap) + "{}";
static blockheader hdr_val
= get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
*hdr = hdr_val;
auto *offset = (uint64_t *)(hdr + 1);
*offset = 16;
auto *child = (rangemap *)(hdr + 2);
Expand Down

0 comments on commit 1daf389

Please sign in to comment.