At Mon, 14 Sep 2015 10:51:14 -0300, Gustavo Massaccesi wrote:
> [I should take a week to read this more carefully, but I'll ask now anyway 
> ...]
> 
> Can you explain (again) the difference between aclock and sclock?

The `aclock` counter is meant to advance when a primitive observably
allocates memory. "Observably" is meant to rule out things like `+` on
bignums, where the operation allocates, but you have no guarantees
about the allocatio or the `eq?`ness of results. In contrast, calling
`box` is an observable allocation.

The `sclock` counter is much more subtle, and it's related to space
safety. The `sclock` counter increments for an expression that could
detect whether memory is retained (asymptotically). For example,
calling an unknown function is usually in this category, because that
call might reach itself any number of times, and thus expose
(asymptotically) memory consumption that precedes each call.

So, they're both about allocation, but about different sides (allocator
versus observer) and different kinds of observations.

> Does `box` increases aclock but don't increase sclock?

Yes.

> Does `set-box!` increase both? 

I think `set-box!` shouldn't increase either, assuming simple
arguments. The `set-box!` function itself doesn't allocate, and with
sufficiently simple arguments, you can't tell whether a GC happens
just before or just after it.

> Is it possible to increase sclock without increasing
> aclock?

Not in principle, but the `aclock` counter of the optimizer is set up
as an extension of `vclock`. That is, `aclock` doesn't need to advance
if `vclock` already advances, while `sclock` shouldn't advance with
`vclock` advancing.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/20150915182058.850166501DE%40mail-svr1.cs.utah.edu.
For more options, visit https://groups.google.com/d/optout.

Reply via email to