[m-dev.] diff: Compiler support for stack_layouts

Tyson Dowd trd at cs.mu.oz.au
Wed Dec 10 15:14:41 AEDT 1997


On 09-Dec-1997, Fergus Henderson <fjh at cs.mu.oz.au> wrote:
> On 27-Oct-1997, Tyson Richard DOWD <trd at cs.mu.oz.au> wrote:
>    ^^^^^^^^^^^
> This has been lying around in my "in tray" for a while...
> long enough, in fact, that I can't even recall whether or not I've
> already reviewed it.  But anyway, here goes...


Hi,

Fergus, care to review this?

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


Estimated hours taken: 1

Fix some problems Fergus pointed out after reviewing my
stack layouts change.

compiler/continuation_info.m:
	Separate library imports from compiler imports.

compiler/handle_options.m:
compiler/options.m:
	Add some comments to explain the stack_layouts option.

compiler/code_gen.m:
compiler/llds.m:
compiler/llds_common.m:
compiler/llds_out.m:
compiler/mercury_compile.m:
compiler/optimize.m:
	Remove llds_proc_id from c_procedure, as pred_proc_id is
	available instead. 


Index: compiler/code_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/code_gen.m,v
retrieving revision 1.39
diff -u -r1.39 code_gen.m
--- code_gen.m	1997/11/08 13:11:09	1.39
+++ code_gen.m	1997/12/10 03:39:18
@@ -243,9 +243,7 @@
 	predicate_name(ModuleInfo, PredId, Name),
 	predicate_arity(ModuleInfo, PredId, Arity),
 		% construct a c_procedure structure with all the information
-	proc_id_to_int(ProcId, LldsProcId),
-	Proc = c_procedure(Name, Arity, LldsProcId, proc(PredId, ProcId),
-		Instructions).
+	Proc = c_procedure(Name, Arity, proc(PredId, ProcId), Instructions).
 
 :- pred generate_category_code(code_model, hlds_goal, code_tree, frame_info,
 				code_info, code_info).
Index: compiler/continuation_info.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/continuation_info.m,v
retrieving revision 1.4
diff -u -r1.4 continuation_info.m
--- continuation_info.m	1997/11/08 13:11:11	1.4
+++ continuation_info.m	1997/12/10 03:48:37
@@ -30,7 +30,8 @@
 
 :- interface.
 
-:- import_module list, llds, hlds_pred.
+:- import_module llds, hlds_pred.
+:- import_module list.
 
 	%
 	% Information used by the continuation_info module.
@@ -166,7 +167,7 @@
 
 continuation_info__process_llds([]) --> [].
 continuation_info__process_llds([Proc|Procs]) -->
-	{ Proc = c_procedure(_, _, _, PredProcId, Instrs) },
+	{ Proc = c_procedure(_, _, PredProcId, Instrs) },
 	continuation_info__process_instructions(PredProcId, Instrs),
 	continuation_info__process_llds(Procs).
 
