[m-rev.] for review: mutables and intermodule-optimization (again)

Julien Fischer juliensf at cs.mu.OZ.AU
Wed Sep 28 14:18:57 AEST 2005


On Wed, 28 Sep 2005, Ralph Becket wrote:

> >          %
> >          % XXX We don't currently support languages other than C.
> >          %
> > +        module_info_name(!.ModuleInfo, ModuleName),
> >          ForeignDecl = pragma(compiler(mutable_decl),
> > -            foreign_decl(c, foreign_decl_is_local,
> > -                "MR_Word " ++ mutable_c_var_name(Name) ++ ";")),
> > -        add_item_decl_pass_2(ForeignDecl, Context, !Status, !ModuleInfo, !IO)
> > +            foreign_decl(c, foreign_decl_is_exported,
> > +                "extern MR_Word " ++
> > +                    TargetMutableName ++ ";")),
>
> You could join these two lines into one.
>
> > +        add_item_decl_pass_2(ForeignDecl, Context, !Status, !ModuleInfo, !IO),
> > +        ForeignCode = pragma(compiler(mutable_decl),
> > +            foreign_code(c, "MR_Word " ++
> > +                TargetMutableName ++ ";")),
>
> And here.
>
Done.


> > @@ -906,28 +991,56 @@
> >                  [InitTerm], (impure)) - Context),
> >          add_item_clause(InitClause, !Status, Context, !ModuleInfo, !QualInfo,
> >              !IO),
> > +        mutable_var_maybe_foreign_names(MutAttrs) = MaybeForeignNames,
> > +        (
> > +            MaybeForeignNames = no,
> > +            TargetMutableName = mutable_c_var_name(ModuleName, Name)
> > +        ;
> > +            MaybeForeignNames = yes(ForeignNames),
> > +            ReportErrors = no,    % We've already reported them during pass 2.
>
> Why make the mutable_foreign_names field a maybe(list) rather than just
> a list with [] meaning "use the default"?
>
As Zoltan mentioned, for software engineering reasons.

>
> > -            TrailCode =
> > -                "MR_trail_current_value(&" ++
> > -                mutable_c_var_name(Name) ++
> > -                ");\n"
> > +            TrailMutableUpdates = trailed,
> > +            %
> > +            % If we require that the mutable to be trailed then
> > +            % we ened to be compiling in a trailing grade.
>
> s/ened/need/
>
Done.

Thanks for that.

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