karamel icon indicating copy to clipboard operation
karamel copied to clipboard

[Easy] Enforce alignment of buffer allocation

Open msprotz opened this issue 8 years ago • 2 comments

  • [x] align the stack pointer
  • [ ] align the start of data sections
  • [ ] align strings within data sections
  • [x] align buffer allocation at run-time

msprotz avatar Feb 09 '17 01:02 msprotz

We should generate for all arrays/buffers etc: attribute ((aligned (16))) b

For all records/structs, we should generate "force_inline" functions by default, e.g.: static force_inline inline uint64_t *Hacl_Impl_Poly1305_64___proj__MkState__item__r(Hacl_Impl_Poly1305_64_poly1305_state projectee) { Hacl_Impl_Poly1305_64_poly1305_state scrut = projectee; uint64_t *r = scrut.x00; uint64_t *h = scrut.x01; return r; }

static force_inline inline uint64_t *Hacl_Impl_Poly1305_64___proj__MkState__item__h(Hacl_Impl_Poly1305_64_poly1305_state projectee) { Hacl_Impl_Poly1305_64_poly1305_state scrut = projectee; uint64_t *r = scrut.x00; uint64_t *h = scrut.x01; return h; }

prosecco avatar Feb 11 '17 18:02 prosecco

Yes; for wasm I'd have to perform the alignment of allocation by hand (and the inlining by hand too).

msprotz avatar Feb 11 '17 19:02 msprotz