Index: compiler/handle_options.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/handle_options.m,v
retrieving revision 1.36
diff -u -r1.36 handle_options.m
--- handle_options.m	1997/12/05 15:47:15	1.36
+++ handle_options.m	1997/12/10 02:31:52
@@ -559,6 +559,7 @@
 	( 
 		{ GC = accurate }, 
 		set_string_opt(gc, "accurate"), 
+			% we need stack layouts for accurate gc
 		set_bool_opt(stack_layout, yes) 
 	; 
 		{ GC = conservative },
Index: compiler/llds.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds.m,v
retrieving revision 1.213
diff -u -r1.213 llds.m
--- llds.m	1997/12/05 15:47:24	1.213
+++ llds.m	1997/12/10 03:38:53
@@ -74,7 +74,6 @@
 	--->	c_procedure(
 			string,			% predicate name
 			int,			% arity
-			llds_proc_id,		% mode number
 			pred_proc_id,		% the pred_proc_id this code
 			list(instruction)	% the code for this procedure
 		).
Index: compiler/llds_common.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds_common.m,v
retrieving revision 1.12
diff -u -r1.12 llds_common.m
--- llds_common.m	1997/12/05 15:47:26	1.12
+++ llds_common.m	1997/12/10 03:49:08
@@ -138,9 +138,9 @@
 :- mode llds_common__process_proc(in, in, out, out) is det.
 
 llds_common__process_proc(Proc0, Info0, Info, Proc) :-
-	Proc0 = c_procedure(Name, Arity, Mode, PredProcId, Instrs0),
+	Proc0 = c_procedure(Name, Arity, PredProcId, Instrs0),
 	llds_common__process_instrs(Instrs0, Info0, Info, Instrs),
-	Proc = c_procedure(Name, Arity, Mode, PredProcId, Instrs).
+	Proc = c_procedure(Name, Arity, PredProcId, Instrs).
 
 :- pred llds_common__process_instrs(list(instruction),
 	common_info, common_info, list(instruction)).
Index: compiler/llds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds_out.m,v
retrieving revision 1.64
diff -u -r1.64 llds_out.m
--- llds_out.m	1997/12/05 15:47:28	1.64
+++ llds_out.m	1997/12/10 03:56:31
@@ -610,7 +610,7 @@
 :- mode output_c_procedure_decls(in, in, out, di, uo) is det.
 
 output_c_procedure_decls(Proc, DeclSet0, DeclSet) -->
-	{ Proc = c_procedure(_Name, _Arity, _ModeNum0, _PredProcId, Instrs) },
+	{ Proc = c_procedure(_Name, _Arity, _PredProcId, Instrs) },
 	output_instruction_list_decls(Instrs, DeclSet0, DeclSet).
 
 :- pred output_c_procedure(c_procedure, bool, bool,
@@ -618,7 +618,8 @@
 :- mode output_c_procedure(in, in, in, di, uo) is det.
 
 output_c_procedure(Proc, PrintComments, EmitCLoops) -->
-	{ Proc = c_procedure(Name, Arity, ModeNum0, _PredProcId, Instrs) },
+	{ Proc = c_procedure(Name, Arity, proc(_PredId, ProcId), Instrs) },
+	{ proc_id_to_int(ProcId, ModeNum0) },
 	( { PrintComments = yes } ->
 		io__write_string("\n/*-------------------------------------"),
 		io__write_string("------------------------------------*/\n")
@@ -3075,7 +3076,7 @@
 :- mode gather_labels_from_c_procs(in, in, out) is det.
 
 gather_labels_from_c_procs([], Labels, Labels).
-gather_labels_from_c_procs([c_procedure(_, _, _, _, Instrs) | Procs],
+gather_labels_from_c_procs([c_procedure(_, _, _, Instrs) | Procs],
 		Labels0, Labels) :-
 	gather_labels_from_instrs(Instrs, Labels0, Labels1),
 	gather_labels_from_c_procs(Procs, Labels1, Labels).
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_compile.m,v
retrieving revision 1.64
diff -u -r1.64 mercury_compile.m
--- mercury_compile.m	1997/12/10 02:35:18	1.64
+++ mercury_compile.m	1997/12/10 04:05:33
@@ -907,7 +907,7 @@
 	),
 	{ globals__lookup_bool_option(Globals, stack_layout, StackLayout) },
 	( { StackLayout = yes } ->
-		{ Proc = c_procedure(_, _, _, PredProcId, Instructions) },
+		{ Proc = c_procedure(_, _, PredProcId, Instructions) },
 		{ module_info_get_continuation_info(ModuleInfo5, ContInfo2) },
 		write_proc_progress_message(
 			"% Generating stack layout information for ",
Index: compiler/optimize.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/optimize.m,v
retrieving revision 1.9
diff -u -r1.9 optimize.m
--- optimize.m	1997/11/08 13:11:40	1.9
+++ optimize.m	1997/12/10 03:51:12
@@ -38,8 +38,8 @@
 	optimize__proc(Proc0, Proc), !,
 	optimize__main(Procs0, Procs).
 
-optimize__proc(c_procedure(Name, Arity, Mode, PredProcId, Instrs0),
-		   c_procedure(Name, Arity, Mode, PredProcId, Instrs)) -->
+optimize__proc(c_procedure(Name, Arity, PredProcId, Instrs0),
+		   c_procedure(Name, Arity, PredProcId, Instrs)) -->
 	globals__io_lookup_bool_option(debug_opt, DebugOpt),
 	opt_debug__msg(DebugOpt, "before optimization"),
 	opt_debug__dump_instrs(DebugOpt, Instrs0),
Index: compiler/options.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/options.m,v
retrieving revision 1.212
diff -u -r1.212 options.m
--- options.m	1997/12/05 15:47:46	1.212
+++ options.m	1997/12/10 02:47:55
@@ -137,6 +137,10 @@
 		;	args
 		;	type_info
 		;	type_layout
+				% XXX stack_layout is a development only 
+				% option. It will eventually be replaced
+				% by new options handling different
+				% sorts of stack_layouts.
 		;	stack_layout
 		;	highlevel_c
 		;	unboxed_float


-- 
       Tyson Dowd           # 
                            #         Linux versus Windows is a 
     trd at cs.mu.oz.au        #            Win lose situation.
http://www.cs.mu.oz.au/~trd #



More information about the developers mailing list