2000-01-17:

(1) Extending localvars to 64K

* compiler/Emitcode:

Split checkAccessIndex into checkAccessIndex8 and checkAccessIndex16.

16 bit: 

Kaccess/ACCESS, Kenvacc/ENVACC, Kassign/ASSIGN, Kpop/POP,
Kreturn/RETURN, Kprim Pdummy/DUMMY, Kpush :: Kaccess/PUSHACC,
PUSHENVACC,

Add checks to: Kgetfield, Ksetfield

Remains 8 bit:

Kapply, Kgrab, 

Mixed 8 and 16 bit:

Kappterm/APPTERM, APPTERM1-4, PUSH_GETGLOBAL_APPTERM1-4,
PUSH_ENV1_APPTERM1-4


* runtime/interp.c:

Replace: u8pci with u16pc and pc+=SHORT

DUMMY: Alloc_small OK, since 65KW=256KB = minimum young heap

Shorts are output LSB first:

static opcode_t byte_callback1_code[] = { ACC1, APPLY1, POP, 1, 0, STOP };
static opcode_t byte_callback2_code[] = { ACC2, APPLY2, POP, 1, 0, STOP };
static opcode_t byte_callback3_code[] = { ACC3, APPLY3, POP, 1, 0, STOP };
#define CALLBACK_CODE_LEN 6

* runtime/expand.c:

ACCESS etc.



(2) Extending jumps to +-2G

* runtime/expand.c:

    Affected instructions:

+    Instruct(PUSH_RETADDR): 
+    Instruct(PUSHTRAP):
+    Instruct(BRANCH):
+    Instruct(BRANCHIF):
+    Instruct(BRANCHIFNOT):
+    Instruct(POPBRANCHIFNOT):
+    Instruct(BRANCHIFEQ):
+    Instruct(BRANCHIFNEQ):
+    Instruct(BRANCHIFLT):
+    Instruct(BRANCHIFGT):
+    Instruct(BRANCHIFLE):
+    Instruct(BRANCHIFGE):
+    Instruct(BRANCHINTERVAL):
+    Instruct(BRANCHIFNEQTAG):
+    Instruct(SWITCH):
+    Instruct(CLOSURE):
+    Instruct(CLOSREC):





* runtime/interp.c:

#define JUMPSWITCHINDEX(pc, accu) (bytecode_t)(pc + s16(pc + accu - 1))
-->
#define JUMPSWITCHINDEX(pc, accu) (bytecode_t)(pc + s32(pc + accu - 1))

JUMPTGT(s16pc) 
-->
JUMPTGT(s32pc) 


In all the negative cases of branches:

pc += SHORT;
-->
pc += LONG;


* compiler/Labels.sml:

In out_label_with_orig:

out_short --> out_long (three times)
