Lines Matching refs:fs

2247 struct FuncState*fs;
2389 #define getcode(fs,e)((fs)->f->code[(e)->u.s.info])
2390 #define luaK_codeAsBx(fs,o,A,sBx)luaK_codeABx(fs,o,A,(sBx)+(((1<<(9+9))-1)>>1))
2391 #define luaK_setmultret(fs,e)luaK_setreturns(fs,e,(-1))
2392 static int luaK_codeABx(FuncState*fs,OpCode o,int A,unsigned int Bx);
2393 static int luaK_codeABC(FuncState*fs,OpCode o,int A,int B,int C);
2394 static void luaK_setreturns(FuncState*fs,expdesc*e,int nresults);
2395 static void luaK_patchtohere(FuncState*fs,int list);
2396 static void luaK_concat(FuncState*fs,int*l1,int l2);
2724 TValue*o=luaH_setstr(L,ls->fs->h,ts);
2744 ls->fs=NULL;
3000 static void luaK_nil(FuncState*fs,int from,int n){
3002 if(fs->pc>fs->lasttarget){
3003 if(fs->pc==0){
3004 if(from>=fs->nactvar)
3008 previous=&fs->f->code[fs->pc-1];
3020 luaK_codeABC(fs,OP_LOADNIL,from,from+n-1,0);
3022 static int luaK_jump(FuncState*fs){
3023 int jpc=fs->jpc;
3025 fs->jpc=(-1);
3026 j=luaK_codeAsBx(fs,OP_JMP,0,(-1));
3027 luaK_concat(fs,&j,jpc);
3030 static void luaK_ret(FuncState*fs,int first,int nret){
3031 luaK_codeABC(fs,OP_RETURN,first,nret+1,0);
3033 static int condjump(FuncState*fs,OpCode op,int A,int B,int C){
3034 luaK_codeABC(fs,op,A,B,C);
3035 return luaK_jump(fs);
3037 static void fixjump(FuncState*fs,int pc,int dest){
3038 Instruction*jmp=&fs->f->code[pc];
3041 luaX_syntaxerror(fs->ls,"control structure too long");
3044 static int luaK_getlabel(FuncState*fs){
3045 fs->lasttarget=fs->pc;
3046 return fs->pc;
3048 static int getjump(FuncState*fs,int pc){
3049 int offset=GETARG_sBx(fs->f->code[pc]);
3055 static Instruction*getjumpcontrol(FuncState*fs,int pc){
3056 Instruction*pi=&fs->f->code[pc];
3062 static int need_value(FuncState*fs,int list){
3063 for(;list!=(-1);list=getjump(fs,list)){
3064 Instruction i=*getjumpcontrol(fs,list);
3069 static int patchtestreg(FuncState*fs,int node,int reg){
3070 Instruction*i=getjumpcontrol(fs,node);
3079 static void removevalues(FuncState*fs,int list){
3080 for(;list!=(-1);list=getjump(fs,list))
3081 patchtestreg(fs,list,((1<<8)-1));
3083 static void patchlistaux(FuncState*fs,int list,int vtarget,int reg,
3086 int next=getjump(fs,list);
3087 if(patchtestreg(fs,list,reg))
3088 fixjump(fs,list,vtarget);
3090 fixjump(fs,list,dtarget);
3094 static void dischargejpc(FuncState*fs){
3095 patchlistaux(fs,fs->jpc,fs->pc,((1<<8)-1),fs->pc);
3096 fs->jpc=(-1);
3098 static void luaK_patchlist(FuncState*fs,int list,int target){
3099 if(target==fs->pc)
3100 luaK_patchtohere(fs,list);
3102 patchlistaux(fs,list,target,((1<<8)-1),target);
3105 static void luaK_patchtohere(FuncState*fs,int list){
3106 luaK_getlabel(fs);
3107 luaK_concat(fs,&fs->jpc,list);
3109 static void luaK_concat(FuncState*fs,int*l1,int l2){
3116 while((next=getjump(fs,list))!=(-1))
3118 fixjump(fs,list,l2);
3121 static void luaK_checkstack(FuncState*fs,int n){
3122 int newstack=fs->freereg+n;
3123 if(newstack>fs->f->maxstacksize){
3125 luaX_syntaxerror(fs->ls,"function or expression too complex");
3126 fs->f->maxstacksize=cast_byte(newstack);
3129 static void luaK_reserveregs(FuncState*fs,int n){
3130 luaK_checkstack(fs,n);
3131 fs->freereg+=n;
3133 static void freereg(FuncState*fs,int reg){
3134 if(!ISK(reg)&&reg>=fs->nactvar){
3135 fs->freereg--;
3138 static void freeexp(FuncState*fs,expdesc*e){
3140 freereg(fs,e->u.s.info);
3142 static int addk(FuncState*fs,TValue*k,TValue*v){
3143 lua_State*L=fs->L;
3144 TValue*idx=luaH_set(L,fs->h,k);
3145 Proto*f=fs->f;
3151 setnvalue(idx,cast_num(fs->nk));
3152 luaM_growvector(L,f->k,fs->nk,f->sizek,TValue,
3155 setobj(L,&f->k[fs->nk],v);
3157 return fs->nk++;
3160 static int luaK_stringK(FuncState*fs,TString*s){
3162 setsvalue(fs->L,&o,s);
3163 return addk(fs,&o,&o);
3165 static int luaK_numberK(FuncState*fs,lua_Number r){
3168 return addk(fs,&o,&o);
3170 static int boolK(FuncState*fs,int b){
3173 return addk(fs,&o,&o);
3175 static int nilK(FuncState*fs){
3178 sethvalue(fs->L,&k,fs->h);
3179 return addk(fs,&k,&v);
3181 static void luaK_setreturns(FuncState*fs,expdesc*e,int nresults){
3183 SETARG_C(getcode(fs,e),nresults+1);
3186 SETARG_B(getcode(fs,e),nresults+1);
3187 SETARG_A(getcode(fs,e),fs->freereg);
3188 luaK_reserveregs(fs,1);
3191 static void luaK_setoneret(FuncState*fs,expdesc*e){
3194 e->u.s.info=GETARG_A(getcode(fs,e));
3197 SETARG_B(getcode(fs,e),2);
3201 static void luaK_dischargevars(FuncState*fs,expdesc*e){
3208 e->u.s.info=luaK_codeABC(fs,OP_GETUPVAL,0,e->u.s.info,0);
3213 e->u.s.info=luaK_codeABx(fs,OP_GETGLOBAL,0,e->u.s.info);
3218 freereg(fs,e->u.s.aux);
3219 freereg(fs,e->u.s.info);
3220 e->u.s.info=luaK_codeABC(fs,OP_GETTABLE,0,e->u.s.info,e->u.s.aux);
3226 luaK_setoneret(fs,e);
3232 static int code_label(FuncState*fs,int A,int b,int jump){
3233 luaK_getlabel(fs);
3234 return luaK_codeABC(fs,OP_LOADBOOL,A,b,jump);
3236 static void discharge2reg(FuncState*fs,expdesc*e,int reg){
3237 luaK_dischargevars(fs,e);
3240 luaK_nil(fs,reg,1);
3244 luaK_codeABC(fs,OP_LOADBOOL,reg,e->k==VTRUE,0);
3248 luaK_codeABx(fs,OP_LOADK,reg,e->u.s.info);
3252 luaK_codeABx(fs,OP_LOADK,reg,luaK_numberK(fs,e->u.nval));
3256 Instruction*pc=&getcode(fs,e);
3262 luaK_codeABC(fs,OP_MOVE,reg,e->u.s.info,0);
3272 static void discharge2anyreg(FuncState*fs,expdesc*e){
3274 luaK_reserveregs(fs,1);
3275 discharge2reg(fs,e,fs->freereg-1);
3278 static void exp2reg(FuncState*fs,expdesc*e,int reg){
3279 discharge2reg(fs,e,reg);
3281 luaK_concat(fs,&e->t,e->u.s.info);
3286 if(need_value(fs,e->t)||need_value(fs,e->f)){
3287 int fj=(e->k==VJMP)?(-1):luaK_jump(fs);
3288 p_f=code_label(fs,reg,0,1);
3289 p_t=code_label(fs,reg,1,0);
3290 luaK_patchtohere(fs,fj);
3292 final=luaK_getlabel(fs);
3293 patchlistaux(fs,e->f,final,reg,p_f);
3294 patchlistaux(fs,e->t,final,reg,p_t);
3300 static void luaK_exp2nextreg(FuncState*fs,expdesc*e){
3301 luaK_dischargevars(fs,e);
3302 freeexp(fs,e);
3303 luaK_reserveregs(fs,1);
3304 exp2reg(fs,e,fs->freereg-1);
3306 static int luaK_exp2anyreg(FuncState*fs,expdesc*e){
3307 luaK_dischargevars(fs,e);
3310 if(e->u.s.info>=fs->nactvar){
3311 exp2reg(fs,e,e->u.s.info);
3315 luaK_exp2nextreg(fs,e);
3318 static void luaK_exp2val(FuncState*fs,expdesc*e){
3320 luaK_exp2anyreg(fs,e);
3322 luaK_dischargevars(fs,e);
3324 static int luaK_exp2RK(FuncState*fs,expdesc*e){
3325 luaK_exp2val(fs,e);
3331 if(fs->nk<=((1<<(9-1))-1)){
3332 e->u.s.info=(e->k==VNIL)?nilK(fs):
3333 (e->k==VKNUM)?luaK_numberK(fs,e->u.nval):
3334 boolK(fs,(e->k==VTRUE));
3347 return luaK_exp2anyreg(fs,e);
3349 static void luaK_storevar(FuncState*fs,expdesc*var,expdesc*ex){
3352 freeexp(fs,ex);
3353 exp2reg(fs,ex,var->u.s.info);
3357 int e=luaK_exp2anyreg(fs,ex);
3358 luaK_codeABC(fs,OP_SETUPVAL,e,var->u.s.info,0);
3362 int e=luaK_exp2anyreg(fs,ex);
3363 luaK_codeABx(fs,OP_SETGLOBAL,e,var->u.s.info);
3367 int e=luaK_exp2RK(fs,ex);
3368 luaK_codeABC(fs,OP_SETTABLE,var->u.s.info,var->u.s.aux,e);
3375 freeexp(fs,ex);
3377 static void luaK_self(FuncState*fs,expdesc*e,expdesc*key){
3379 luaK_exp2anyreg(fs,e);
3380 freeexp(fs,e);
3381 func=fs->freereg;
3382 luaK_reserveregs(fs,2);
3383 luaK_codeABC(fs,OP_SELF,func,e->u.s.info,luaK_exp2RK(fs,key));
3384 freeexp(fs,key);
3388 static void invertjump(FuncState*fs,expdesc*e){
3389 Instruction*pc=getjumpcontrol(fs,e->u.s.info);
3392 static int jumponcond(FuncState*fs,expdesc*e,int cond){
3394 Instruction ie=getcode(fs,e);
3396 fs->pc--;
3397 return condjump(fs,OP_TEST,GETARG_B(ie),0,!cond);
3400 discharge2anyreg(fs,e);
3401 freeexp(fs,e);
3402 return condjump(fs,OP_TESTSET,((1<<8)-1),e->u.s.info,cond);
3404 static void luaK_goiftrue(FuncState*fs,expdesc*e){
3406 luaK_dischargevars(fs,e);
3413 invertjump(fs,e);
3418 pc=jumponcond(fs,e,0);
3422 luaK_concat(fs,&e->f,pc);
3423 luaK_patchtohere(fs,e->t);
3426 static void luaK_goiffalse(FuncState*fs,expdesc*e){
3428 luaK_dischargevars(fs,e);
3439 pc=jumponcond(fs,e,1);
3443 luaK_concat(fs,&e->t,pc);
3444 luaK_patchtohere(fs,e->f);
3447 static void codenot(FuncState*fs,expdesc*e){
3448 luaK_dischargevars(fs,e);
3459 invertjump(fs,e);
3464 discharge2anyreg(fs,e);
3465 freeexp(fs,e);
3466 e->u.s.info=luaK_codeABC(fs,OP_NOT,0,e->u.s.info,0);
3475 removevalues(fs,e->f);
3476 removevalues(fs,e->t);
3478 static void luaK_indexed(FuncState*fs,expdesc*t,expdesc*k){
3479 t->u.s.aux=luaK_exp2RK(fs,k);
3506 static void codearith(FuncState*fs,OpCode op,expdesc*e1,expdesc*e2){
3510 int o2=(op!=OP_UNM&&op!=OP_LEN)?luaK_exp2RK(fs,e2):0;
3511 int o1=luaK_exp2RK(fs,e1);
3513 freeexp(fs,e1);
3514 freeexp(fs,e2);
3517 freeexp(fs,e2);
3518 freeexp(fs,e1);
3520 e1->u.s.info=luaK_codeABC(fs,op,0,o1,o2);
3524 static void codecomp(FuncState*fs,OpCode op,int cond,expdesc*e1,
3526 int o1=luaK_exp2RK(fs,e1);
3527 int o2=luaK_exp2RK(fs,e2);
3528 freeexp(fs,e2);
3529 freeexp(fs,e1);
3535 e1->u.s.info=condjump(fs,op,cond,o1,o2);
3538 static void luaK_prefix(FuncState*fs,UnOpr op,expdesc*e){
3544 luaK_exp2anyreg(fs,e);
3545 codearith(fs,OP_UNM,e,&e2);
3548 case OPR_NOT:codenot(fs,e);break;
3550 luaK_exp2anyreg(fs,e);
3551 codearith(fs,OP_LEN,e,&e2);
3557 static void luaK_infix(FuncState*fs,BinOpr op,expdesc*v){
3560 luaK_goiftrue(fs,v);
3564 luaK_goiffalse(fs,v);
3568 luaK_exp2nextreg(fs,v);
3573 if(!isnumeral(v))luaK_exp2RK(fs,v);
3577 luaK_exp2RK(fs,v);
3582 static void luaK_posfix(FuncState*fs,BinOpr op,expdesc*e1,expdesc*e2){
3585 luaK_dischargevars(fs,e2);
3586 luaK_concat(fs,&e2->f,e1->f);
3591 luaK_dischargevars(fs,e2);
3592 luaK_concat(fs,&e2->t,e1->t);
3597 luaK_exp2val(fs,e2);
3598 if(e2->k==VRELOCABLE&&GET_OPCODE(getcode(fs,e2))==OP_CONCAT){
3599 freeexp(fs,e1);
3600 SETARG_B(getcode(fs,e2),e1->u.s.info);
3604 luaK_exp2nextreg(fs,e2);
3605 codearith(fs,OP_CONCAT,e1,e2);
3609 case OPR_ADD:codearith(fs,OP_ADD,e1,e2);break;
3610 case OPR_SUB:codearith(fs,OP_SUB,e1,e2);break;
3611 case OPR_MUL:codearith(fs,OP_MUL,e1,e2);break;
3612 case OPR_DIV:codearith(fs,OP_DIV,e1,e2);break;
3613 case OPR_MOD:codearith(fs,OP_MOD,e1,e2);break;
3614 case OPR_POW:codearith(fs,OP_POW,e1,e2);break;
3615 case OPR_EQ:codecomp(fs,OP_EQ,1,e1,e2);break;
3616 case OPR_NE:codecomp(fs,OP_EQ,0,e1,e2);break;
3617 case OPR_LT:codecomp(fs,OP_LT,1,e1,e2);break;
3618 case OPR_LE:codecomp(fs,OP_LE,1,e1,e2);break;
3619 case OPR_GT:codecomp(fs,OP_LT,0,e1,e2);break;
3620 case OPR_GE:codecomp(fs,OP_LE,0,e1,e2);break;
3624 static void luaK_fixline(FuncState*fs,int line){
3625 fs->f->lineinfo[fs->pc-1]=line;
3627 static int luaK_code(FuncState*fs,Instruction i,int line){
3628 Proto*f=fs->f;
3629 dischargejpc(fs);
3630 luaM_growvector(fs->L,f->code,fs->pc,f->sizecode,Instruction,
3632 f->code[fs->pc]=i;
3633 luaM_growvector(fs->L,f->lineinfo,fs->pc,f->sizelineinfo,int,
3635 f->lineinfo[fs->pc]=line;
3636 return fs->pc++;
3638 static int luaK_codeABC(FuncState*fs,OpCode o,int a,int b,int c){
3639 return luaK_code(fs,CREATE_ABC(o,a,b,c),fs->ls->lastline);
3641 static int luaK_codeABx(FuncState*fs,OpCode o,int a,unsigned int bc){
3642 return luaK_code(fs,CREATE_ABx(o,a,bc),fs->ls->lastline);
3644 static void luaK_setlist(FuncState*fs,int base,int nelems,int tostore){
3648 luaK_codeABC(fs,OP_SETLIST,base,b,c);
3650 luaK_codeABC(fs,OP_SETLIST,base,b,0);
3651 luaK_code(fs,cast(Instruction,c),fs->ls->lastline);
3653 fs->freereg=base+1;
3656 #define getlocvar(fs,i)((fs)->f->locvars[(fs)->actvar[i]])
3657 #define luaY_checklimit(fs,v,l,m)if((v)>(l))errorlimit(fs,l,m)
3677 static void errorlimit(FuncState*fs,int limit,const char*what){
3678 const char*msg=(fs->f->linedefined==0)?
3679 luaO_pushfstring(fs->L,"main function has more than %d %s",limit,what):
3680 luaO_pushfstring(fs->L,"function at line %d has more than %d %s",
3681 fs->f->linedefined,limit,what);
3682 luaX_lexerror(fs->ls,msg,0);
3724 init_exp(e,VK,luaK_stringK(ls->fs,s));
3730 FuncState*fs=ls->fs;
3731 Proto*f=fs->f;
3733 luaM_growvector(ls->L,f->locvars,fs->nlocvars,f->sizelocvars,
3736 f->locvars[fs->nlocvars].varname=varname;
3738 return fs->nlocvars++;
3742 FuncState*fs=ls->fs;
3743 luaY_checklimit(fs,fs->nactvar+n+1,200,"local variables");
3744 fs->actvar[fs->nactvar+n]=cast(unsigned short,registerlocalvar(ls,name));
3747 FuncState*fs=ls->fs;
3748 fs->nactvar=cast_byte(fs->nactvar+nvars);
3750 getlocvar(fs,fs->nactvar-nvars).startpc=fs->pc;
3754 FuncState*fs=ls->fs;
3755 while(fs->nactvar>tolevel)
3756 getlocvar(fs,--fs->nactvar).endpc=fs->pc;
3758 static int indexupvalue(FuncState*fs,TString*name,expdesc*v){
3760 Proto*f=fs->f;
3763 if(fs->upvalues[i].k==v->k&&fs->upvalues[i].info==v->u.s.info){
3767 luaY_checklimit(fs,f->nups+1,60,"upvalues");
3768 luaM_growvector(fs->L,f->upvalues,f->nups,f->sizeupvalues,
3772 luaC_objbarrier(fs->L,f,name);
3773 fs->upvalues[f->nups].k=cast_byte(v->k);
3774 fs->upvalues[f->nups].info=cast_byte(v->u.s.info);
3777 static int searchvar(FuncState*fs,TString*n){
3779 for(i=fs->nactvar-1;i>=0;i--){
3780 if(n==getlocvar(fs,i).varname)
3785 static void markupval(FuncState*fs,int level){
3786 BlockCnt*bl=fs->bl;
3790 static int singlevaraux(FuncState*fs,TString*n,expdesc*var,int base){
3791 if(fs==NULL){
3796 int v=searchvar(fs,n);
3800 markupval(fs,v);
3804 if(singlevaraux(fs->prev,n,var,0)==VGLOBAL)
3806 var->u.s.info=indexupvalue(fs,n,var);
3814 FuncState*fs=ls->fs;
3815 if(singlevaraux(fs,varname,var,1)==VGLOBAL)
3816 var->u.s.info=luaK_stringK(fs,varname);
3819 FuncState*fs=ls->fs;
3824 luaK_setreturns(fs,e,extra);
3825 if(extra>1)luaK_reserveregs(fs,extra-1);
3828 if(e->k!=VVOID)luaK_exp2nextreg(fs,e);
3830 int reg=fs->freereg;
3831 luaK_reserveregs(fs,extra);
3832 luaK_nil(fs,reg,extra);
3841 static void enterblock(FuncState*fs,BlockCnt*bl,lu_byte isbreakable){
3844 bl->nactvar=fs->nactvar;
3846 bl->previous=fs->bl;
3847 fs->bl=bl;
3849 static void leaveblock(FuncState*fs){
3850 BlockCnt*bl=fs->bl;
3851 fs->bl=bl->previous;
3852 removevars(fs->ls,bl->nactvar);
3854 luaK_codeABC(fs,OP_CLOSE,bl->nactvar,0,0);
3855 fs->freereg=fs->nactvar;
3856 luaK_patchtohere(fs,bl->breaklist);
3859 FuncState*fs=ls->fs;
3860 Proto*f=fs->f;
3863 luaM_growvector(ls->L,f->p,fs->np,f->sizep,Proto*,
3866 f->p[fs->np++]=func->f;
3868 init_exp(v,VRELOCABLE,luaK_codeABx(fs,OP_CLOSURE,0,fs->np-1));
3871 luaK_codeABC(fs,o,0,func->upvalues[i].info,0);
3874 static void open_func(LexState*ls,FuncState*fs){
3877 fs->f=f;
3878 fs->prev=ls->fs;
3879 fs->ls=ls;
3880 fs->L=L;
3881 ls->fs=fs;
3882 fs->pc=0;
3883 fs->lasttarget=-1;
3884 fs->jpc=(-1);
3885 fs->freereg=0;
3886 fs->nk=0;
3887 fs->np=0;
3888 fs->nlocvars=0;
3889 fs->nactvar=0;
3890 fs->bl=NULL;
3893 fs->h=luaH_new(L,0,0);
3894 sethvalue(L,L->top,fs->h);
3901 FuncState*fs=ls->fs;
3902 Proto*f=fs->f;
3904 luaK_ret(fs,0,0);
3905 luaM_reallocvector(L,f->code,f->sizecode,fs->pc,Instruction);
3906 f->sizecode=fs->pc;
3907 luaM_reallocvector(L,f->lineinfo,f->sizelineinfo,fs->pc,int);
3908 f->sizelineinfo=fs->pc;
3909 luaM_reallocvector(L,f->k,f->sizek,fs->nk,TValue);
3910 f->sizek=fs->nk;
3911 luaM_reallocvector(L,f->p,f->sizep,fs->np,Proto*);
3912 f->sizep=fs->np;
3913 luaM_reallocvector(L,f->locvars,f->sizelocvars,fs->nlocvars,LocVar);
3914 f->sizelocvars=fs->nlocvars;
3917 ls->fs=fs->prev;
3918 if(fs)anchor_token(ls);
3935 FuncState*fs=ls->fs;
3937 luaK_exp2anyreg(fs,v);
3940 luaK_indexed(fs,v,&key);
3945 luaK_exp2val(ls->fs,v);
3956 FuncState*fs=ls->fs;
3957 int reg=ls->fs->freereg;
3961 luaY_checklimit(fs,cc->nh,(INT_MAX-2),"items in a constructor");
3968 rkkey=luaK_exp2RK(fs,&key);
3970 luaK_codeABC(fs,OP_SETTABLE,cc->t->u.s.info,rkkey,luaK_exp2RK(fs,&val));
3971 fs->freereg=reg;
3973 static void closelistfield(FuncState*fs,struct ConsControl*cc){
3975 luaK_exp2nextreg(fs,&cc->v);
3978 luaK_setlist(fs,cc->t->u.s.info,cc->na,cc->tostore);
3982 static void lastlistfield(FuncState*fs,struct ConsControl*cc){
3985 luaK_setmultret(fs,&cc->v);
3986 luaK_setlist(fs,cc->t->u.s.info,cc->na,(-1));
3991 luaK_exp2nextreg(fs,&cc->v);
3992 luaK_setlist(fs,cc->t->u.s.info,cc->na,cc->tostore);
3997 luaY_checklimit(ls->fs,cc->na,(INT_MAX-2),"items in a constructor");
4002 FuncState*fs=ls->fs;
4004 int pc=luaK_codeABC(fs,OP_NEWTABLE,0,0,0);
4010 luaK_exp2nextreg(ls->fs,t);
4014 closelistfield(fs,&cc);
4035 lastlistfield(fs,&cc);
4036 SETARG_B(fs->f->code[pc],luaO_int2fb(cc.na));
4037 SETARG_C(fs->f->code[pc],luaO_int2fb(cc.nh));
4040 FuncState*fs=ls->fs;
4041 Proto*f=fs->f;
4061 f->numparams=cast_byte(fs->nactvar-(f->is_vararg&1));
4062 luaK_reserveregs(fs,fs->nactvar);
4085 luaK_exp2nextreg(ls->fs,v);
4092 FuncState*fs=ls->fs;
4105 luaK_setmultret(fs,&args);
4129 luaK_exp2nextreg(fs,&args);
4130 nparams=fs->freereg-(base+1);
4132 init_exp(f,VCALL,luaK_codeABC(fs,OP_CALL,base,nparams+1,2));
4133 luaK_fixline(fs,line);
4134 fs->freereg=base+1;
4143 luaK_dischargevars(ls->fs,v);
4157 FuncState*fs=ls->fs;
4167 luaK_exp2anyreg(fs,v);
4169 luaK_indexed(fs,v,&key);
4176 luaK_self(fs,v,&key);
4181 luaK_exp2nextreg(fs,v);
4213 FuncState*fs=ls->fs;
4214 check_condition(ls,fs->f->is_vararg,
4216 fs->f->is_vararg&=~4;
4217 init_exp(v,VVARARG,luaK_codeABC(fs,OP_VARARG,0,1,0));
4282 luaK_prefix(ls->fs,uop,v);
4290 luaK_infix(ls->fs,op,v);
4292 luaK_posfix(ls->fs,op,v,&v2);
4310 FuncState*fs=ls->fs;
4312 enterblock(fs,&bl,0);
4314 leaveblock(fs);
4321 FuncState*fs=ls->fs;
4322 int extra=fs->freereg;
4337 luaK_codeABC(fs,OP_MOVE,fs->freereg,v->u.s.info,0);
4338 luaK_reserveregs(fs,1);
4351 luaY_checklimit(ls->fs,nvars,200-ls->L->nCcalls,
4362 ls->fs->freereg-=nexps-nvars;
4365 luaK_setoneret(ls->fs,&e);
4366 luaK_storevar(ls->fs,&lh->v,&e);
4370 init_exp(&e,VNONRELOC,ls->fs->freereg-1);
4371 luaK_storevar(ls->fs,&lh->v,&e);
4377 luaK_goiftrue(ls->fs,&v);
4381 FuncState*fs=ls->fs;
4382 BlockCnt*bl=fs->bl;
4391 luaK_codeABC(fs,OP_CLOSE,bl->nactvar,0,0);
4392 luaK_concat(fs,&bl->breaklist,luaK_jump(fs));
4395 FuncState*fs=ls->fs;
4400 whileinit=luaK_getlabel(fs);
4402 enterblock(fs,&bl,1);
4405 luaK_patchlist(fs,luaK_jump(fs),whileinit);
4407 leaveblock(fs);
4408 luaK_patchtohere(fs,condexit);
4412 FuncState*fs=ls->fs;
4413 int repeat_init=luaK_getlabel(fs);
4415 enterblock(fs,&bl1,1);
4416 enterblock(fs,&bl2,0);
4422 leaveblock(fs);
4423 luaK_patchlist(ls->fs,condexit,repeat_init);
4427 luaK_patchtohere(ls->fs,condexit);
4428 leaveblock(fs);
4429 luaK_patchlist(ls->fs,luaK_jump(fs),repeat_init);
4431 leaveblock(fs);
4438 luaK_exp2nextreg(ls->fs,&e);
4443 FuncState*fs=ls->fs;
4447 prep=isnum?luaK_codeAsBx(fs,OP_FORPREP,base,(-1)):luaK_jump(fs);
4448 enterblock(fs,&bl,0);
4450 luaK_reserveregs(fs,nvars);
4452 leaveblock(fs);
4453 luaK_patchtohere(fs,prep);
4454 endfor=(isnum)?luaK_codeAsBx(fs,OP_FORLOOP,base,(-1)):
4455 luaK_codeABC(fs,OP_TFORLOOP,base,0,nvars);
4456 luaK_fixline(fs,line);
4457 luaK_patchlist(fs,(isnum?endfor:luaK_jump(fs)),prep+1);
4460 FuncState*fs=ls->fs;
4461 int base=fs->freereg;
4473 luaK_codeABx(fs,OP_LOADK,fs->freereg,luaK_numberK(fs,1));
4474 luaK_reserveregs(fs,1);
4479 FuncState*fs=ls->fs;
4483 int base=fs->freereg;
4493 luaK_checkstack(fs,3);
4497 FuncState*fs=ls->fs;
4500 enterblock(fs,&bl,1);
4509 leaveblock(fs);
4520 FuncState*fs=ls->fs;
4525 luaK_concat(fs,&escapelist,luaK_jump(fs));
4526 luaK_patchtohere(fs,flist);
4530 luaK_concat(fs,&escapelist,luaK_jump(fs));
4531 luaK_patchtohere(fs,flist);
4536 luaK_concat(fs,&escapelist,flist);
4537 luaK_patchtohere(fs,escapelist);
4542 FuncState*fs=ls->fs;
4544 init_exp(&v,VLOCAL,fs->freereg);
4545 luaK_reserveregs(fs,1);
4548 luaK_storevar(fs,&v,&b);
4549 getlocvar(fs,fs->nactvar-1).startpc=fs->pc;
4584 luaK_storevar(ls->fs,&v,&b);
4585 luaK_fixline(ls->fs,line);
4588 FuncState*fs=ls->fs;
4592 SETARG_C(getcode(fs,&v.v),1);
4599 FuncState*fs=ls->fs;
4608 luaK_setmultret(fs,&e);
4610 SET_OPCODE(getcode(fs,&e),OP_TAILCALL);
4612 first=fs->nactvar;
4617 first=luaK_exp2anyreg(fs,&e);
4619 luaK_exp2nextreg(fs,&e);
4620 first=fs->nactvar;
4624 luaK_ret(fs,first,nret);
4684 ls->fs->freereg=ls->fs->nactvar;