9front - general discussion about 9front
 help / color / mirror / Atom feed
From: McKay Marston <mckay.marston@greymanlabs.com>
To: 9front@9front.org
Subject: Re: [9front] Bounty: OCaml 4.11.1
Date: Fri, 20 Nov 2020 23:24:01 -0700	[thread overview]
Message-ID: <CA7612A6-0E6F-47D0-9AA4-4561198A584C@greymanlabs.com> (raw)
In-Reply-To: <A9AD82BB1B35E0749223E3C07E40B4D2@eigenstate.org>



> On Nov 20, 2020, at 10:46 PM, ori@eigenstate.org wrote:
> 
> Quoth McKay Marston <mckay.marston@greymanlabs.com>:
>> I tried porting it myself, but it relies heavily
>> on aligned memory blocks that are generated in
>> preprocessor macros, and I gave up trying to
>> figure out how that could be done in plan9.
> 
> I don't have the time to do the full port myself,
> but do you have any specific examples of
> the kind of thing that's giving trouble?

Well, specifically this:

runtime/caml/misc.h:
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define CAMLalign(n) _Alignas(n)
#elif defined(SUPPORTS_ALIGNED_ATTRIBUTE)
#define CAMLalign(n) __attribute__((aligned(n)))
#elif _MSC_VER >= 1500
#define CAMLalign(n) __declspec(align(n))
#else
#error "How do I align values on this platform?”   <- this is where it bails on plan9
#endif

which is used by:

runtime/caml/domain_state.h
#define DOMAIN_STATE(type, name) CAMLalign(8) type name;
#define DOMAIN_STATE(type, name) CAMLalign(8) type _##name;

which is used by a bunch of stuff like this:

DOMAIN_STATE(intnat, stat_compactions)
DOMAIN_STATE(intnat, stat_heap_chunks)

And my issue is that the only way that I can see to align memory in plan9 is with mallocalign, which isn’t easily translated (by me, at least) into something that works with the “set an aligned attribute at declaration" method used here.

If I’m missing something, though, I’d appreciate any guidance.

—
zgasma
Mckay Marston



  reply	other threads:[~2020-11-21  6:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-21  5:37 McKay Marston
2020-11-21  5:46 ` [9front] " ori
2020-11-21  6:24   ` McKay Marston [this message]
2020-11-21 19:56     ` Nick Owens
2020-11-21 22:15       ` McKay Marston

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=CA7612A6-0E6F-47D0-9AA4-4561198A584C@greymanlabs.com \
    --to=mckay.marston@greymanlabs.com \
    --cc=9front@9front.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 NNTP newsgroup(s).