Skip to content

Instantly share code, notes, and snippets.

@gkaklas
Created January 10, 2023 15:50
Show Gist options
  • Save gkaklas/d948a428acd8e86ef656821a08a4a785 to your computer and use it in GitHub Desktop.
Save gkaklas/d948a428acd8e86ef656821a08a4a785 to your computer and use it in GitHub Desktop.
Notes.md
Τι έχουμε παρατηρήσει μέχρι τώρα:
* Κάναμε generate LLVM bitcode για να δούμε τι παράγει σε διάφορες περιπτώσεις
* Το return value μιας συνάρτησης γίνεται allocate στον caller και περνάει σαν παράμετρος στον callee
* TODO Box example
* TODO Example of a value that's not used
* Allocators
* By default: `std::alloc::System`
* Platform specific: `malloc` on Unix-like, `HeapAlloc` on Windows
* We can instruct the standard library which allocator to use by placing an attribute: `#[global\_allocator]`
* Implement the trait `std::alloc::GlobalAlloc`
* `alloc()`
* `dealloc()`
* `alloc_zeroed()`
* `realloc()`
* TODO Difference with unstable `std::alloc::Allocator`?
* Υπάρχει υποδομή να χρησιμοποιηθούν εξωτερικοί allocators
* jemalloc TODO
* bumpalo TODO
* The compiler seems to already use *arena allocation* internally
* https://rustc-dev-guide.rust-lang.org/memory.html
* In general: `rustc\_arena` crate
* Specific implementations for some parts of the compiler?
* middle
* hir
* TODO Allows hash consing
* Each arena chunk is simply a Box
* Type decoding:
* https://rustc-dev-guide.rust-lang.org/ty.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment