Fix the declarations of builtin proc layouts.

This should fix Mantis bug #514.

runtime/mercury_builtin_types_proc_layouts.h:
    Fix the first problem: refer to four type constructors defined
    in private_builtin.m by their correct arities, so that the proc layout
    structures we generate for their unify and compare predicates
    get generated with the correct names and contents.

    The arities were probably correct when the code was written;
    we changed them from 1 to 0 at some point, and simply forgot
    to update all the affected places.

runtime/mercury_stack_layout.h:
    Fix the second problem: add "extern" to the declarations of those
    proc layout structures. Without the "extern", compilers defaulting
    the -fcommon will place these structures into common storage,
    which can be used as *definitions*. With the "extern", compilers
    should do the right thing whether or not they default to -fcommon.

runtime/mercury_unify_compare_body.h:
    Conform to the change in mercury_builtin_types_proc_layouts.h:
    refer to the affected four types using the correct arities.
This commit is contained in:
Zoltan Somogyi
2020-07-24 17:14:07 +10:00
parent ca8384de08
commit c5b35aca5f
3 changed files with 11 additions and 11 deletions

View File

@@ -64,10 +64,10 @@ MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(builtin, trailptr, 0);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(builtin, ticket, 0);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(private_builtin, heap_pointer, 0);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(private_builtin, ref, 1);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(private_builtin, type_ctor_info, 1);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(private_builtin, type_info, 1);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(private_builtin, base_typeclass_info, 1);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(private_builtin, typeclass_info, 1);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(private_builtin, type_ctor_info, 0);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(private_builtin, type_info, 0);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(private_builtin, base_typeclass_info, 0);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(private_builtin, typeclass_info, 0);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(type_desc, type_ctor_desc, 0);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(type_desc, pseudo_type_desc, 0);
MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(type_desc, type_desc, 0);

View File

@@ -1303,11 +1303,11 @@ extern int MR_find_start_of_num_suffix(const char *str);
succip_locn, pf, module, name, arity, mode, NULL)
#define MR_DECLARE_UCI_PROC_STATIC_LAYOUTS(mod, n, a) \
const MR_ProcLayoutUCI \
extern const MR_ProcLayoutUCI \
MR_proc_layout_uci_name(mod, __Unify__, n, a, 0); \
const MR_ProcLayoutUCI \
extern const MR_ProcLayoutUCI \
MR_proc_layout_uci_name(mod, __Compare__, n, a, 0); \
const MR_ProcLayoutUCI \
extern const MR_ProcLayoutUCI \
MR_proc_layout_uci_name(mod, __CompareRep__, n, a, 0);
// In procedures compiled with execution tracing, three items are stored

View File

@@ -829,7 +829,7 @@ start_label:
result = MR_compare_type_info(
(MR_TypeInfo) x, (MR_TypeInfo) y);
MR_restore_transient_registers();
return_compare_answer(private_builtin, type_info, 1, result);
return_compare_answer(private_builtin, type_info, 0, result);
#else
MR_bool result;
@@ -837,7 +837,7 @@ start_label:
result = MR_unify_type_info(
(MR_TypeInfo) x, (MR_TypeInfo) y);
MR_restore_transient_registers();
return_unify_answer(private_builtin, type_info, 1, result);
return_unify_answer(private_builtin, type_info, 0, result);
#endif
}
@@ -895,7 +895,7 @@ start_label:
result = MR_compare_type_ctor_info(
(MR_TypeCtorInfo) x, (MR_TypeCtorInfo) y);
MR_restore_transient_registers();
return_compare_answer(private_builtin, type_ctor_info, 1,
return_compare_answer(private_builtin, type_ctor_info, 0,
result);
#else
MR_bool result;
@@ -904,7 +904,7 @@ start_label:
result = MR_unify_type_ctor_info(
(MR_TypeCtorInfo) x, (MR_TypeCtorInfo) y);
MR_restore_transient_registers();
return_unify_answer(private_builtin, type_ctor_info, 1,
return_unify_answer(private_builtin, type_ctor_info, 0,
result);
#endif
}