luavm: new module targeting top 3 Lua VM hotspots (4.5% CPU combined)
Three hooks from perf profiling (34M samples): - lua_table_get_hash_element (1.65%): prefetch next chain node - luaS_newlstr (1.35%): hash pre-check before memcmp (Lua 5.0->5.1 fix) - lua_vm_execute (1.50%): jump table patches for MOVE (MOVDQU), ADD/SUB/MUL/DIV (SSE2 replacing x87) Default off (-Dluavm=true to enable). Arithmetic slow path verified against disasm: __fastcall(ECX=L, EDX=R(A), stack: opB, opC, tm_id), callee cleans (RET 0xC).
This commit is contained in:
@@ -24,6 +24,7 @@ const build_opts = struct {
|
||||
const silicon = @import("build_options").enable_silicon;
|
||||
const weirdperformance = @import("build_options").enable_weirdperformance;
|
||||
const superweirdo = @import("build_options").enable_superweirdo;
|
||||
const luavm = @import("build_options").enable_luavm;
|
||||
};
|
||||
|
||||
// Conditional module imports
|
||||
@@ -46,6 +47,7 @@ const ssemaths = if (build_opts.ssemaths) @import("ssemaths/ssemaths.zig") else
|
||||
const silicon = if (build_opts.silicon) @import("silicon/silicon.zig") else struct {};
|
||||
const weirdperformance = if (build_opts.weirdperformance) @import("weirdperformance/weirdperformance.zig") else struct {};
|
||||
const superweirdo = if (build_opts.superweirdo) @import("superweirdo/superweirdo.zig") else struct {};
|
||||
const luavm = if (build_opts.luavm) @import("luavm/luavm.zig") else struct {};
|
||||
|
||||
const module_active = @import("module_active.zig");
|
||||
|
||||
@@ -746,6 +748,7 @@ const modules = [_]ModuleHooks{
|
||||
if (build_opts.silicon) .{ .name = silicon.module_name, .install = silicon.installHooks, .remove = silicon.removeHooks, .is_active = silicon.isActive } else .{},
|
||||
if (build_opts.weirdperformance) .{ .name = weirdperformance.module_name, .install = weirdperformance.installHooks, .remove = weirdperformance.removeHooks, .is_active = weirdperformance.isActive, .remove_on_shutdown = true } else .{},
|
||||
if (build_opts.superweirdo) .{ .name = superweirdo.module_name, .install = superweirdo.installHooks, .remove = superweirdo.removeHooks, .is_active = superweirdo.isActive } else .{},
|
||||
if (build_opts.luavm) .{ .name = luavm.module_name, .install = luavm.installHooks, .remove = luavm.removeHooks, .is_active = luavm.isActive } else .{},
|
||||
};
|
||||
|
||||
fn shutdownDetour() callconv(hook.cc.stdcall) void {
|
||||
|
||||
Reference in New Issue
Block a user