Nim compiler generates strange C code

2021-04-07 Thread japplegame
Thank you for the clarification. I also found that clang generates much better asm than arm-none-eabi-gcc.

Nim compiler generates strange C code

2021-04-07 Thread japplegame
Ooops, sorry for the duplication.

Nim compiler generates strange C code

2021-04-07 Thread japplegame
Thank you for the clarification. I also found that clang generates much better asm than arm-none-eabi-gcc.

Nim compiler generates strange C code

2021-04-07 Thread Araq
I don't really remember the exact reasons, but "noinline" wasn't good enough in this case, so we used a volatile function pointer. The reason is that the C compiler must not optimize out our conservative GC stack marking. None of this is required for arc/orc.

Nim compiler generates strange C code

2021-04-07 Thread japplegame
Look at this very strange code: N_CDECL(void, NimMain)(void) { void (*volatile inner)(void); // <-- volatile?!! Why? PreMain(); inner = NimMainInner; (*inner)(); } Run This code turns into strange asm (ARM v6, dan