x86-64-ABI
kaleidoscope
| x86-64-ABI | kaleidoscope | |
|---|---|---|
| 14 | 10 | |
| - | 1,041 | |
| - | 0.0% | |
| - | 0.0 | |
| - | about 6 years ago | |
| Haskell | ||
| - | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
x86-64-ABI
- Addressing the adding situation – Matt Godbolt
-
We found a bug in Go's ARM64 compiler
Ehh I wouldn’t say so (thanks for the correct link for ARM64 though in any case). What you need to be comparing to here is DWARF[1,2] section 6.4, and while it’s not as bad as other parts of DWARF, I still think it’s plenty complicated.
[1] https://dwarfstd.org/doc/DWARF5.pdf#page=171
[2] Slightly modified by psABI[3] section 3.7 for x86-64 or the LSB[4] section 11.6 for ARM64, but at this point that’s a drop in the bucket as far as overall complexity is concerned.
[3] https://gitlab.com/x86-psABIs/x86-64-ABI/-/jobs/artifacts/ma...
[4] https://refspecs.linuxfoundation.org/LSB_4.0.0/LSB-Core-gene...
-
The repercussions of a typo in C++ & Rust
> if an argument fits into the size of a register, it's better to pass by value to avoid the extra indirection.
Whether an argument is passed in a register or not is unfortunately much more nuanced than this: it depends on the ABI calling conventions (which vary depending on OS as well as CPU architecture). There are some examples where the argument will not be passed in a register despite being "small enough", and some examples where the argument may be split across two or more registers.
For instance, in the x86-64 ELF ABI spec [0], the type needs to be <= 16 bytes (despite registers only being 8 bytes), and it must not have any nontrivial copy / move constructors. And, of course, only some registers are used in this way, and if those are used up, your value params will be passed on the stack regardless.
[0] Section 3.2.3 of https://gitlab.com/x86-psABIs/x86-64-ABI
- Evolution of the ELF object file format
-
Linux/ELF .eh_frame from the bottom up
Linux uses the sysv calling convention. I believe these are the official or semi-official documents for x86 64-bit and 32-bit, respectively:
https://gitlab.com/x86-psABIs/x86-64-ABI (Table 3.4 in section 3.2.3 lists which registers may be clobbered and which must be saved)
-
Book recommendations.
System V Application Binary Interface AMD64 Architecture Processor Supplement
-
Six Great Features with the Upcoming Linux 6.6 Kernel
ABI is just the name for any stable binary interface between parts of a program, eg in C there is a well-defined ABI for calling functions: https://gitlab.com/x86-psABIs/x86-64-ABI/-/jobs/artifacts/ma... https://www.agner.org/optimize/calling_conventions.pdf
If you combine that with a stable set of C function names and parameters, then you could define an ABI for kernel modules if you (and the Linux developers) wanted. While it sounds like a good idea, the outcome probably wouldn't be great for users.
-
Does C++ have a stable ABI or not?
But in the same breath, that paragraph's footnote points directly to the Itanium C++ ABI specification which seems to do precisely what they said has never been done. (I've filed a bug...).
-
What x64 ABI does linux / GCC ACTUALLY use?
The supposed latest psABI specs (https://gitlab.com/x86-psABIs/x86-64-ABI) contain the following, with regards to classifying aggregates for argument passing (section 3.2.3, page 24, of the AMD64 ABI 1.0 – December 6, 2022 specs):
-
Change default CPU type?
RHEL, from version 9, requires x86-64 v2. The levels are a common effort between several companies, AMD included. The definitions can be found in this repo, and here is the latest PDF.
kaleidoscope
-
8 months of OCaml after 8 years of Haskell in production
The are LLVM Caleidoscope (toy compiler) in both Haskell and OCaml
https://github.com/sdiehl/kaleidoscope
- Implementing a JIT Compiled Language with Haskell and LLVM (2017)
-
Should I abandon using haskell for my compiler?
Comparing the haskell and cpp implementations of the LLVM tutorial lead me to believe it might be faster to learn haskell and implement the compiler in haskell than to implement it in cpp.
-
What would be your programming language of choice to implement a JIT compiler ?
I think for writing compilers Haskell deserves to make the list. It is really excellent at creating DSLs. https://www.stephendiehl.com/llvm/
-
Proposal to Merge Pyston with Cpython
I'm no expert, but you might be interested in: https://llvm.org/docs/tutorial/
There's also a Haskell version if you'd prefer: https://www.stephendiehl.com/llvm/
Idk how to do this in python as I'm not really good with it, but in C, to make your compiler a JIT, you would `mmap` a region as writeable, write the machine code to it that you already know how to generate, `mprotect` it as PROT_EXEC instead of PROC_WRITE, cast the pointer to the region to a function pointer, and then call it. These functions may be available in the python sys package but I don't really know.
I've implemented a "JIT" that takes machine code as hex and does this. Warning: it's complete garbage with no error checking but is a good proof of concept. https://gist.github.com/martinjacobd/3ee56f3c7b7ce621034ec3e...
- Why does Rust have parameters on impl?
-
Implementing a LLVM Micro C compiler in Haskell
This is amazing. I tried following Stephen Diehl's JIT compiler in LLVM tutorial[0] a few years ago but it was already outdated (the llvm-hs library changed quite a bit), and subsequent web searches didn't turn up much.
For those interested in tutorials like this, I'd also recommend a very literate Haskell compiler for the PCF language to C[1], which is essentially lambda calculus with some primitives.
[0] https://www.stephendiehl.com/llvm/
[1] https://github.com/jozefg/pcf/
- Resources for Amateur Compiler Writers
-
Need some help with monad transformers
I'm currently working with llvm-hs-pure and am struggling to properly emit code for a module. I basically followed https://www.stephendiehl.com/llvm/#chapter-3-code-generation and have types like:
-
Advanced books / tutorials about Haskell?
http://www.stephendiehl.com/llvm/ Implementing a JIT Compiled Language with Haskell and LLVM Nice tutorial. Requires knowledge of monads, applicatives, transformers. Deep enough and more or less 'real world'.
What are some alternatives?
abi-aa - Application Binary Interface for the Arm® Architecture
hyper-haskell-server - The strongly hyped Haskell interpreter.
i386-ABI
haskelm - Haskell to Elm translation using Template Haskell. Contains both a library and executable.
cpplinks - A categorized list of C++ resources.
accelerate-io - Read and write Accelerate arrays in various formats