aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lcode.c22
-rw-r--r--lcode.h3
-rw-r--r--ldo.c6
-rw-r--r--ldo.h1
-rw-r--r--lgc.c4
-rw-r--r--lstate.c4
-rw-r--r--lstate.h1
7 files changed, 18 insertions, 23 deletions
diff --git a/lcode.c b/lcode.c
index eade2806..caac6ba3 100644
--- a/lcode.c
+++ b/lcode.c
@@ -415,7 +415,7 @@ int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
415/* 415/*
416** Format and emit an 'iAsBx' instruction. 416** Format and emit an 'iAsBx' instruction.
417*/ 417*/
418int luaK_codeAsBx (FuncState *fs, OpCode o, int a, int bc) { 418static int codeAsBx (FuncState *fs, OpCode o, int a, int bc) {
419 unsigned int b = bc + OFFSET_sBx; 419 unsigned int b = bc + OFFSET_sBx;
420 lua_assert(getOpMode(o) == iAsBx); 420 lua_assert(getOpMode(o) == iAsBx);
421 lua_assert(a <= MAXARG_A && b <= MAXARG_Bx); 421 lua_assert(a <= MAXARG_A && b <= MAXARG_Bx);
@@ -671,7 +671,7 @@ static int fitsBx (lua_Integer i) {
671 671
672void luaK_int (FuncState *fs, int reg, lua_Integer i) { 672void luaK_int (FuncState *fs, int reg, lua_Integer i) {
673 if (fitsBx(i)) 673 if (fitsBx(i))
674 luaK_codeAsBx(fs, OP_LOADI, reg, cast_int(i)); 674 codeAsBx(fs, OP_LOADI, reg, cast_int(i));
675 else 675 else
676 luaK_codek(fs, reg, luaK_intK(fs, i)); 676 luaK_codek(fs, reg, luaK_intK(fs, i));
677} 677}
@@ -680,7 +680,7 @@ void luaK_int (FuncState *fs, int reg, lua_Integer i) {
680static void luaK_float (FuncState *fs, int reg, lua_Number f) { 680static void luaK_float (FuncState *fs, int reg, lua_Number f) {
681 lua_Integer fi; 681 lua_Integer fi;
682 if (luaV_flttointeger(f, &fi, F2Ieq) && fitsBx(fi)) 682 if (luaV_flttointeger(f, &fi, F2Ieq) && fitsBx(fi))
683 luaK_codeAsBx(fs, OP_LOADF, reg, cast_int(fi)); 683 codeAsBx(fs, OP_LOADF, reg, cast_int(fi));
684 else 684 else
685 luaK_codek(fs, reg, luaK_numberK(fs, f)); 685 luaK_codek(fs, reg, luaK_numberK(fs, f));
686} 686}
@@ -1025,7 +1025,7 @@ static int luaK_exp2K (FuncState *fs, expdesc *e) {
1025** in the range of R/K indices). 1025** in the range of R/K indices).
1026** Returns 1 iff expression is K. 1026** Returns 1 iff expression is K.
1027*/ 1027*/
1028int luaK_exp2RK (FuncState *fs, expdesc *e) { 1028static int exp2RK (FuncState *fs, expdesc *e) {
1029 if (luaK_exp2K(fs, e)) 1029 if (luaK_exp2K(fs, e))
1030 return 1; 1030 return 1;
1031 else { /* not a constant in the right range: put it in a register */ 1031 else { /* not a constant in the right range: put it in a register */
@@ -1037,7 +1037,7 @@ int luaK_exp2RK (FuncState *fs, expdesc *e) {
1037 1037
1038static void codeABRK (FuncState *fs, OpCode o, int a, int b, 1038static void codeABRK (FuncState *fs, OpCode o, int a, int b,
1039 expdesc *ec) { 1039 expdesc *ec) {
1040 int k = luaK_exp2RK(fs, ec); 1040 int k = exp2RK(fs, ec);
1041 luaK_codeABCk(fs, o, a, b, ec->u.info, k); 1041 luaK_codeABCk(fs, o, a, b, ec->u.info, k);
1042} 1042}
1043 1043
@@ -1225,7 +1225,7 @@ static int isKstr (FuncState *fs, expdesc *e) {
1225/* 1225/*
1226** Check whether expression 'e' is a literal integer. 1226** Check whether expression 'e' is a literal integer.
1227*/ 1227*/
1228int luaK_isKint (expdesc *e) { 1228static int isKint (expdesc *e) {
1229 return (e->k == VKINT && !hasjumps(e)); 1229 return (e->k == VKINT && !hasjumps(e));
1230} 1230}
1231 1231
@@ -1235,7 +1235,7 @@ int luaK_isKint (expdesc *e) {
1235** proper range to fit in register C 1235** proper range to fit in register C
1236*/ 1236*/
1237static int isCint (expdesc *e) { 1237static int isCint (expdesc *e) {
1238 return luaK_isKint(e) && (l_castS2U(e->u.ival) <= l_castS2U(MAXARG_C)); 1238 return isKint(e) && (l_castS2U(e->u.ival) <= l_castS2U(MAXARG_C));
1239} 1239}
1240 1240
1241 1241
@@ -1244,7 +1244,7 @@ static int isCint (expdesc *e) {
1244** proper range to fit in register sC 1244** proper range to fit in register sC
1245*/ 1245*/
1246static int isSCint (expdesc *e) { 1246static int isSCint (expdesc *e) {
1247 return luaK_isKint(e) && fitsC(e->u.ival); 1247 return isKint(e) && fitsC(e->u.ival);
1248} 1248}
1249 1249
1250 1250
@@ -1460,7 +1460,7 @@ static void codebinK (FuncState *fs, BinOpr opr,
1460*/ 1460*/
1461static int finishbinexpneg (FuncState *fs, expdesc *e1, expdesc *e2, 1461static int finishbinexpneg (FuncState *fs, expdesc *e1, expdesc *e2,
1462 OpCode op, int line, TMS event) { 1462 OpCode op, int line, TMS event) {
1463 if (!luaK_isKint(e2)) 1463 if (!isKint(e2))
1464 return 0; /* not an integer constant */ 1464 return 0; /* not an integer constant */
1465 else { 1465 else {
1466 lua_Integer i2 = e2->u.ival; 1466 lua_Integer i2 = e2->u.ival;
@@ -1593,7 +1593,7 @@ static void codeeq (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) {
1593 op = OP_EQI; 1593 op = OP_EQI;
1594 r2 = im; /* immediate operand */ 1594 r2 = im; /* immediate operand */
1595 } 1595 }
1596 else if (luaK_exp2RK(fs, e2)) { /* 2nd expression is constant? */ 1596 else if (exp2RK(fs, e2)) { /* 2nd expression is constant? */
1597 op = OP_EQK; 1597 op = OP_EQK;
1598 r2 = e2->u.info; /* constant index */ 1598 r2 = e2->u.info; /* constant index */
1599 } 1599 }
@@ -1659,7 +1659,7 @@ void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
1659 } 1659 }
1660 case OPR_EQ: case OPR_NE: { 1660 case OPR_EQ: case OPR_NE: {
1661 if (!tonumeral(v, NULL)) 1661 if (!tonumeral(v, NULL))
1662 luaK_exp2RK(fs, v); 1662 exp2RK(fs, v);
1663 /* else keep numeral, which may be an immediate operand */ 1663 /* else keep numeral, which may be an immediate operand */
1664 break; 1664 break;
1665 } 1665 }
diff --git a/lcode.h b/lcode.h
index 32658244..0b971fc4 100644
--- a/lcode.h
+++ b/lcode.h
@@ -61,10 +61,8 @@ typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
61 61
62LUAI_FUNC int luaK_code (FuncState *fs, Instruction i); 62LUAI_FUNC int luaK_code (FuncState *fs, Instruction i);
63LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); 63LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
64LUAI_FUNC int luaK_codeAsBx (FuncState *fs, OpCode o, int A, int Bx);
65LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A, 64LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A,
66 int B, int C, int k); 65 int B, int C, int k);
67LUAI_FUNC int luaK_isKint (expdesc *e);
68LUAI_FUNC int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v); 66LUAI_FUNC int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v);
69LUAI_FUNC void luaK_fixline (FuncState *fs, int line); 67LUAI_FUNC void luaK_fixline (FuncState *fs, int line);
70LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); 68LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n);
@@ -76,7 +74,6 @@ LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e);
76LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e); 74LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e);
77LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); 75LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e);
78LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); 76LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e);
79LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e);
80LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); 77LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key);
81LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); 78LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k);
82LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); 79LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e);
diff --git a/ldo.c b/ldo.c
index 2a0017ca..bd8d965f 100644
--- a/ldo.c
+++ b/ldo.c
@@ -409,7 +409,7 @@ static void rethook (lua_State *L, CallInfo *ci, int nres) {
409** stack, below original 'func', so that 'luaD_precall' can call it. Raise 409** stack, below original 'func', so that 'luaD_precall' can call it. Raise
410** an error if there is no '__call' metafield. 410** an error if there is no '__call' metafield.
411*/ 411*/
412StkId luaD_tryfuncTM (lua_State *L, StkId func) { 412static StkId tryfuncTM (lua_State *L, StkId func) {
413 const TValue *tm; 413 const TValue *tm;
414 StkId p; 414 StkId p;
415 checkstackGCp(L, 1, func); /* space for metamethod */ 415 checkstackGCp(L, 1, func); /* space for metamethod */
@@ -568,7 +568,7 @@ int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func,
568 return -1; 568 return -1;
569 } 569 }
570 default: { /* not a function */ 570 default: { /* not a function */
571 func = luaD_tryfuncTM(L, func); /* try to get '__call' metamethod */ 571 func = tryfuncTM(L, func); /* try to get '__call' metamethod */
572 /* return luaD_pretailcall(L, ci, func, narg1 + 1, delta); */ 572 /* return luaD_pretailcall(L, ci, func, narg1 + 1, delta); */
573 narg1++; 573 narg1++;
574 goto retry; /* try again */ 574 goto retry; /* try again */
@@ -609,7 +609,7 @@ CallInfo *luaD_precall (lua_State *L, StkId func, int nresults) {
609 return ci; 609 return ci;
610 } 610 }
611 default: { /* not a function */ 611 default: { /* not a function */
612 func = luaD_tryfuncTM(L, func); /* try to get '__call' metamethod */ 612 func = tryfuncTM(L, func); /* try to get '__call' metamethod */
613 /* return luaD_precall(L, func, nresults); */ 613 /* return luaD_precall(L, func, nresults); */
614 goto retry; /* try again with metamethod */ 614 goto retry; /* try again with metamethod */
615 } 615 }
diff --git a/ldo.h b/ldo.h
index 1aa446ad..56008ab3 100644
--- a/ldo.h
+++ b/ldo.h
@@ -71,7 +71,6 @@ LUAI_FUNC int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func,
71LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int nResults); 71LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int nResults);
72LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); 72LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
73LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); 73LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults);
74LUAI_FUNC StkId luaD_tryfuncTM (lua_State *L, StkId func);
75LUAI_FUNC int luaD_closeprotected (lua_State *L, ptrdiff_t level, int status); 74LUAI_FUNC int luaD_closeprotected (lua_State *L, ptrdiff_t level, int status);
76LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, 75LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
77 ptrdiff_t oldtop, ptrdiff_t ef); 76 ptrdiff_t oldtop, ptrdiff_t ef);
diff --git a/lgc.c b/lgc.c
index a3094ff5..dd824e77 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1409,7 +1409,7 @@ static void stepgenfull (lua_State *L, global_State *g) {
1409 setminordebt(g); 1409 setminordebt(g);
1410 } 1410 }
1411 else { /* another bad collection; stay in incremental mode */ 1411 else { /* another bad collection; stay in incremental mode */
1412 g->GCestimate = gettotalbytes(g); /* first estimate */; 1412 g->GCestimate = gettotalbytes(g); /* first estimate */
1413 entersweep(L); 1413 entersweep(L);
1414 luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */ 1414 luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */
1415 setpause(g); 1415 setpause(g);
@@ -1604,7 +1604,7 @@ static lu_mem singlestep (lua_State *L) {
1604 case GCSenteratomic: { 1604 case GCSenteratomic: {
1605 work = atomic(L); /* work is what was traversed by 'atomic' */ 1605 work = atomic(L); /* work is what was traversed by 'atomic' */
1606 entersweep(L); 1606 entersweep(L);
1607 g->GCestimate = gettotalbytes(g); /* first estimate */; 1607 g->GCestimate = gettotalbytes(g); /* first estimate */
1608 break; 1608 break;
1609 } 1609 }
1610 case GCSswpallgc: { /* sweep "regular" objects */ 1610 case GCSswpallgc: { /* sweep "regular" objects */
diff --git a/lstate.c b/lstate.c
index 1e925e5a..06667dac 100644
--- a/lstate.c
+++ b/lstate.c
@@ -119,7 +119,7 @@ CallInfo *luaE_extendCI (lua_State *L) {
119/* 119/*
120** free all CallInfo structures not in use by a thread 120** free all CallInfo structures not in use by a thread
121*/ 121*/
122void luaE_freeCI (lua_State *L) { 122static void freeCI (lua_State *L) {
123 CallInfo *ci = L->ci; 123 CallInfo *ci = L->ci;
124 CallInfo *next = ci->next; 124 CallInfo *next = ci->next;
125 ci->next = NULL; 125 ci->next = NULL;
@@ -204,7 +204,7 @@ static void freestack (lua_State *L) {
204 if (L->stack.p == NULL) 204 if (L->stack.p == NULL)
205 return; /* stack not completely built yet */ 205 return; /* stack not completely built yet */
206 L->ci = &L->base_ci; /* free the entire 'ci' list */ 206 L->ci = &L->base_ci; /* free the entire 'ci' list */
207 luaE_freeCI(L); 207 freeCI(L);
208 lua_assert(L->nci == 0); 208 lua_assert(L->nci == 0);
209 luaM_freearray(L, L->stack.p, stacksize(L) + EXTRA_STACK); /* free stack */ 209 luaM_freearray(L, L->stack.p, stacksize(L) + EXTRA_STACK); /* free stack */
210} 210}
diff --git a/lstate.h b/lstate.h
index 8bf6600e..40ff89aa 100644
--- a/lstate.h
+++ b/lstate.h
@@ -396,7 +396,6 @@ union GCUnion {
396LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); 396LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt);
397LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); 397LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
398LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); 398LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L);
399LUAI_FUNC void luaE_freeCI (lua_State *L);
400LUAI_FUNC void luaE_shrinkCI (lua_State *L); 399LUAI_FUNC void luaE_shrinkCI (lua_State *L);
401LUAI_FUNC void luaE_checkcstack (lua_State *L); 400LUAI_FUNC void luaE_checkcstack (lua_State *L);
402LUAI_FUNC void luaE_incCstack (lua_State *L); 401LUAI_FUNC void luaE_incCstack (lua_State *L);