variant opcodes for PUSHSELF

This commit is contained in:
Roberto Ierusalimschy 1997-12-29 15:35:46 -02:00
parent 498a934abf
commit 4e0bf95622
3 changed files with 17 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
** $Id: lopcodes.h,v 1.11 1997/10/24 17:17:24 roberto Exp roberto $
** $Id: lopcodes.h,v 1.12 1997/10/24 18:40:29 roberto Exp roberto $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -79,6 +79,14 @@ GETDOTTED7,/* - t t[CONST[7]] */
GETDOTTEDW,/* w t t[CONST[w]] */
PUSHSELF,/* b t t t[CNST[b]] */
PUSHSELF0,/* - t t t[CNST[0]] */
PUSHSELF1,/* - t t t[CNST[1]] */
PUSHSELF2,/* - t t t[CNST[2]] */
PUSHSELF3,/* - t t t[CNST[3]] */
PUSHSELF4,/* - t t t[CNST[4]] */
PUSHSELF5,/* - t t t[CNST[5]] */
PUSHSELF6,/* - t t t[CNST[6]] */
PUSHSELF7,/* - t t t[CNST[7]] */
PUSHSELFW,/* w t t t[CNST[w]] */
CREATEARRAY,/* b - newarray(size = b) */

View File

@ -1,6 +1,6 @@
%{
/*
** $Id: lua.stx,v 1.28 1997/12/28 22:48:15 roberto Exp roberto $
** $Id: lua.stx,v 1.29 1997/12/29 17:28:45 roberto Exp roberto $
** Syntax analizer and code generator
** See Copyright Notice in lua.h
*/
@ -833,7 +833,7 @@ functioncall : funcvalue funcParams
funcvalue : sexp1 { $$ = 0; }
| sexp1 ':' NAME
{
code_oparg(PUSHSELF, 0, string_constant($3, L->currState), 1);
code_oparg(PUSHSELF, 8, string_constant($3, L->currState), 1);
$$ = 1;
}
;

8
lvm.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 1.18 1997/12/17 20:48:58 roberto Exp roberto $
** $Id: lvm.c,v 1.19 1997/12/23 19:24:19 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -363,7 +363,11 @@ StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base)
aux = next_word(pc); goto pushself;
case PUSHSELF:
aux = *pc++;
aux = *pc++; goto pushself;
case PUSHSELF0: case PUSHSELF1: case PUSHSELF2: case PUSHSELF3:
case PUSHSELF4: case PUSHSELF5: case PUSHSELF6: case PUSHSELF7:
aux -= PUSHSELF0;
pushself: {
TObject receiver = *(S->top-1);
*S->top++ = consts[aux];