From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: Imporved cons representatoin in guile
Date: Fri, 10 Jul 2015 13:20:11 +0200 [thread overview]
Message-ID: <CAGua6m3yb8Z8OeLeHbnEHURE64C3+MJ0Onn03rGZHaMce2hoeg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1653 bytes --]
Hi,
I was complentating the cons cells in guile an was wondering if we could
pack our cons cells better than today. So this is some notes about this.
Currently if x is a cons cell we have the relation
x -> [SCMCAR,SCMCDR]
This is really neat and makes guiles conses quite compact e.g. a vector y
of two elements is
y -> [SCMTAG,SCMV1,SCMV2], where SCMTAG containes the datatype tag and
length of the
vector.
To compress even further we need a way to could use
x ->[SCM/2/SCM/2], witt SCM/2 the same tagging half the size as the normal
SCM with the interpretation that if
SCM/2 is a non emediate then it starts with 00 and is then interpreted as a
signed integer i and the real adress is x + i, e.g. a relative adress
regarding.
We of cause must also add a fat cons cell of the form
x -> [Tag,X,Y] for the case when SCM/2 is not fitting. Currently I can't
see this beeing common. But
if we later makes floating point represented via nan boxing e.g. stored
directly in a 64bit value then
the cons cell will be mostly fat and there would be a speed reduction using
cons cells. On the other hand there has been a considerable speed.
There is a final sematic case that needs to be fixed. if we do a setcar on
a thin cons cell and the cell
then becomes fat, we need to create the following
x -> oldthin -> newfat
e.g. we need to add a pointer type with the meaning of automatically follow
the pointer if we encounter it. then oldthin is also tagging a variant of a
cons cell. It is possible to keep it slim
in the code that all fat cons cells is represented like that.
How would a SCM_CAR be like?
SCM SCM_CAR(SCM x)
if(THIN(x))
{
}
[-- Attachment #2: Type: text/html, Size: 2179 bytes --]
next reply other threads:[~2015-07-10 11:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 11:20 Stefan Israelsson Tampe [this message]
2015-07-10 11:37 ` Imporved cons representatoin in guile Stefan Israelsson Tampe
2015-07-10 17:31 ` Stefan Monnier
2015-07-14 13:18 ` Stefan Israelsson Tampe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGua6m3yb8Z8OeLeHbnEHURE64C3+MJ0Onn03rGZHaMce2hoeg@mail.gmail.com \
--to=stefan.itampe@gmail.com \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).