[m-rev.] for review: fix .NET commit handling
Tyson Dowd
trd at cs.mu.OZ.AU
Wed Jul 11 23:06:23 AEST 2001
On 11-Jul-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 11-Jul-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > compiler/mlds_to_il.m:
> > Fix rval_to_type to correct get the type from var references, and
> > handle box/unbox and cast unops.
>
> Is this change related to the commit stuff?
Yes, it doesn't work without it.
I didn't spend the time to find out exactly why it doesn't work,
but it was a change I wanted to make anyway (ever since the type field
was added to vars).
>
> > Index: compiler/mlds_to_il.m
> > ===================================================================
> > RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
> > retrieving revision 1.42
> > diff -u -r1.42 mlds_to_il.m
> > --- compiler/mlds_to_il.m 2001/07/11 10:24:36 1.42
> > +++ compiler/mlds_to_il.m 2001/07/11 12:21:52
>
> > +rval_to_type(unop(Unop, _), Type) :-
> > + (
> > + Unop = box(_),
> > + Type = mlds__generic_type
> > + ;
> > + Unop = unbox(UnboxType),
> > + Type = UnboxType
> > + ;
> > + Unop = cast(CastType),
> > + Type = CastType
> > + ;
> > + Unop = std_unop(StdUnop),
> > + functor(StdUnop, StdUnopStr, _Arity),
> > + unexpected(this_file, "rval_to_type: unop: " ++ StdUnopStr)
>
> Shouldn't that call "sorry" rather than "unexpected"?
>
> The difference between the two is that "sorry" indicates that the code
> in this module is incomplete, whereas "unexpected" indicates that there
> must be a bug in some earlier stage of the compiler.
>
> > +rval_to_type(binop(_, _, _), _) :-
> > + unexpected(this_file, "rval_to_type: binop").
> > +
> > +rval_to_type(mem_addr(_), _) :-
> > + unexpected(this_file, "rval_to_type: mem_addr").
>
> Likewise here.
>
Hmmm... Perhaps. I think I probably will end up having to implement
these some day, so I will change them to sorry.
> > +rval_to_type(self(_), Type) :-
> > ModuleName = mercury_module_name_to_mlds(unqualified("mercury")),
> > Type = mlds__class_type(qual(ModuleName, "invalid"),
> > 0, mlds__class).
>
> Shouldn't that be
>
> rval_to_type(self(Type), Type).
>
> ?
Yes, sorry I didn't really look at what this case was doing.
>
> Also, you're changing failures here from link-time failures to compile-time
> failures. Does the library still compile with this change?
Yes. And all the benchmarks (except query, which didn't work before
this change) run.
Index: mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.43
diff -u -r1.43 mlds_to_il.m
--- mlds_to_il.m 2001/07/11 12:45:18 1.43
+++ mlds_to_il.m 2001/07/11 13:02:45
@@ -2738,19 +2738,16 @@
;
Unop = std_unop(StdUnop),
functor(StdUnop, StdUnopStr, _Arity),
- unexpected(this_file, "rval_to_type: unop: " ++ StdUnopStr)
+ sorry(this_file, "rval_to_type: unop: " ++ StdUnopStr)
).
rval_to_type(binop(_, _, _), _) :-
- unexpected(this_file, "rval_to_type: binop").
+ sorry(this_file, "rval_to_type: binop").
rval_to_type(mem_addr(_), _) :-
- unexpected(this_file, "rval_to_type: mem_addr").
+ sorry(this_file, "rval_to_type: mem_addr").
-rval_to_type(self(_), Type) :-
- ModuleName = mercury_module_name_to_mlds(unqualified("mercury")),
- Type = mlds__class_type(qual(ModuleName, "invalid"),
- 0, mlds__class).
+rval_to_type(self(Type), Type).
rval_to_type(const(Const), Type) :-
Type = rval_const_to_type(Const).
--
Tyson Dowd #
# Surreal humour isn't everyone's cup of fur.
trd at cs.mu.oz.au #
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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