MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / discharge2reg

Function discharge2reg

ThirdParty/lua/lua/lcode.c:444–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442
443
444static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
445 luaK_dischargevars(fs, e);
446 switch (e->k) {
447 case VNIL: {
448 luaK_nil(fs, reg, 1);
449 break;
450 }
451 case VFALSE: case VTRUE: {
452 luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);
453 break;
454 }
455 case VK: {
456 luaK_codek(fs, reg, e->u.info);
457 break;
458 }
459 case VKFLT: {
460 luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval));
461 break;
462 }
463 case VKINT: {
464 luaK_codek(fs, reg, luaK_intK(fs, e->u.ival));
465 break;
466 }
467 case VRELOCABLE: {
468 Instruction *pc = &getcode(fs, e);
469 SETARG_A(*pc, reg);
470 break;
471 }
472 case VNONRELOC: {
473 if (reg != e->u.info)
474 luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0);
475 break;
476 }
477 default: {
478 lua_assert(e->k == VVOID || e->k == VJMP);
479 return; /* nothing to do... */
480 }
481 }
482 e->u.info = reg;
483 e->k = VNONRELOC;
484}
485
486
487static void discharge2anyreg (FuncState *fs, expdesc *e) {

Callers 2

discharge2anyregFunction · 0.85
exp2regFunction · 0.85

Calls 6

luaK_dischargevarsFunction · 0.85
luaK_nilFunction · 0.85
luaK_codeABCFunction · 0.85
luaK_codekFunction · 0.85
luaK_numberKFunction · 0.85
luaK_intKFunction · 0.85

Tested by

no test coverage detected