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.
This commit is contained in:
Zoltan Somogyi
2006-11-14 00:22:34 +00:00
parent c959a1657f
commit e4e6904b53
3 changed files with 5 additions and 1 deletions

View File

@@ -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),

View File

@@ -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

View File

@@ -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;