From e4e6904b53508edab67a29d14690e29cff0d2dfe Mon Sep 17 00:00:00 2001 From: Zoltan Somogyi Date: Tue, 14 Nov 2006 00:22:34 +0000 Subject: [PATCH] Add a version number to the module layout structure. Estimated hours taken: 0.1 Branches: main Add a version number to the module layout structure. This is needed to allow future changes to layout structures to take place in a backwards compatible manner. However, this change itself is backward compatible only for programs without debugging enabled. If your installed compiler generates the new field but your runtime doesn't define it, or vice versa, you will get strange crashes whenever you use the debugger. runtime/mercury_stack_layout.h: Add a version number field to the start of the module layout structure. compiler/layout_out.m: Fill in the new field. runtime/mercury_grade.h: Increment the binary compatibility version number for debug grades. --- compiler/layout_out.m | 3 +++ runtime/mercury_grade.h | 2 +- runtime/mercury_stack_layout.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/layout_out.m b/compiler/layout_out.m index 774611a4c..24b88f9cd 100644 --- a/compiler/layout_out.m +++ b/compiler/layout_out.m @@ -1308,6 +1308,9 @@ output_module_layout_data_defn(ModuleName, StringTableSize, StringTable, io.write_string("\n", !IO), output_layout_name_storage_type_name(ModuleLayoutName, yes, !IO), io.write_string(" = {\n", !IO), + VersionNumber = 0, + io.write_int(VersionNumber, !IO), + io.write_string(",\n", !IO), quote_and_write_string(sym_name_to_string(ModuleName), !IO), io.write_string(",\n", !IO), io.write_int(StringTableSize, !IO), diff --git a/runtime/mercury_grade.h b/runtime/mercury_grade.h index 11cde89f4..f20c1e838 100644 --- a/runtime/mercury_grade.h +++ b/runtime/mercury_grade.h @@ -61,7 +61,7 @@ */ #define MR_GRADE_PART_0 v14_ -#define MR_GRADE_EXEC_TRACE_VERSION_NO 6 +#define MR_GRADE_EXEC_TRACE_VERSION_NO 7 #define MR_GRADE_DEEP_PROF_VERSION_NO 2 #ifdef MR_HIGHLEVEL_CODE diff --git a/runtime/mercury_stack_layout.h b/runtime/mercury_stack_layout.h index 4b886e240..dc43b60df 100644 --- a/runtime/mercury_stack_layout.h +++ b/runtime/mercury_stack_layout.h @@ -1292,6 +1292,7 @@ typedef struct MR_Module_File_Layout_Struct { } MR_Module_File_Layout; struct MR_Module_Layout_Struct { + MR_uint_least8_t MR_ml_version_number; MR_ConstString MR_ml_name; MR_Integer MR_ml_string_table_size; const char *MR_ml_string_table;