On Sun, May 12, 2019 at 11:10:51AM +0200, Marco Maggi wrote:
> Ciao,
>
> sorry for peeking under the skirt; I'm trying to get a basic
> understanding of the core usage and memory layout of Scheme values
Hi Marco,
If you're interested in this, perhaps you find this blog post of mine
useful: https://www.more-magic.net/posts/internals-data-representation.html
It explains how values are represented in memory at the low level.
> is it correct that:
>
> * We can use ##sys#setislot to store any immediate value in a Scheme
> vector?
That's correct. It's faster than ##sys#setslot because it doesn't
check if it's an immediate. ##sys#setslot will track mutations to
non-immediate values so that the garbage collector knows that the
object is still being used.
> * We can use the system operations ##sys#slot, ##sys#setslot,
> ##sys#setislot , ##sys#size on every Scheme object whose memory layout
> is similar to the one of Scheme vectors?
Yeah, it can be used on any compound Scheme object. Basically, any
non-immediate that's not a bytevector. On bytevectors, ##sys#size
works too, but it will return the size in bytes rather than the number
of slots in the object.
Cheers,
Peter
signature.asc
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users