Skip to content

luzer: initialize FDP metatable only once#28

Merged
ligurio merged 1 commit intoligurio:masterfrom
Buristan:skaplun/init-fdp-metatable-once
Mar 26, 2025
Merged

luzer: initialize FDP metatable only once#28
ligurio merged 1 commit intoligurio:masterfrom
Buristan:skaplun/init-fdp-metatable-once

Conversation

@Buristan
Copy link
Copy Markdown
Collaborator

The FDP metatable is recreating each time when we initialize the FDP object. It increases the GC consumption and makes the code less JIT-friendly since traces are exited by the guard on the FDP methods objects that checked the exact pointer of the GCobj which is new for any new FDP provider.

This patch fixes that by initializing the metatable only once on the luzer library loading.

The FDP metatable is recreating each time when we initialize the FDP
object. It increases the GC consumption and makes the code less
JIT-friendly since traces are exited by the guard on the FDP methods
objects that checked the exact pointer of the `GCobj` which is new for
any new FDP provider.

This patch fixes that by initializing the metatable only once on the
luzer library loading.
@ligurio ligurio force-pushed the skaplun/init-fdp-metatable-once branch from 3914471 to bc137f1 Compare March 26, 2025 11:44
@ligurio
Copy link
Copy Markdown
Owner

ligurio commented Mar 26, 2025

Fixed codestyle:

--- a/luzer/fuzzed_data_provider.cc
+++ b/luzer/fuzzed_data_provider.cc
@@ -266,7 +266,8 @@ const luaL_Reg methods[] =
  * friendly. `luaL_fuzzed_data_provider()` is called in the loop inside
  * `LLVMFuzzerRunDriver()`.
  */
-void fdp_metatable_init(lua_State *L)
+void
+fdp_metatable_init(lua_State *L)
 {
        luaL_newmetatable(L, FDP_LUA_UDATA_NAME);
        lua_pushvalue(L, -1);

@ligurio ligurio merged commit 59877a2 into ligurio:master Mar 26, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants