Skip to content

Commit

Permalink
recompiler: revert "avoid overallocation in code buffer" (#1241)
Browse files Browse the repository at this point in the history
Turns out the overallocation was masking some bugs in sljit. Will take
this upstream and revert the ares change in the meantime.
  • Loading branch information
invertego authored Sep 27, 2023
1 parent 1349d45 commit 46ddcac
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions nall/bump-allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ struct bump_allocator {
_offset = nextOffset(size); //alignment
}

auto tryAcquire(u32 size, bool reserve = true) -> u8* {
auto tryAcquire(u32 size) -> u8* {
if((nextOffset(size)) > _capacity) return nullptr;
return reserve ? acquire(size) : acquire();
return acquire(size);
}

private:
Expand Down
1 change: 0 additions & 1 deletion nall/recompiler/generic/generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ namespace nall::recompiler {

auto endFunction() -> u8* {
u8* code = (u8*)sljit_generate_code(compiler);
allocator.reserve(sljit_get_generated_code_size(compiler));
resetCompiler();
return code;
}
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/sljitAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

auto sljit_nall_malloc_exec(sljit_uw size, void* exec_allocator_data) -> void* {
auto allocator = (nall::bump_allocator*)exec_allocator_data;
return allocator->tryAcquire(size, false);
return allocator->acquire(size);
}

0 comments on commit 46ddcac

Please sign in to comment.