[m-dev.] for review: redo events in shallow traced procedures

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Tue Aug 24 16:50:23 AEST 1999


Zoltan Somogyi writes:
> 
> 
> Shallow traced procedures do not fill in most of their stack slots holding
> debugging information unless they are called from deep traced code, yet the
> code in the runtime that handles redo events for such procedures was using
> the values in those slots. This changes fixes that problem, by adding another
> piece of code in the runtime for handling redo events for shallow traced
> procedures.
> 

> Index: compiler/trace.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/trace.m,v
> retrieving revision 1.21
> diff -u -b -r1.21 trace.m
> --- trace.m	1999/08/16 05:48:12	1.21
> +++ trace.m	1999/08/23 05:27:57

> @@ -544,13 +553,28 @@
>  	}.
>  
>  trace__maybe_setup_redo_event(TraceInfo, Code) :-
> -	TraceInfo = trace_info(_, _, _, TraceRedo),
> +	TraceInfo = trace_info(TraceType, _, _, TraceRedo),
>  	( TraceRedo = yes(_) ->
> +		(
> +			TraceType = shallow_trace(Lval),
> +			% The code in the runtime looks for the from-full
> +			% flag in framevar 5; see the comment before
> +			% trace__reserved_slots.
> +			require(unify(Lval, framevar(5)),
> +				"from-full flag not stored in expected slot"),
>  		Code = node([
>  			mkframe(temp_frame(nondet_stack_proc),
> -				do_trace_redo_fail)
> +					do_trace_redo_fail_shallow)
> +					- "set up shallow redo event"
> +			])
> +		;
> +			TraceType = deep_trace,
> +			Code = node([
> +				mkframe(temp_frame(nondet_stack_proc),
> +					do_trace_redo_fail_deep)
>  				- "set up deep redo event"
>  		])
> +		)
>  	;
>  		Code = empty
>  	).

Is this indented correctly?  It looks like the last four unchanged lines
need to be indented one level further.


> Index: runtime/mercury_stack_layout.h
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
> retrieving revision 1.26
> diff -u -b -r1.26 mercury_stack_layout.h
> --- mercury_stack_layout.h	1999/08/24 01:35:47	1.26
> +++ mercury_stack_layout.h	1999/08/24 01:47:37
> @@ -471,18 +471,20 @@
>  
>  /*
>  ** In model_non procedures compiled with an execution trace options that
> -** require REDO events, one other item is stored in a fixed stack slot.
> +** require REDO events, one or two other items are stored in fixed stack slots.
>  ** This is
>  **
>  **	the address of the layout structure for the redo event
> +**	the saved copy of the from-full flag (only if trace level is shallow)
>  **
> -** The following macro will access it. This macro should be used only from
> +** The following macros will access these slots. They should be used only from
>  ** within the code that calls MR_trace for the REDO event.
>  **
>  ** This macros have to be kept in sync with compiler/trace.m.
>  */
>  

There are a couple of grammatical errors in this comment.  I realise
that they were not introduced by your change, but it would be good
to fix them up anyway.

Other than that, the change is fine.

Cheers,
Mark
-- 
Mark Brown, PhD student            )O+  |  "Another of Fortran's breakthroughs
(m.brown at cs.mu.oz.au)                   |  was the GOTO statement, which was...
Dept. of Computer Science and Software  |  uniquely simple and understandable"
Engineering, University of Melbourne    |              -- IEEE, 1994
--------------------------------------------------------------------------
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