MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / discharge2reg

Function discharge2reg

lua/lcode.c:350–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348
349
350static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
351 luaK_dischargevars(fs, e);
352 switch (e->k) {
353 case VNIL: {
354 luaK_nil(fs, reg, 1);
355 break;
356 }
357 case VFALSE: case VTRUE: {
358 luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);
359 break;
360 }
361 case VK: {
362 luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info);
363 break;
364 }
365 case VKNUM: {
366 luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval));
367 break;
368 }
369 case VRELOCABLE: {
370 Instruction *pc = &getcode(fs, e);
371 SETARG_A(*pc, reg);
372 break;
373 }
374 case VNONRELOC: {
375 if (reg != e->u.s.info)
376 luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0);
377 break;
378 }
379 default: {
380 lua_assert(e->k == VVOID || e->k == VJMP);
381 return; /* nothing to do... */
382 }
383 }
384 e->u.s.info = reg;
385 e->k = VNONRELOC;
386}
387
388
389static void discharge2anyreg (FuncState *fs, expdesc *e) {

Callers 2

discharge2anyregFunction · 0.85
exp2regFunction · 0.85

Calls 5

luaK_dischargevarsFunction · 0.85
luaK_nilFunction · 0.85
luaK_codeABCFunction · 0.85
luaK_codeABxFunction · 0.85
luaK_numberKFunction · 0.85

Tested by

no test coverage detected