[m-dev.] diff: hand define type_ctor_infos for array and univ.

Tyson Dowd trd at cs.mu.OZ.AU
Mon May 31 13:24:17 AEST 1999


Hi,

While trying to get type_ctor_representation into the type_ctor_infos
I found this problem.  It needs to be bootstrapped.

===================================================================


Estimated hours taken: 2

Making changes to type_ctor_infos for the builtin types array and univ
is much easier if we can simply change their type_ctor_info by hand
rather than detecting them as simple cases.  They already have their
type_ctor_functors and layouts defined by hand anyway.

compiler/type_util.m:
	Turn off the generation of type_ctor_info for the types array:array
	and std_util:univ.

runtime/mercury_bootstrap.c:
	Put type_ctor_infos for these types into the bootstrapping file.
	They are not needed (or wanted) for stage 1, but needed for stage 2.
	We rename the functors and layouts slightly so that the stage 2
	linking doesn't have them multiply defined. 


Index: compiler/type_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_util.m,v
retrieving revision 1.65
diff -u -r1.65 type_util.m
--- type_util.m	1999/04/23 01:03:05	1.65
+++ type_util.m	1999/05/29 16:26:16
@@ -270,6 +270,8 @@
 
 type_util__var(term__variable(Var), Var).
 
+type_id_is_hand_defined(qualified(unqualified("std_util"), "univ") - 0).
+type_id_is_hand_defined(qualified(unqualified("array"), "array") - 1).
 type_id_is_hand_defined(qualified(PrivateBuiltin, "type_info") - 1) :-
 	mercury_private_builtin_module(PrivateBuiltin).
 type_id_is_hand_defined(qualified(PrivateBuiltin, "type_ctor_info") - 1) :-
Index: runtime/mercury_bootstrap.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_bootstrap.c,v
retrieving revision 1.9
diff -u -r1.9 mercury_bootstrap.c
--- mercury_bootstrap.c	1999/05/24 13:21:55	1.9
+++ mercury_bootstrap.c	1999/05/31 03:12:03
@@ -22,4 +22,106 @@
 #include "mercury_imp.h"
 
 
+/*
+** We define these type_ctor_infos here until the compiler stops
+** generating them.  They should then move into array.m and std_util.m.
+**
+** There is no need to move the type_ctor_functors and type_ctor_layouts
+** back those files, because they are already defined in those files.
+** Be sure to remove the _bootstrap suffix on the references to them
+** in the type_ctor_info.
+*/
+
+
+Declare_entry(mercury____Unify___array__array_1_0);
+Declare_entry(mercury____Index___array__array_1_0);
+Declare_entry(mercury____Compare___array__array_1_0);
+extern const struct mercury_data_array__type_ctor_functors_array_1_struct
+	mercury_data_array__type_ctor_functors_array_1_bootstrap;
+extern const struct mercury_data_array__type_ctor_layout_array_1_struct
+	mercury_data_array__type_ctor_layout_array_1_bootstrap;
+MR_STATIC_CODE_CONST struct
+mercury_data_array__type_ctor_info_array_1_struct {
+	Integer f1;
+	Code * f2;
+	Code * f3;
+	Code * f4;
+	Code * f5;
+	Word * f6;
+	Word * f7;
+	Word * f8;
+	Word * f9;
+} mercury_data_array__type_ctor_info_array_1 = {
+	(Integer) 1,
+	ENTRY(mercury____Unify___array__array_1_0),
+	ENTRY(mercury____Index___array__array_1_0),
+	ENTRY(mercury____Compare___array__array_1_0),
+	(Word *) &mercury_data_array__type_ctor_layout_array_1_bootstrap,
+	(Word *) &mercury_data_array__type_ctor_functors_array_1_bootstrap,
+	(Word *) &mercury_data_array__type_ctor_layout_array_1_bootstrap,
+	string_const("array", 5),
+	string_const("array", 5)
+};
+
+
+MR_MODULE_STATIC_OR_EXTERN 
+const struct mercury_data_array__type_ctor_layout_array_1_struct {
+	TYPE_LAYOUT_FIELDS
+} mercury_data_array__type_ctor_layout_array_1_bootstrap = {
+	make_typelayout_for_all_tags(TYPE_CTOR_LAYOUT_CONST_TAG, 
+		mkbody(MR_TYPE_CTOR_LAYOUT_ARRAY_VALUE))
+};
+
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_array__type_ctor_functors_array_1_struct {
+	Integer f1;
+} mercury_data_array__type_ctor_functors_array_1_bootstrap = {
+	MR_TYPE_CTOR_FUNCTORS_SPECIAL
+};
+
+Declare_entry(mercury____Unify___std_util__univ_0_0);
+Declare_entry(mercury____Index___std_util__univ_0_0);
+Declare_entry(mercury____Compare___std_util__univ_0_0);
+extern const struct mercury_data_std_util__type_ctor_functors_univ_0_struct
+	mercury_data_std_util__type_ctor_functors_univ_0_bootstrap;
+extern const struct mercury_data_std_util__type_ctor_layout_univ_0_struct
+	mercury_data_std_util__type_ctor_layout_univ_0_bootstrap;
+MR_STATIC_CODE_CONST struct
+mercury_data_std_util__type_ctor_info_univ_0_struct {
+	Integer f1;
+	Code * f2;
+	Code * f3;
+	Code * f4;
+	Word * f5;
+	Word * f6;
+	Word * f7;
+	Word * f8;
+	Word * f9;
+}  mercury_data_std_util__type_ctor_info_univ_0 = {
+	(Integer) 0,
+	ENTRY(mercury____Unify___std_util__univ_0_0),
+	ENTRY(mercury____Index___std_util__univ_0_0),
+	ENTRY(mercury____Compare___std_util__univ_0_0),
+	(Word *) &mercury_data_std_util__type_ctor_layout_univ_0_bootstrap,
+	(Word *) &mercury_data_std_util__type_ctor_functors_univ_0_bootstrap,
+	(Word *) &mercury_data_std_util__type_ctor_layout_univ_0_bootstrap,
+	string_const("std_util", 8),
+	string_const("univ", 4)
+};
+
+
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_std_util__type_ctor_layout_univ_0_struct {
+	TYPE_LAYOUT_FIELDS
+} mercury_data_std_util__type_ctor_layout_univ_0_bootstrap = {
+	make_typelayout_for_all_tags(TYPE_CTOR_LAYOUT_CONST_TAG, 
+		mkbody(MR_TYPE_CTOR_LAYOUT_UNIV_VALUE))
+};
+
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_std_util__type_ctor_functors_univ_0_struct {
+	Integer f1;
+} mercury_data_std_util__type_ctor_functors_univ_0_bootstrap = {
+	MR_TYPE_CTOR_FUNCTORS_UNIV
+};
 


-- 
Tyson.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list