MCPcopy Create free account
hub / github.com/F-Stack/f-stack / discharge2reg

Function discharge2reg

freebsd/contrib/openzfs/module/lua/lcode.c:419–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417
418
419static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
420 luaK_dischargevars(fs, e);
421 switch (e->k) {
422 case VNIL: {
423 luaK_nil(fs, reg, 1);
424 break;
425 }
426 case VFALSE: case VTRUE: {
427 luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);
428 break;
429 }
430 case VK: {
431 luaK_codek(fs, reg, e->u.info);
432 break;
433 }
434 case VKNUM: {
435 luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval));
436 break;
437 }
438 case VRELOCABLE: {
439 Instruction *pc = &getcode(fs, e);
440 SETARG_A(*pc, reg);
441 break;
442 }
443 case VNONRELOC: {
444 if (reg != e->u.info)
445 luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0);
446 break;
447 }
448 default: {
449 lua_assert(e->k == VVOID || e->k == VJMP);
450 return; /* nothing to do... */
451 }
452 }
453 e->u.info = reg;
454 e->k = VNONRELOC;
455}
456
457
458static void discharge2anyreg (FuncState *fs, expdesc *e) {

Callers 2

discharge2anyregFunction · 0.70
exp2regFunction · 0.70

Calls 5

luaK_codekFunction · 0.85
luaK_dischargevarsFunction · 0.70
luaK_nilFunction · 0.70
luaK_codeABCFunction · 0.70
luaK_numberKFunction · 0.70

Tested by

no test coverage detected