b2ece54864
Until now, each element on the compiled program stack was 128 bits long, half of them unused because only one 64 bits value was stored. Now it's 64 bits long, so we don't waste all that memory. We workaround the architectural alignment restriction of the SP register by using a free regular register. X18 is for platform use so it seems a good candidate for this task. At _start we copy the value of SP into X18. SP is not used anymore. When a definition refers to SP it doesn't mean it literaly now, because here we redefine (without renaming) the involved M1 macro definitions to operate on X18 (easier transition; abstraction). INIT_SP is introduced. The function arguments are passed via stack, so the offset from the Base Pointer ("depth") to each of them is different now. Changes both to compiler code (cc_core.c) and libc reflect that the arguments are 8 bytes (instead of 16 bytes) apart now. Note that SUB_X0_32 and SUB_X0_48 are removed, because we only need 8, 16 and 24 bytes subtraction to reach the arguments from asm libc functions. SUB_X0_8 and SUB_X0_24 are introduced. |
||
---|---|---|
docs | ||
functions | ||
test | ||
.gitignore | ||
CHANGELOG.org | ||
HACKING | ||
INSTALL | ||
LICENSE | ||
README.md | ||
cc-minimal.c | ||
cc.c | ||
cc.h | ||
cc_core.c | ||
cc_reader.c | ||
cc_strings.c | ||
cc_types.c | ||
gcc_req.h | ||
makefile | ||
sha256.sh |
README.md
M2-Planet
The PLAtform NEutral Transpiler, when combined with mescc-tools; allows one to compile a subset of the C language into working binaries with introspective steps inbetween.
A lovely set of examples of M2-Planet programs are in tests but the most surprising part of all M2-Planet can self-host M2-Planet.
Further more M2-Planet is cross-platform and self-hosting across platforms with fully deterministic builds enabling perfect reproducibility.
To bootstrap from assembly simple run ./bootstrap-x86.sh after cd into the bootstrap directory (the only requirement is mescc-tools to be installed)
Or if you have no binaries to bootstrap from please use mescc-tools-seed; which will not only bootstrap mescc-tools but also M2-Planet