[m-rev.] for review: thread safe mutables (part 2)

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Aug 30 14:20:24 AEST 2006


On Wed, 30 Aug 2006, Peter Wang wrote:

> On 2006-08-29, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>> Fix intermodule inlining so that the clauses for the mutable access
>> predicates
>> are written to .opt files even though they contain calls to impure
>> predicates.
>> This is usually not allowed because of problems caused be reordering what
>> were
>
> by reordering
>

Fixed.

>> @@ -1802,6 +1815,7 @@
>>  should_output_marker(marker_calls_are_fully_qualified, no).
>>  should_output_marker(marker_mode_check_clauses, yes).
>>  should_output_marker(marker_may_have_parallel_conj, no).
>> +should_output_marker(marker_mutable_access_pred, no).   % XXX should be
>> yes.
>
> What happens if you output it?
>

At the moment it will be a syntax error in the .opt file.  I put that there
while I was updating the compiler to support the new attribute.  At the time I
wasn't sure whether we might need to add special support for intermodule
inlining of mutable access preds.  At the moment it should definitely be `no'.
(In the future we may want to tell importing modules that these predicates are
mutable access preds and that optimizations might want to treat them in a
special way.)

>> @@ -341,13 +341,37 @@
>>      module_add_mode_defn(VarSet, Name, Params, ModeDefn,
>>          Cond, Context, !.Status, !ModuleInfo, InvalidMode, !IO).
>>  add_item_decl_pass_1(Item, Context, !Status, !ModuleInfo, no, !IO) :-
>> -    Item = item_pred_or_func(TypeVarSet, InstVarSet, ExistQVars,
>> PredOrFunc,
>> -        PredName, TypesAndModes, _WithType, _WithInst, MaybeDet, _Cond,
>> -        Purity, ClassContext),
>> -    init_markers(Markers),
>> -    module_add_pred_or_func(TypeVarSet, InstVarSet, ExistQVars, PredOrFunc,
>> -        PredName, TypesAndModes, MaybeDet, Purity, ClassContext, Markers,
>> -        Context, !.Status, _, !ModuleInfo, !IO).
>> +    Item = item_pred_or_func(Origin, TypeVarSet, InstVarSet, ExistQVars,
>> +        PredOrFunc, PredName, TypesAndModes, _WithType, _WithInst,
>> MaybeDet,
>> +        _Cond, Purity, ClassContext),
>> +    init_markers(Markers0),
>> +    %
>> +    % If this predicate was added as a result of the mutable transformation
>> +    % then mark this predicate ad a mutable access pred.  We do this
>
> as a
>
>> @@ -694,6 +735,22 @@
>>                  ReportErrors = yes,
>>                  get_global_name_from_foreign_names(ReportErrors, Context,
>>                      ModuleName, Name, ForeignNames, _TargetMutableName,
>>                      !IO)
>> +            ),
>> +            %
>> +            % If we are creating the I/O version of the set predicate then
>> we
>> +            % need to add a promise_pure pragma for it.  This needs to be
>> done
>> +            % here (in stage 2) rather than in stage 3 where the rest of
>> the
>> +            % mutable transformation is.
>> +            %
>
> Add a reason?
>

We do it as a result of the way make_hlds_passes is structured.  The necessary
data for adding pragmas is not threaded through stage 3 (or at least the part
of stage 3 that handles mutables.)  The documentation for each stage makes
this fairly clear.

>>  %
>>  % For constant mutables the transformation is:
>>  %
>> @@ -160,6 +173,13 @@
>>
>>  %-----------------------------------------------------------------------------%
>>
>> +    % Create premode declarations for the four primitive operations.
>
> predmode

Fixed.

Thanks for that.

Julien.

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list