chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] on the usage of the unsafe operations ##sys##slot an


From: Peter Bex
Subject: Re: [Chicken-users] on the usage of the unsafe operations ##sys##slot and similar
Date: Sun, 12 May 2019 11:17:04 +0200
User-agent: NeoMutt/20170113 (1.7.2)

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

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]