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:
MarcelineVQ
2026-04-06 01:11:11 -07:00
parent c600050d87
commit f58c100bf5
3 changed files with 614 additions and 0 deletions
+1
View File
@@ -36,6 +36,7 @@ const module_list = [_]ModuleDesc{
.{ .name = "ssemaths", .version = "1.0", .desc = "Enable UnitXP x87 math polyfill replacements (SSE)", .default = false },
.{ .name = "silicon", .version = "1.0", .desc = "Enable SSE2 math replacements (ported from libSiliconPatch)", .default = false },
.{ .name = "weirdperformance", .version = "1.1.1", .desc = "Enable production performance optimizations (SSE, inflate, filecache, timer)", .default = true },
.{ .name = "luavm", .version = "0.1", .desc = "Enable Lua VM hotspot optimizations (hash, string intern, opcode SSE)", .default = false },
.{ .name = "superweirdo", .version = "0.1", .desc = "Enable GO loot sparkle on interactable objects", .default = false },
};