From cbc58af26094ad6498c4160cf9710adc7883aa94 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 4 Feb 1999 14:36:16 -0200 Subject: new opcode for "long" arguments (3 bytes) --- lopcodes.h | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index 66af79f1..9d29fed9 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.h,v 1.19 1999/02/02 17:57:49 roberto Exp roberto $ +** $Id: lopcodes.h,v 1.20 1999/02/02 19:41:17 roberto Exp roberto $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ @@ -8,8 +8,6 @@ #define lopcodes_h -#define NUMOFFSET 100 - /* ** NOTICE: variants of the same opcode must be consecutive: First, those ** with word parameter, then with byte parameter. @@ -100,14 +98,38 @@ CLOSURE,/* b c v_c...v_1 closure(CNST[b], v_c...v_1) */ CALLFUNC,/* b c v_c...v_1 f r_b...r_1 f(v1,...,v_c) */ SETLINEW,/* w - - LINE=w */ -SETLINE /* b - - LINE=b */ +SETLINE,/* b - - LINE=b */ + +LONGARG /* b (add b*(1<<16) to arg of next instruction) */ } OpCode; +#define NUMOFFSET 100 /* offset for immediate numbers */ + #define RFIELDS_PER_FLUSH 32 /* records (SETMAP) */ -#define LFIELDS_PER_FLUSH 64 /* lists (SETLIST) */ +#define LFIELDS_PER_FLUSH 64 /* FPF - lists (SETLIST) */ #define ZEROVARARG 64 + +/* maximum value of an arg of 3 bytes; must fit in an "int" */ +#if MAX_INT < (1<<24) +#define MAX_ARG MAX_INT +#else +#define MAX_ARG ((1<<24)-1) +#endif + +/* maximum value of a word of 2 bytes; cannot be bigger than MAX_ARG */ +#if MAX_ARG < (1<<16) +#define MAX_WORD MAX_ARG +#else +#define MAX_WORD ((1<<16)-1) +#endif + + +/* maximum value of a byte */ +#define MAX_BYTE ((1<<8)-1) + + #endif -- cgit v1.2.3-55-g6feb