[m-rev.] for review: don't allow inlining of builtins when tracing enabled

Julien Fischer juliensf at cs.mu.OZ.AU
Fri Feb 18 18:41:49 AEDT 2005


On Fri, 18 Feb 2005, Ian MacLarty wrote:

> This bug was causing some tests in debugger/declarative to fail because the
> expected events for int.+ were not being generated.
>
> I suspected the calls to int.+ were being inlined, so I gave the --no-inlining
> flag and then the events for int.+ were generated.
>
> Once I had a passing and failing test case I created a dice and looked for
> the first predicate that was called in both cases, but through which a
> different execution path was taken.  This took me directly to
> builtin_state where the bug was :-)
>
Great!  How long until we get the `fix_my_bug' command in the debugger?

> I'll try and get the dice command to find such labels automatically some time
> in the future.
>
> Estimated hours taken: 2
> Branches: main
>
> Fix a bug where builtin inlining was being done when a module was compiled
> with tracing and the --trace-optimize option wasn't given.
>
> compiler/hlds_pred.m
> 	Check that inlining is allowed when deciding whether to do inlining of
> 	builtins.
>
> Index: compiler/hlds_pred.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/hlds_pred.m,v
> retrieving revision 1.156
> diff -u -r1.156 hlds_pred.m
> --- compiler/hlds_pred.m	2 Feb 2005 02:58:41 -0000	1.156
> +++ compiler/hlds_pred.m	17 Feb 2005 07:47:06 -0000
> @@ -2913,13 +2913,16 @@
>  	PredName = pred_info_name(PredInfo),
>  	Arity = pred_info_orig_arity(PredInfo),
>  	module_info_globals(ModuleInfo, Globals),
> +	globals__lookup_bool_option(Globals, allow_inlining, AllowInlining),
>  	globals__lookup_bool_option(Globals, inline_builtins, InlineBuiltins),
>  	(
>  		% The automatically generated "recursive" call in the
>  		% goal for each builtin must be generated inline, or
>  		% we would generate an infinite loop.
> -		( InlineBuiltins = yes
> -		; CallerPredId = PredId
> +		(
> +			AllowInlining = yes, InlineBuiltins = yes
> +		;
> +			CallerPredId = PredId
>  		),
>  		is_inline_builtin(ModuleName, PredName, ProcId, Arity)
>  	->

That looks fine.

Julien.
--------------------------------------------------------------------------
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