I wrote a self-hosting C compiler in 40 days (2015)
sigbus.info
sigbus.info
Bringing up a compiler in a simulated environment has its advantages over real metal. Seeing instruction traces with computed values is awesome for debugging.
I always find it hard to find the absolute minimum functionality i can implement so I usually just attack the problem hard, fail, and keep repeating until I have enough broken functionality, then I start adding tests and refactoring.
Can I ask what is your day job? :)
Would anyone care to explain this? It makes no sense at all to me. Why would the 64-bit architecture restrict passing a large object on the stack?
Thanks.
Some notes:
[1] inlining, calls to static functions and whole program optimization do give the compilers freedom to pick a different calling convention of course.
The AMD64 ABI was designed to allow passing aggregates via registers, the same as for scalars (many x86 ABIs passed everything in memory), this way aggregating some related parameters in a structure for whatever reason does not imply a performance penalty.
BTW passing small structures by value is actually now fairly common in C++, although objects that are not trivially copyable must always be passed via stack through an hidden pointer parameter even in the by-value case.
Large objects must be passed on the stack of course if there are not enough registers to store them (the ABI define exactly when that's necessary).
The blog actually goes into this a bit, stating that the byte-value of '\n' never occurs in the source-code of 8cc. Instead, that value comes from gcc. It is entirely possible that gcc has the same property, eventually the source could be a hand-written compiler.
Really, to get around trusting trust, you need a compiler who's entire lineage you know (up to the hand-written compiler) and trust.
Not really, thanks to cross-compilation. Only a small number of CPUs has really required bootstrapping with direct machine code.