mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 23:48:32 +00:00
refactor(arena): use a shared block freelist
This is both simpler in client code and more effective (always reuse block hottest in cache)
This commit is contained in:
@@ -413,8 +413,6 @@ output:write([[
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/memory.h"
|
||||
|
||||
static ArenaMem lua_reuse_blk = { 0 };
|
||||
|
||||
]])
|
||||
include_headers(output, headers)
|
||||
output:write('\n')
|
||||
@@ -496,7 +494,6 @@ local function process_function(fn)
|
||||
cparams = cparams .. '&arena, '
|
||||
write_shifted_output(output, [[
|
||||
Arena arena = ARENA_EMPTY;
|
||||
arena_start(&arena, &lua_reuse_blk);
|
||||
]])
|
||||
end
|
||||
|
||||
@@ -536,7 +533,7 @@ local function process_function(fn)
|
||||
end
|
||||
local free_retval
|
||||
if fn.arena_return then
|
||||
free_retval = "arena_mem_free(arena_finish(&arena), &lua_reuse_blk);"
|
||||
free_retval = "arena_mem_free(arena_finish(&arena));"
|
||||
else
|
||||
free_retval = "api_free_"..return_type:lower().."(ret);"
|
||||
end
|
||||
|
Reference in New Issue
Block a user