From 4e0bf95622151cf09a2708b465d6df682ad43284 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 29 Dec 1997 15:35:46 -0200 Subject: [PATCH] variant opcodes for PUSHSELF --- lopcodes.h | 10 +++++++++- lua.stx | 4 ++-- lvm.c | 8 ++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lopcodes.h b/lopcodes.h index ec3cfce2..a93ae98c 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -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) */ diff --git a/lua.stx b/lua.stx index 07e0d0cd..784ad704 100644 --- a/lua.stx +++ b/lua.stx @@ -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; } ; diff --git a/lvm.c b/lvm.c index 56a842bc..13bd6e73 100644 --- a/lvm.c +++ b/lvm.c @@ -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];