MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / maxtostore

Function maxtostore

third-party/lua-5.5.0/src/lparser.c:1017–1025  ·  view source on GitHub ↗

** Compute a limit for how many registers a constructor can use before ** emitting a 'SETLIST' instruction, based on how many registers are ** available. */

Source from the content-addressed store, hash-verified

1015** available.
1016*/
1017static int maxtostore (FuncState *fs) {
1018 int numfreeregs = MAX_FSTACK - fs->freereg;
1019 if (numfreeregs >= 160) /* "lots" of registers? */
1020 return numfreeregs / 5; /* use up to 1/5 of them */
1021 else if (numfreeregs >= 80) /* still "enough" registers? */
1022 return 10; /* one 'SETLIST' instruction for each 10 values */
1023 else /* save registers for potential more nesting */
1024 return 1;
1025}
1026
1027
1028static void constructor (LexState *ls, expdesc *t) {

Callers 1

constructorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected