Macros & Attributes (LOT v4.8.1)

Theme:

Macro names

LOT accepts its LOT_* macro names and matching LPH_* compatibility aliases. Use the spelling that best fits your existing project.

Function Virtualization & Attributes

MacroEffect
LOT_JIT(fn) / LPH_JIT(fn)Compiles fn into the VM with reduced per-instruction mutation overhead.
LOT_JIT_MAX(fn) / LPH_JIT_MAX(fn)Maximum VM speed profile for hot inner loops.
LOT_NO_VIRTUALIZE(fn) / LPH_NO_VIRTUALIZE(fn)Leaves the function body as raw Lua instead of VM bytecode.
LOT_ATTRIBUTES(...) / LPH_ATTRIBUTES(...)Supports inline attributes such as LOT_ATTRIBUTES(VM(OPAL), PRESET(FAST)).

Constant, Value & Runtime Crash Macros

MacroEffect
LOT_ENCSTR("...") / LOT_STRENC("...")Masks and splits string constants across runtime constant-pool slots.
LOT_ENCNUM(42) / LOT_NUMENC(42)Expands numeric literals into multi-step arithmetic expressions.
LOT_ENCBUF("...") / LOT_BUFENC("...")Encodes raw byte string buffers inside the VM constant pool.
LOT_OPAQUE(expr) / LOT_REWRITE(expr)Wraps conditions and arithmetic in opaque runtime predicates.
LOT_ASSUME(val, expected)Compile-time invariant assertion and value forwarding.
LOT_PRECHECK(fn, expected)Executes fn() during VM bootstrap and crashes hard on mismatch.
LOT_CRASH() / lot_crash()Forces an immediate unrecoverable VM state crash.
LOT_OBFUSCATED / LOT_LINEEvaluates to true under LOT and substitutes original line numbers.

Development Stubs for Unobfuscated Testing

if not LOT_OBFUSCATED then
    LOT_JIT = function(f) return f end
    LOT_JIT_MAX = function(f) return f end
    LOT_NO_VIRTUALIZE = function(f) return f end
    LOT_ENCSTR = function(s) return s end
    LOT_ENCNUM = function(n) return n end
    LOT_OPAQUE = function(v) return v end
    LOT_PRECHECK = function(fn, expected) assert(fn() == expected) end
    LOT_CRASH = function() error("LOT_CRASH") end
end