From: Damien Doligez <damien.doligez@inria.fr>
To: ygrek <ygrekheretix@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] no_scan_tag and int array
Date: Mon, 29 Mar 2010 17:34:32 +0200 [thread overview]
Message-ID: <46634FDA-8BCD-4B1E-AD9C-819146A4BF56@inria.fr> (raw)
In-Reply-To: <20100306112645.a74bb0c4.ygrekheretix@gmail.com>
Hello,
On 2010-03-06, at 10:26, ygrek wrote:
> So, as expected, setting No_scan_tag on the array of integers prevents GC from uselessly
> scanning the huge chunk of memory. Looks like polymorphic array functions still work fine and
> GC correctly reclaims array memory when it is not referenced anymore.
> Apparantly this trick is not allowed for float array as they have a special tag set.
The trick is not needed for float arrays, the GC already doesn't scan
them.
> The question is - how safe is this?
It's safe, and will be in the forseeable future.
BUT: you should use Abstract_tag and not No_scan_tag. Abstract_tag means
"don't make assumptions about the contents of this block", while
No_scan_tag is just the min of all the tags that the GC is not supposed
to scan. Right now they are equal, but a future version of OCaml might
have No_scan_tag = Double_array_tag, which would break your code.
> And even more, could the compiler itself set this tag?
This is a bit tricky because you have to make sure that the static
type of the array is "int array". Unlike floats, a run-time test
at allocation will not work.
You should enter this as a feature wish in the BTS.
-- Damien
prev parent reply other threads:[~2010-03-29 15:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-06 9:26 ygrek
2010-03-07 0:48 ` [Caml-list] " Goswin von Brederlow
2010-03-07 14:07 ` ygrek
2010-03-29 15:34 ` Damien Doligez [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46634FDA-8BCD-4B1E-AD9C-819146A4BF56@inria.fr \
--to=damien.doligez@inria.fr \
--cc=caml-list@inria.fr \
--cc=ygrekheretix@gmail.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