[m-rev.] for review: Uncomment foreign code definition for clock/3.

Paul Bone paul at bone.id.au
Wed May 25 11:58:18 AEST 2016


On Wed, May 25, 2016 at 09:53:01AM +0800, Sebastian Godelet wrote:
> Hello,
> 
> Actually I can answer those questions :)
> 
> > On Wed, 25 May 2016, Paul Bone wrote:
> > 
> > > On Tue, May 24, 2016 at 03:38:33PM +0800, Sebastian Godelet wrote:
> > >> Hello Paul,
> > >>
> > >> > diff --git a/library/time.m b/library/time.m index bf4caad..ea9c569
> > >> > 100644
> > >> > --- a/library/time.m
> > >> > +++ b/library/time.m
> > >> > @@ -264,16 +264,14 @@ time.clock(Result, !IO) :-  "
> > >> >      Ret = (MR_Integer) clock();
> > >> >  ").
> > >> > -/* XXX need to add System.dll to the references list.
> > >> >  :- pragma foreign_proc("C#",
> > >> >      time.c_clock(Ret::out, _IO0::di, _IO::uo),
> > >> >      [will_not_call_mercury, promise_pure, tabled_for_io],  "{
> > >> >      // XXX Ticks is long in .NET!
> > >> > -    Ret = (int) System.Diagnostics.Process.GetCurrentProcess
> > >> > -        .UserProcessorTime.Ticks;
> > >> > +    Ret = (int) System.Diagnostics.Process.GetCurrentProcess().
> > >>
> > >
> > > I'm more concerned about the XXX referring to System.dll.  Is a
> > > references list a .NET thing?  Is adding System.dll a problem?
> 
> A reference list is a property of a .NET assembly, it is used by the type resolver to load the appropriate assembly for a given type,
> This list is generated at compile time. So System.Diagnostics is not included in the mscorlib (.NET standard library), but rather the
> System.dll assembly. Both the mono and .NET compiler are clever enough to resolve framework assemblies automatically. During runtime, the System.dll is resolved from the global assembly cache and for mono using a similar mechanism.
> So we do indeed not have to worry about this. Reference lists are only a thing for non-framework assemblies like mer_std.dll, which are already handled accordingly.
> 

Ah cool, it sounds like Julien's guess is correct that this was about the
old IL backend or maybe even the .NET system before it was released.
(Mercury's old IL backend was initially developed under NDA with a grant
from Microsoft.)

-- 
Paul Bone


More information about the reviews mailing list