From a006514ea138a29b6031058d9002b48a572b5dd6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 29 Oct 2018 14:26:48 -0300 Subject: Big revamp in the implmentation of labels/gotos Added restriction that, when a label is created, there cannot be another label with the same name visible. That allows backward goto's to be resolved when they are read. Backward goto's get a close if they jump out of the scope of some variable; labels get a close only if previous goto to it jumps out of the scope of some upvalue. --- lopcodes.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index 4797d7c3..5a38f767 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -21,7 +21,7 @@ iABC C(8) | B(8) |k| A(8) | Op(7) | iABx Bx(17) | A(8) | Op(7) | iAsB sBx (signed)(17) | A(8) | Op(7) | iAx Ax(25) | Op(7) | -isJ sJ(24) |m| Op(7) | +isJ sJ(25) | Op(7) | A signed argument is represented in excess K: the represented value is the written unsigned value minus K, where K is half the maximum for the @@ -40,7 +40,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ #define SIZE_Bx (SIZE_C + SIZE_B + 1) #define SIZE_A 8 #define SIZE_Ax (SIZE_Bx + SIZE_A) -#define SIZE_sJ (SIZE_Bx + SIZE_A - 1) +#define SIZE_sJ (SIZE_Bx + SIZE_A) #define SIZE_OP 7 @@ -55,8 +55,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ #define POS_Ax POS_A -#define POS_m POS_A -#define POS_sJ (POS_A + 1) +#define POS_sJ POS_A /* ** limits for opcode arguments. @@ -144,8 +143,6 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ check_exp(checkopm(i, isJ), getarg(i, POS_sJ, SIZE_sJ) - OFFSET_sJ) #define SETARG_sJ(i,j) \ setarg(i, cast_uint((j)+OFFSET_sJ), POS_sJ, SIZE_sJ) -#define GETARG_m(i) check_exp(checkopm(i, isJ), getarg(i, POS_m, 1)) -#define SETARG_m(i,m) setarg(i, m, POS_m, 1) #define CREATE_ABCk(o,a,b,c,k) ((cast(Instruction, o)<