Skip to content

Native: Machine Code

Codes that start with A2C:N: come from the native backend, which turns the compiled code into x86 or x64 machine code. It works on whole functions, without your source at hand, so its codes name a function rather than a line. See Machine Code.

Numbers What
1000 to 1999 Registers
2000 to 2999 Code layout and instructions
9000 to 9099 Internal errors

Some optimizations apply everywhere, the same way, with nothing to decide. They're marked always on below.

A2C:N:O:1001 register-variables

The variables a function uses most in its loops are kept in the processor's registers instead of in memory, which makes reading and writing them faster. Inner loops come first. The message says how many.

A2C:N:M:1002 registers-exhausted

A function's loops use more variables than the processor has registers for, so the ones used least stay in memory, where they're a little slower to reach. The message says how many. This is common in large functions and seldom matters. If the function is slow, splitting a large loop body into functions of its own leaves each with fewer variables.

A2C:N:O:1003 number-registers-x86

On x86 (AutoPlay Media Studio and Setup Factory 9.7 x86), numbers that no call crosses live in registers too.

A2C:N:O:2001 rotated-loop

A loop tests its condition at the bottom instead of the top, so each round ends in a single jump back. The message says how many of the function's loops do.

A2C:N:O:2010 fused-branch

Always on. A comparison that only decides a branch jumps on its outcome directly.

A2C:N:O:2011 held-register

Always on. A value just stored stays in its register for the next instruction.

A2C:N:O:2012 immediate-operand

Always on. Constants and registers are used as operands directly, with the shortest instructions for zero and for multiplying by a constant.

A2C:N:O:2013 arithmetic-in-place

Always on. Arithmetic computes straight into the register of its result.

A2C:N:O:2014 pair-operand

Always on. On x86, Lua 5.3 integers (64 bits, two registers) are computed against constants and memory, and counted up in memory.

A2C:N:O:2015 unreachable-left-out

Always on. Code that no path reaches isn't in the DLL.

A2C:N:O:2016 double-argument-store

Always on. On x86, a number passed to a function is stored at once, so the function can read it back without waiting.

A2C:N:E:9000 native-internal

The native backend can't generate code for a function. This is a bug in autoplay2c: please report it, with the script that causes it. Until it's fixed, the C backend may build the module.