[m-dev.] Re: tabled_for_io interacts badly with c code which contains labels

Ian MacLarty maclarty at cs.mu.OZ.AU
Mon Aug 8 22:27:48 AEST 2005


On 8 Aug 2005, at 22:01, Peter Ross wrote:

> $ mmc --version
> Mercury Compiler, version 0.12.0-beta-2005-07-14, configured for 
> i686-pc-cygwin
> Copyright (C) 1993-2005 The University of Melbourne
>
> $ mmc --grade asm_fast.gc.tr.decldebug goto.m
> goto.m: In function `goto_module1':
> goto.m:16: error: duplicate label `label'
> goto.m:16: error: `label' previously defined here
> For more information, try recompiling with `-E'.
> <goto.m>

That's because the I/O tabling transformation would transform a 
predicate p defined as follows:

:- pred p(int, string, io, io).
:- mode p(in, out, di, uo) is det.

p(A, B, S0, S) :-
   <original code>

to the following:

p(A, B, S0, S) :-
   (if
           % Get the global I/O table, the global I/O
           % counter, and the starting point for tabling
           % I/O actions, if we are in the tabled range.
       table_io_in_range(T0, Counter, Start)
   then
           % Look up the input arguments.
       impure table_lookup_insert_start_int(T0, Counter,
           Start, T),
       (if
           semipure table_io_has_occurred(T)
       then
           semipure table_memo_get_answer_block(T, Block),
           impure table_restore_string_answer(Block, 0, B),
           table_io_copy_io_state(S0, S)
       else
           <original code>
               % Save the answers in the table.
           impure table_io_create_answer_block(T, 1, Block),
           impure table_save_string_answer(Block, 0, B)
       )
   else
       <original code>
   ).

Because the original code is duplicated the label is also duplicate, 
resulting in the error message.

Zoltan, could we wrap the original code in a procedure, or change the 
I/O tabling transformation somehow to overcome this problem?

Ian.

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