Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorng committed Jan 6, 2024
1 parent 7bd3a26 commit 4ddfc57
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions erts/emulator/beam/jit/arm/beam_asm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -967,9 +967,9 @@ class BeamModuleAssembler : public BeamAssembler,
arm::Mem mem;
};

/* Using more than two cache entries does not seem worthwhile. */
static const int num_cache_entries = 4;
CacheEntry cache[num_cache_entries];
static const int max_cache_entries = 16;
CacheEntry cache[max_cache_entries];
int num_cache_entries = 0;

/* Private helpers. */
void preserve__cache(bool cache_was_valid) {
Expand All @@ -989,10 +989,7 @@ class BeamModuleAssembler : public BeamAssembler,

void consolidate_cache() {
if (!is_cache_valid()) {
for (int i = 0; i < num_cache_entries; i++) {
cache[i].reg1 = cache[i].reg2 = arm::Gp();
cache[i].mem = arm::Mem();
}
num_cache_entries = 0;
}

last_destination_offset = a.offset();
Expand All @@ -1005,8 +1002,12 @@ class BeamModuleAssembler : public BeamAssembler,
}
}

comment("blurf");
return 0;
if (num_cache_entries < max_cache_entries) {
return num_cache_entries++;
} else {
comment("blurf");
return 0;
}
}

int get_cache_entry(arm::Mem mem) {
Expand Down Expand Up @@ -1130,14 +1131,10 @@ class BeamModuleAssembler : public BeamAssembler,
a.ldr(dst, mem);
last_destination_offset = a.offset();

num_cache_entries = 1;
cache[0].reg1 = dst;
cache[0].reg2 = arm::Gp();
cache[0].mem = mem;

for (int i = 1; i < num_cache_entries; i++) {
cache[i].reg1 = cache[i].reg2 = arm::Gp();
cache[i].mem = arm::Mem();
}
}
}

Expand Down

0 comments on commit 4ddfc57

Please sign in to comment.