diff options
author | Waldemar Celes <celes@tecgraf.puc-rio.br> | 1994-12-27 18:41:11 -0200 |
---|---|---|
committer | Waldemar Celes <celes@tecgraf.puc-rio.br> | 1994-12-27 18:41:11 -0200 |
commit | a8220feed2abf715b1708c76eb2a897585763faa (patch) | |
tree | e505cc0c9d3ecbce8393cbc60896bc2bdf64e3b0 | |
parent | 8bc4b0d741f73109e761e73a7932f8fe47b242d5 (diff) | |
download | lua-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.stx | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -1,6 +1,6 @@ | |||
1 | %{ | 1 | %{ |
2 | 2 | ||
3 | char *rcs_luastx = "$Id: lua.stx,v 3.14 1994/12/20 21:20:36 roberto Exp celes $"; | 3 | char *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 */ |
19 | int yyparse (void); | 18 | int 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 |
32 | static Word maxcode; | 30 | static int maxcode; |
33 | static Word maxmain; | 31 | static int maxmain; |
34 | static Long maxcurr; /* to allow maxcurr *= 2 without overflow */ | 32 | static Long maxcurr; /* to allow maxcurr *= 2 without overflow */ |
35 | static Byte *funcCode = NULL; | 33 | static Byte *funcCode = NULL; |
36 | static Byte **initcode; | 34 | static Byte **initcode; |
37 | static Byte *basepc; | 35 | static Byte *basepc; |
38 | static Word maincode; | 36 | static int maincode; |
39 | static Word pc; | 37 | static int pc; |
40 | 38 | ||
41 | #define MAXVAR 32 | 39 | #define MAXVAR 32 |
42 | static Long varbuffer[MAXVAR]; /* variables in an assignment list; | 40 | static 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; |