• 0 Posts
  • 5 Comments
Joined 2 years ago
cake
Cake day: August 10th, 2023

help-circle

  • 12th verse: I’m sane, I promise

    Hmm…

    As to LLVM and alloca, it doesn’t optimise or even work well in practise. Some basic cases work, others are less well tested. There are lots of “should” that “doesn’t” in practice in LLVM.

    I have not looked at alloca in LLVM myself but from what I have heard from those who are experts on this, it is quite brittle.

    Second of all: sub is my favourite allocator

    https://docs.rs/bumpalo/latest/bumpalo/ (and bump allocators in general).

    Fourth of all: second point is literally a skill issue idk, especially if your compiler is already proving bounds anyway.

    In general proving bounds for stack growth is very difficult. With recursion it is undecidable. This follows directly from Rice’s Theorem. (This is my favourite theorem, it is nice to know that something is impossible rather than a skill issue.)

    (Of course you could have a static analyser that instead of yes/no returns yes/no/don’t know, and then you assign don’t know to be either of the other classes depending on if you care more about false positives or false negatives. This is how the rust borrow checker works: forbid if it can’t prove it is safe, but there will be safe code that it doesn’t allow.)