[m-rev.] diff: fix .mm test case failures

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed May 21 02:18:53 AEST 2003


Fix test case failures in tests/tabling in asm_fast.gc.mm. These were caused
by the fact that my recent change to table_gen.m always stored the call table
tip variable in proc_infos, not just when debugging was enabled; however
we reserved a stack slot for this variable only when debugging was enabled.

compiler/code_gen.m:
	Change the code to avoid relying the call table tip slot in proc_infos
	being set only when debugging is enabled.

compiler/hlds_pred.m:
	Change the documentation of the slot to allow it to be set even if
	debugging is not enabled, since this may come in handy in the future.

Zoltan.

cvs diff: Diffing .
Index: code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.112
diff -u -b -r1.112 code_gen.m
--- code_gen.m	9 May 2003 05:51:49 -0000	1.112
+++ code_gen.m	20 May 2003 09:07:38 -0000
@@ -1075,23 +1075,21 @@
 % the generic data structures before and after the actual code generation,
 % which is delegated to goal-specific predicates.
 
-code_gen__generate_goal(ContextModel, Goal - GoalInfo, Code) -->
+code_gen__generate_goal(ContextModel, Goal - GoalInfo, Code, !CI) :-
 		% Make any changes to liveness before Goal
-	{ goal_is_atomic(Goal) ->
+	( goal_is_atomic(Goal) ->
 		IsAtomic = yes
 	;
 		IsAtomic = no
-	},
-	code_info__pre_goal_update(GoalInfo, IsAtomic),
-	code_info__get_instmap(Instmap),
-	(
-		{ instmap__is_reachable(Instmap) }
-	->
-		{ goal_info_get_code_model(GoalInfo, CodeModel) },
+	),
+	code_info__pre_goal_update(GoalInfo, IsAtomic, !CI),
+	code_info__get_instmap(Instmap, !CI),
+	( instmap__is_reachable(Instmap) ->
+		goal_info_get_code_model(GoalInfo, CodeModel),
 
 			% sanity check: code of some code models
 			% should occur only in limited contexts
-		{
+		(
 			CodeModel = model_det
 		;
 			CodeModel = model_semi,
@@ -1107,9 +1105,10 @@
 			;
 				error("nondet model in det/semidet context")
 			)
-		},
+		),
 
-		code_gen__generate_goal_2(Goal, GoalInfo, CodeModel, GoalCode),
+		code_gen__generate_goal_2(Goal, GoalInfo, CodeModel, GoalCode,
+			!CI),
 
 			% If the predicate's evaluation method is memo,
 			% loopcheck or minimal model, the goal generated
@@ -1119,29 +1118,31 @@
 			% retries across this procedure to reset the call table
 			% entry to uninitialized, effectively removing the
 			% call table entry.
+			%
+			% If tracing is not enabled, then CallTableVar isn't
+			% guaranteed to have a stack slot.
 		(
-			{ goal_info_get_features(GoalInfo, Features) },
-			{ set__member(call_table_gen, Features) },
-			code_info__get_proc_info(ProcInfo),
-			{ proc_info_get_call_table_tip(ProcInfo,
-				MaybeCallTableVar) },
-				% MaybeCallTableVar will be `no' unless
-				% tracing is enabled.
-			{ MaybeCallTableVar = yes(CallTableVar) }
+			goal_info_get_features(GoalInfo, Features),
+			set__member(call_table_gen, Features),
+			code_info__get_proc_info(ProcInfo, !CI),
+			proc_info_get_call_table_tip(ProcInfo,
+				MaybeCallTableVar),
+			MaybeCallTableVar = yes(CallTableVar),
+			code_info__get_maybe_trace_info(yes(_), !CI)
 		->
 			code_info__save_variables_on_stack([CallTableVar],
-				SaveCode),
-			{ Code = tree(GoalCode, SaveCode) }
+				SaveCode, !CI),
+			Code = tree(GoalCode, SaveCode)
 		;
-			{ Code = GoalCode }
+			Code = GoalCode
 		),
 
 			% Make live any variables which subsequent goals
 			% will expect to be live, but were not generated
-		code_info__set_instmap(Instmap),
-		code_info__post_goal_update(GoalInfo)
+		code_info__set_instmap(Instmap, !CI),
+		code_info__post_goal_update(GoalInfo, !CI)
 	;
-		{ Code = empty }
+		Code = empty
 	).
 
 %---------------------------------------------------------------------------%
Index: hlds_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.124
diff -u -b -r1.124 hlds_pred.m
--- hlds_pred.m	19 May 2003 14:24:24 -0000	1.124
+++ hlds_pred.m	20 May 2003 09:48:21 -0000
@@ -2101,9 +2101,8 @@
 					% the live_vars pass; it is invalid
 					% before then.
  			call_table_tip	:: maybe(prog_var),
-					% If the tracing is enabled and the
- 					% procedure's evaluation method is
- 					% memo, loopcheck or minimal, this
+					% If the procedure's evaluation method
+					% is memo, loopcheck or minimal, this
  					% slot identifies the variable that
  					% holds the tip of the call table.
  					% Otherwise, this field will be set to
@@ -2126,7 +2125,7 @@
 					% variable, the code generator of the
 					% relevant backend must record this
 					% fact in a place accessible to the
-					% debugger.
+					% debugger, if debugging is enabled.
  			maybe_table_info :: maybe(proc_table_info),
 					% If set, it means that procedure
 					% has been subject to a tabling
cvs diff: Diffing notes
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list