mirror of https://github.com/rusefi/lua.git
bytecodes are indexed by integers, not Words, to allow bigger code on 32 bit machines
This commit is contained in:
parent
8bc4b0d741
commit
a8220feed2
18
lua.stx
18
lua.stx
|
@ -1,6 +1,6 @@
|
||||||
%{
|
%{
|
||||||
|
|
||||||
char *rcs_luastx = "$Id: lua.stx,v 3.14 1994/12/20 21:20:36 roberto Exp celes $";
|
char *rcs_luastx = "$Id: lua.stx,v 3.15 1994/12/27 20:04:29 celes Exp celes $";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#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 $"
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
|
|
||||||
|
|
||||||
/* to avoid warnings generated by yacc */
|
/* to avoid warnings generated by yacc */
|
||||||
int yyparse (void);
|
int yyparse (void);
|
||||||
#define malloc luaI_malloc
|
#define malloc luaI_malloc
|
||||||
#define realloc luaI_realloc
|
#define realloc luaI_realloc
|
||||||
#define free luaI_free
|
#define free luaI_free
|
||||||
|
|
||||||
|
|
||||||
#ifndef LISTING
|
#ifndef LISTING
|
||||||
#define LISTING 0
|
#define LISTING 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,14 +27,14 @@ int yyparse (void);
|
||||||
#ifndef CODE_BLOCK
|
#ifndef CODE_BLOCK
|
||||||
#define CODE_BLOCK 256
|
#define CODE_BLOCK 256
|
||||||
#endif
|
#endif
|
||||||
static Word maxcode;
|
static int maxcode;
|
||||||
static Word maxmain;
|
static int maxmain;
|
||||||
static Long maxcurr; /* to allow maxcurr *= 2 without overflow */
|
static Long maxcurr; /* to allow maxcurr *= 2 without overflow */
|
||||||
static Byte *funcCode = NULL;
|
static Byte *funcCode = NULL;
|
||||||
static Byte **initcode;
|
static Byte **initcode;
|
||||||
static Byte *basepc;
|
static Byte *basepc;
|
||||||
static Word maincode;
|
static int maincode;
|
||||||
static Word pc;
|
static int pc;
|
||||||
|
|
||||||
#define MAXVAR 32
|
#define MAXVAR 32
|
||||||
static Long varbuffer[MAXVAR]; /* variables in an assignment list;
|
static Long varbuffer[MAXVAR]; /* variables in an assignment list;
|
||||||
|
@ -57,11 +55,11 @@ static void code_byte (Byte c)
|
||||||
{
|
{
|
||||||
if (pc>maxcurr-2) /* 1 byte free to code HALT of main code */
|
if (pc>maxcurr-2) /* 1 byte free to code HALT of main code */
|
||||||
{
|
{
|
||||||
if (maxcurr >= MAX_WORD)
|
if (maxcurr >= MAX_INT)
|
||||||
lua_error("code size overflow");
|
lua_error("code size overflow");
|
||||||
maxcurr *= 2;
|
maxcurr *= 2;
|
||||||
if (maxcurr >= MAX_WORD)
|
if (maxcurr >= MAX_INT)
|
||||||
maxcurr = MAX_WORD;
|
maxcurr = MAX_INT;
|
||||||
basepc = growvector(basepc, maxcurr, Byte);
|
basepc = growvector(basepc, maxcurr, Byte);
|
||||||
}
|
}
|
||||||
basepc[pc++] = c;
|
basepc[pc++] = c;
|
||||||
|
|
Loading…
Reference in New Issue