[m-dev.] for review: don't use c_pointers as map keys in io.m

Tyson Dowd trd at cs.mu.OZ.AU
Wed Nov 1 13:17:53 AEDT 2000


On 01-Nov-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 01-Nov-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > +:- pragma c_code(io__get_stream_id(Stream::in) = (Id::out), 
> > +		will_not_call_mercury, "
> > +	/* 
> > +	** Most of the time, we can just use the pointer to the stream
> > +	** as a unique identifier.
> > +	*/
> > +	
> > +	Id = (MR_Word) Stream;
> > +
> > +#ifdef NATIVE_GC
> > +	/* 
> > +	** XXX for accurate GC we should embed an ID in the MercuryFile
> > +	** and retrieve it here.
> > +	*/
> > +	MR_fatal_error(""not implemented -- stream ids in native GC grades"");
> > +#endif
> 
> That change looks OK, but you realize that it will completely break
> the .agc grades?  That code is called before main/2, so any program
> compiled with accurate gc enabled will get that MR_fatal_error().
> Previously things were broken, of course, but the symptom was not
> as bad: it would just return "<stream name unknown>" or the wrong
> stream name rather than the correct stream name.  Most programs
> don't use that functionality, so for them it wouldn't matter.

I thought there was a good chance of that, but I forgot that it was
called before main.  But that's fine, I'll fix it separately -- it's
easy enough to fix, it's just I'd like to be able to test the fix. 
The fatal error will remind me of this much better than any to-do list.

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