From: "Ludovic Courtès" <ludo@gnu.org>
To: Mark H Weaver <mhw@netris.org>
Cc: Andy Wingo <wingo@igalia.com>, guile-devel <guile-devel@gnu.org>
Subject: Re: Immediate doubles (up to 2^256) and rationals coming to Guile 3
Date: Tue, 11 Jun 2019 10:39:38 +0200 [thread overview]
Message-ID: <87d0jk5xdh.fsf@gnu.org> (raw)
In-Reply-To: <87a7eqae8d.fsf@netris.org> (Mark H. Weaver's message of "Sun, 09 Jun 2019 12:56:55 -0400")
Hello,
Mark H Weaver <mhw@netris.org> skribis:
> Ludovic Courtès <ludo@gnu.org> writes:
[...]
>> IIUC, your plan is to have a different tagging on 32-bit platforms,
>> without fixflos, right? I’m curious to see how much complexity would
>> entail from that.
>
> Yes, although I'm avoiding the term "fixflos" because IEEE doubles are
> also fixed width, and thus the term "fixflos" wouldn't adequately
> distinguish them from IEEE doubles.
Right!
> Anyway, I agree that it's inconvenient to have different tags on
> different targets, and I've been working to minimize the differences.
>
> At present, I'm currently implementing an alternative strategy where
> pairs are tagged in their pointers instead of in their CARs, which
> enables us to separate the heap tags and immediate tags into two
> independent spaces.
At first this sounds rather radical :-), but maybe it’s preferable this
way.
> In this new approach, the heap tags are left unchanged, and the only
> tags that vary with target word size are the fixints, fixrats, iflos,
> and pair pointers. All other tags will be uniform across targets,
> including the non-number immediates. Here's the new version:
>
> ;; /* with iflos: xxx: iflo (000 < xxx < 110)
> ;; (64-bit) 0111: fixrat
> ;; 1111: fixnum
> ;; 0110: pair
> ;; 000: tagged heap object (thob)
> ;; tttt1110: other immediate
> ;;
> ;; without iflos: 1: fixnum
> ;; (32-bit) 010: fixrat
> ;; 100: pair
> ;; 000: tagged heap object (thob)
> ;; tttt1110: other immediate
>
> This new approach brings its own complications, mainly two:
>
> (1) It breaks the long-standing assumptions in Guile that all
> non-immediates have a tag in their first word and that pointers are
> always untagged. In my preliminary patch, I introduce a new concept
> called a "tagged heap object" or "thob", and most existing checks
> for SCM_NIMP or !SCM_IMP must be changed to use SCM_THOB_P.
Though an immediate, like a fixnum or an iflo, is still something
different from a tagged heap object like a pair, right? So I would
expect SCM_THOB_P to be a different test, not a drop-in replacement for
SCM_NIMP, is that correct?
> (2) Our existing VM instructions almost invariably specify offsets with
> a granularity of whole words. To support tagged pair pointers with
> good performance, I think we need a few new instructions that
> specify byte offsets, to avoid the expensive extra step of removing
> the tag before accessing the CAR or CDR of a pair.
So instead of a pointer dereference, SCM_CAR becomes mask + dereference,
right?
I think we disable GC “interior pointer” scanning. With this scheme, an
SCM for a pair would actually point in the middle of a pair; could this
be an issue for GC?
Thank you!
Ludo’.
next prev parent reply other threads:[~2019-06-11 8:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 9:40 Immediate doubles (up to 2^256) and rationals coming to Guile 3 Mark H Weaver
2019-06-06 12:56 ` Mark H Weaver
2019-06-06 19:37 ` Arne Babenhauserheide
2019-06-12 0:03 ` Mark H Weaver
2019-06-06 20:09 ` tomas
2019-06-07 19:46 ` Ludovic Courtès
2019-06-09 16:56 ` Mark H Weaver
2019-06-09 17:30 ` Mark H Weaver
2019-06-11 8:39 ` Ludovic Courtès [this message]
2019-06-11 10:58 ` Mark H Weaver
2019-06-11 12:21 ` Ludovic Courtès
2019-06-11 11:34 ` Mark H Weaver
2019-06-08 1:13 ` Mark H Weaver
2019-06-08 8:07 ` Arne Babenhauserheide
2019-06-08 9:08 ` Chris Vine
2019-06-08 9:46 ` Arne Babenhauserheide
2019-06-08 10:24 ` Chris Vine
2019-06-08 13:12 ` Hans Åberg
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=87d0jk5xdh.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guile-devel@gnu.org \
--cc=mhw@netris.org \
--cc=wingo@igalia.com \
/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).