aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Celes <celes@tecgraf.puc-rio.br>1994-12-27 18:41:11 -0200
committerWaldemar Celes <celes@tecgraf.puc-rio.br>1994-12-27 18:41:11 -0200
commita8220feed2abf715b1708c76eb2a897585763faa (patch)
treee505cc0c9d3ecbce8393cbc60896bc2bdf64e3b0
parent8bc4b0d741f73109e761e73a7932f8fe47b242d5 (diff)
downloadlua-a8220feed2abf715b1708c76eb2a897585763faa.tar.gz
lua-a8220feed2abf715b1708c76eb2a897585763faa.tar.bz2
lua-a8220feed2abf715b1708c76eb2a897585763faa.zip
bytecodes are indexed by integers, not Words, to allow bigger code on 32 bit machines
-rw-r--r--lua.stx18
1 files changed, 8 insertions, 10 deletions
diff --git a/lua.stx b/lua.stx
index 2742da2e..451532d5 100644
--- a/lua.stx
+++ b/lua.stx
@@ -1,6 +1,6 @@
1%{ 1%{
2 2
3char *rcs_luastx = "$Id: lua.stx,v 3.14 1994/12/20 21:20:36 roberto Exp celes $"; 3char *rcs_luastx = "$Id: lua.stx,v 3.15 1994/12/27 20:04:29 celes Exp celes $";
4 4
5#include <stdio.h> 5#include <stdio.h>
6#include <stdlib.h> 6#include <stdlib.h>
@@ -14,14 +14,12 @@ char *rcs_luastx = "$Id: lua.stx,v 3.14 1994/12/20 21:20:36 roberto Exp celes $"
14#include "table.h" 14#include "table.h"
15#include "lua.h" 15#include "lua.h"
16 16
17
18/* to avoid warnings generated by yacc */ 17/* to avoid warnings generated by yacc */
19int yyparse (void); 18int yyparse (void);
20#define malloc luaI_malloc 19#define malloc luaI_malloc
21#define realloc luaI_realloc 20#define realloc luaI_realloc
22#define free luaI_free 21#define free luaI_free
23 22
24
25#ifndef LISTING 23#ifndef LISTING
26#define LISTING 0 24#define LISTING 0
27#endif 25#endif
@@ -29,14 +27,14 @@ int yyparse (void);
29#ifndef CODE_BLOCK 27#ifndef CODE_BLOCK
30#define CODE_BLOCK 256 28#define CODE_BLOCK 256
31#endif 29#endif
32static Word maxcode; 30static int maxcode;
33static Word maxmain; 31static int maxmain;
34static Long maxcurr; /* to allow maxcurr *= 2 without overflow */ 32static Long maxcurr; /* to allow maxcurr *= 2 without overflow */
35static Byte *funcCode = NULL; 33static Byte *funcCode = NULL;
36static Byte **initcode; 34static Byte **initcode;
37static Byte *basepc; 35static Byte *basepc;
38static Word maincode; 36static int maincode;
39static Word pc; 37static int pc;
40 38
41#define MAXVAR 32 39#define MAXVAR 32
42static Long varbuffer[MAXVAR]; /* variables in an assignment list; 40static Long varbuffer[MAXVAR]; /* variables in an assignment list;
@@ -57,11 +55,11 @@ static void code_byte (Byte c)
57{ 55{
58 if (pc>maxcurr-2) /* 1 byte free to code HALT of main code */ 56 if (pc>maxcurr-2) /* 1 byte free to code HALT of main code */
59 { 57 {
60 if (maxcurr >= MAX_WORD) 58 if (maxcurr >= MAX_INT)
61 lua_error("code size overflow"); 59 lua_error("code size overflow");
62 maxcurr *= 2; 60 maxcurr *= 2;
63 if (maxcurr >= MAX_WORD) 61 if (maxcurr >= MAX_INT)
64 maxcurr = MAX_WORD; 62 maxcurr = MAX_INT;
65 basepc = growvector(basepc, maxcurr, Byte); 63 basepc = growvector(basepc, maxcurr, Byte);
66 } 64 }
67 basepc[pc++] = c; 65 basepc[pc++] = c;