The unified diff between revisions [58a3ccba..] and [ce9d6288..] is displayed below. It can also be downloaded as a raw diff.
# # old_revision [58a3ccba47e51398ea76582c5b4a94bf8af04187] # new_revision [ce9d628825328f2576769426f4d3544fe89a14ce] # # patch "src/include/code.h" # from [bdc4e4415aab3cfedffd452b07060496733e096d] # to [e57dbef1f7a07dc2dacb0bec3816311a749022d2] # # patch "src/lsc/codegen.c" # from [0066fecf055581632eaebac395d4caacee9c44d2] # to [54841dc0395a35f38eeef2e81231366c4fed3015] # # patch "src/lsi/abi.h" # from [98e94aff91b2f63bdfe39ead17c398d5a72e5822] # to [5baace9e64fed6a7cb0eb3af2c188604cca63811] # # patch "src/lsi/vm.c" # from [21cb4758184746d16520d59606f7d02c7f055f6a] # to [2f4df836fac21746563e434768e4f832c1ea3e15] # ============================================================ --- src/include/code.h bdc4e4415aab3cfedffd452b07060496733e096d +++ src/include/code.h e57dbef1f7a07dc2dacb0bec3816311a749022d2 @@ -132,10 +132,15 @@ typedef int stkentry; * Structure of the file header: * * 2 "LC" (magic) - * 2 0 (version) + * 2 00:01 (version) * 4 ptr (pointer to function table) + * 4 abiversion1 + * 4 abiversion2 + * 4 abiversion3 + * 4 abiversion4 + * 4 abiversion5 * - * ptr-4 code + * ptr-28 code * * 1 or more of: * 4 length of block, or 0 to terminate @@ -150,5 +155,5 @@ typedef int stkentry; #define MAGIC1 'L' #define MAGIC2 'C' #define VERSION1 0 -#define VERSION2 0 +#define VERSION2 1 ============================================================ --- src/lsc/codegen.c 0066fecf055581632eaebac395d4caacee9c44d2 +++ src/lsc/codegen.c 54841dc0395a35f38eeef2e81231366c4fed3015 @@ -267,9 +267,11 @@ int lookup_function(ast *node, struct fn return 1; } -int lookup_constant(ast *node, int *constant) +#define lookup_constant(node, constant) \ + lookup_constant_string(node->info.string, constant) + +int lookup_constant_string(char *constantname, int *constant) { - char *constantname = node->info.string; struct hashentry *hashptr; if (constant_count < 0) @@ -1185,6 +1187,7 @@ void output_code(void) int morepasses = 1; int passno = 0; int pc; + int abiver; while (morepasses) { ptr = instr_head; @@ -1259,10 +1262,23 @@ void output_code(void) output_byte(VERSION1); output_byte(VERSION2); +#define ABIVERSION(x) do { \ + abiver = 0; \ + if (!lookup_constant_string(x, &abiver)) \ + printf("%s not defined\n", x); \ + output_int(abiver); \ + } while (0) + pc = (pc + 3) & ~3; /* Align table */ - output_int(pc+8); /* Pointer to function table */ + output_int(pc+28); /* Pointer to function table */ + ABIVERSION("__abiversion1"); + ABIVERSION("__abiversion2"); + ABIVERSION("__abiversion3"); + ABIVERSION("__abiversion4"); + ABIVERSION("__abiversion5"); + ptr = instr_head; pc = 0; while (ptr) { ============================================================ --- src/lsi/abi.h 98e94aff91b2f63bdfe39ead17c398d5a72e5822 +++ src/lsi/abi.h 5baace9e64fed6a7cb0eb3af2c188604cca63811 @@ -2,6 +2,12 @@ typedef int (*vm_intfn)(void); typedef int (*vm_intfn)(void); +extern const long vm_abiversion1; +extern const long vm_abiversion2; +extern const long vm_abiversion3; +extern const long vm_abiversion4; +extern const long vm_abiversion5; + /* * We must include here all prototypes for functions which can be * included in the ABI function table ============================================================ --- src/lsi/vm.c 21cb4758184746d16520d59606f7d02c7f055f6a +++ src/lsi/vm.c 2f4df836fac21746563e434768e4f832c1ea3e15 @@ -609,6 +609,11 @@ void vm_init_functions(void) assert(vm_codearea[2] == VERSION1); assert(vm_codearea[3] == VERSION2); + assert(GETINT(vm_codearea, 8) == vm_abiversion1); + assert(GETINT(vm_codearea, 12) == vm_abiversion2); + assert(GETINT(vm_codearea, 16) == vm_abiversion3); + assert(GETINT(vm_codearea, 20) == vm_abiversion4); + assert(GETINT(vm_codearea, 24) == vm_abiversion5); /* Now, get the function table pointer */ t = GETINT(vm_codearea, 4);