Re: Smaller C (was: What does your OS look like?)
Posted: Tue Apr 11, 2017 9:48 am
alexfru: i was able to achieve the things i needed from your compiler, i did the emulation with inline assembly with fake 64 bit number simulation. overally, the compiler is very good for unreal mode dev development purposes.
i most probably will not do any bootable stuff on x86 any more, but i have suggestions to make the software better for future users.
i list these from most important to less important features.
1. minimum optimisations must be introduced.
The generated code is extremely slow on SOME in-order cpus (like on the intel atom n4xx, at least 20x slower). but its suprisingly not SO slow on other in-order cpus, like vortex86. On superscalar cpu-s, the code is still much slower than it should be when compared to gcc (like 5x-10x). This is maybe not a focus in this project, but some minimal binary code optimisations must be done, at least related to the function calls, the for cycles, array addressing. I dont know the structural work of the compiler, but these simply optimisations must be possible to some extent (for example, storing the address computations if its possible for the next operation if its possible, if the variable is alreday copyed to a register then dont do a full resolve code on it again, maybe some very minimal cycle unrolling at least for register pre-computation, etc). This is required for the compiler to make general worldwide interest. (very important)
2. 64 bit long long must be implemented
64 bit signed and unsigned numbers must be implemented, it canot be avoided. i guess the problem with this is you use fix 32 bit wide data passing to function calls and return values. returning a 64 bit value is easy, you probably alreday just copy it to EAX (so the other part of the number can go for example to a different register). adding 64 bit to function parameters is a bit more tricky, but still must be done, since software (escpecially OS-es) alreday using long long if its necessary. having 64 bit numbers is a must have. (very important)
3. better usage of cpu with functions
For example, a function bswap32 and bswap64 should be implemented on language level. so where the cpu is capable of executing a bswap, then that can be very efficient compared to calling a function and doing shitloads of bitshifts. (important)
4. inline
Function inlining must be implemented. Its not complex to implement it, you can just basically copy the contects of the function to the place of the call, and set the variables as it should. (moderately important)
5. inline assembly errors
When its a typo on assembly, a bug writes out random source code line number, when an error is in the inline assembly code. Iit not writes out the place of the actual error. (not important)
i most probably will not do any bootable stuff on x86 any more, but i have suggestions to make the software better for future users.
i list these from most important to less important features.
1. minimum optimisations must be introduced.
The generated code is extremely slow on SOME in-order cpus (like on the intel atom n4xx, at least 20x slower). but its suprisingly not SO slow on other in-order cpus, like vortex86. On superscalar cpu-s, the code is still much slower than it should be when compared to gcc (like 5x-10x). This is maybe not a focus in this project, but some minimal binary code optimisations must be done, at least related to the function calls, the for cycles, array addressing. I dont know the structural work of the compiler, but these simply optimisations must be possible to some extent (for example, storing the address computations if its possible for the next operation if its possible, if the variable is alreday copyed to a register then dont do a full resolve code on it again, maybe some very minimal cycle unrolling at least for register pre-computation, etc). This is required for the compiler to make general worldwide interest. (very important)
2. 64 bit long long must be implemented
64 bit signed and unsigned numbers must be implemented, it canot be avoided. i guess the problem with this is you use fix 32 bit wide data passing to function calls and return values. returning a 64 bit value is easy, you probably alreday just copy it to EAX (so the other part of the number can go for example to a different register). adding 64 bit to function parameters is a bit more tricky, but still must be done, since software (escpecially OS-es) alreday using long long if its necessary. having 64 bit numbers is a must have. (very important)
3. better usage of cpu with functions
For example, a function bswap32 and bswap64 should be implemented on language level. so where the cpu is capable of executing a bswap, then that can be very efficient compared to calling a function and doing shitloads of bitshifts. (important)
4. inline
Function inlining must be implemented. Its not complex to implement it, you can just basically copy the contects of the function to the place of the call, and set the variables as it should. (moderately important)
5. inline assembly errors
When its a typo on assembly, a bug writes out random source code line number, when an error is in the inline assembly code. Iit not writes out the place of the actual error. (not important)