[gambit-list] Gambit compiler is deterministic right?

Adam adam.mlmb at gmail.com
Fri Mar 15 01:02:19 EDT 2019


Hi Marc,

I meant except for nondeterministic behavior caused by macros, so your
example below is excluded from the definition.

The compiler uses gensym a lot, this would be a primary cause of
nondeterminism wouldn't it, so for instance if thread-safe determinism
would be desired, the Gambit user would need to implement a thread-local
gensym, correct?

(This would exclude thread preemption interrupts and GC as sources of
nondeterminism - thread preemption and GC would only effect |compile-file|
in the way that it could affect the order of gensym calls, right?)

Oh hashtables as a source of |compile-file| nondeterminism, interesting -
what does |compile-file| use hashtables for?

Thanks!!
Adam

On Fri, 15 Mar 2019 at 12:55, Marc Feeley <feeley at iro.umontreal.ca> wrote:

> You’ll have to define what it means for the compiler to be deterministic.
> Do you expect the compilation of the following program to yield the same
> executable every time it is compiled?
>
> (define-macro (stamp)
>   (read-line (open-tcp-client "time-a.timefreq.bldrdoc.gov:37")))
>
> (pp (string-append "hello! " (stamp)))
>
> Macros open a big can of worms…
>
> If you avoid macros the compiler is probably mostly deterministic… but I
> do not have a proof handy!  Hash tables, GC, thread preemption interrupts,
> etc can introduce nondeterminism that may be observable in some situations.
>
> Marc
>


On Tue, 26 Feb 2019 at 09:18, Adam <adam.mlmb at gmail.com> wrote:

> Hi Marc,
>
> Gambit's compiler is deterministic right?
>
> (As in Scheme to GVM, GVM to C or binary. Underlying C compiler's
> determinism is a separate matter altogether.)
>
> A consideration could be that compilation output is a function of |gensym|
> and therefore its counter must be managed for deterministic compilation.
>
> Another consideration that if running more instances of the compiler in
> one Gambit process concurrently, the |gensym| calls could have arbitrary
> order and therefore determinism break.
>
> Adam
>

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20190315/0f44b435/attachment.htm>


More information about the Gambit-list mailing list