[m-rev.] for review: make I/O tabling respect pragma no_inline

Julien Fischer juliensf at cs.mu.OZ.AU
Wed Sep 14 02:31:00 AEST 2005


On Wed, 14 Sep 2005, Ian MacLarty wrote:

> For review by anyone.
>
> Please note that I use the original goal_info for the new call goal.  I
> looked through the goal_info and there didn't seem to be anything that would
> need to be changed, but I may have missed something.
>
> Estimated hours taken: 3
> Branches: main and 0.12
>
> Make the I/O tabling transformation respect :- pragma no_inline directives
> by creating a copy of the predicate to be transformed and calling the
> copy, instead of duplicating the body, if :- pragma no_inline is
> given.
>
> compiler/hlds_pred.m:
> 	Add a new functor to the pred_creation type to indicate that a pred
> 	was created by the I/O tabling transformation.
>
> 	Fix some formatting.
>
> compiler/table_gen.m:
> 	If the predicate to be I/O tabled should not be inlined, then

I suggest:

	If the predicate to be I/O tabled has a no_inline pragma
	attached to it ... etc

> 	create a copy of the predicate and call the new predicate in the
> 	transformed version.
>
> tests/debugger/Mercury.options:
> tests/debugger/Mmakefile:
> tests/debugger/io_tab_goto.data:
> tests/debugger/io_tab_goto.exp:
> tests/debugger/io_tab_goto.inp:
> tests/debugger/io_tab_goto.m:
> 	Test that foreign C code with labels is I/O tabled correctly.
>

I suggest also updating the user guide extion on I/O tabling to warn about
C code that contains labels.

> Index: compiler/table_gen.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
> retrieving revision 1.91
> diff -u -r1.91 table_gen.m
> --- compiler/table_gen.m	12 Sep 2005 08:41:57 -0000	1.91
> +++ compiler/table_gen.m	13 Sep 2005 09:06:16 -0000
> @@ -1175,9 +1175,30 @@
>          OrigInputVars, OrigOutputVars, !VarTypes, !VarSet,
>          !TableInfo, Goal, MaybeProcTableInfo) :-
>      OrigGoal = _ - OrigGoalInfo,
> +    ModuleInfo0 = !.TableInfo ^ table_module_info,
> +    module_info_pred_info(ModuleInfo0, PredId, PredInfo),
> +    pred_info_get_markers(PredInfo, Markers),
> +    ( check_marker(Markers, user_marked_no_inline) ->
> +        %
> +        % If the predicate should not be inlined, then we create a new
> +        % predicate with the same body as the original predicate, which is
> +        % called where-ever the original goal would appear in the transformed
s/where-ever/wherever/

> +        % code.  This is necessary when the original goal is foreign C code
> +        % which uses labels.  The original goal would otherwise be duplicated

s/which/that

> +        % by the transformation, resulting in duplicate label errors from
> +        % the C compiler.
> +        %
> +        clone_proc_and_create_call(PredInfo, ProcId, CallExpr, ModuleInfo0,
> +            ModuleInfo),
> +        NewGoal = CallExpr - OrigGoalInfo,
> +        !:TableInfo = !.TableInfo ^ table_module_info := ModuleInfo
> +    ;
> +        NewGoal = OrigGoal,
> +        ModuleInfo = ModuleInfo0
> +    ),

That looks fine otherwise.

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