3 ms·
The price you pay for GCC nested (local) functions is an executable stack with 'trampolines'. I'm a fan of nested functions but don't think the executable stac
by nutjob2 11mo ago
The price you pay for GCC nested (local) functions is an executable stack with 'trampolines'.
I'm a fan of nested functions but don't think the executable stack hack is worth it, and using a 'display' is a better solution.
See the Dragon Book or Compiler Construction: Principles and Practice (1984) by Louden
- sirwhinesalot 11mo agoYou misunderstood my comment. GNU local function syntax, C++ [&] lambda behavior (i.e., a hidden struct).
- nutjob2 11mo agoI really did, my comment is specific to C.
- LegionMammal978 11mo agoThe only reason that GCC needs executable trampolines is for the program to be able to create an ordinary function pointer and have all the captured data come along with it. The proposal is to reuse the syntax of nested functions, but change the semantics so that they are no longer callable via ordinary function pointers, but rather "fat pointers" that reference the captured data alongside the raw function address. This is similar to the method used by C++ and does not need trampolines.
- dfawcus 11mo agoMeaning something that generates code similar to what I have in this comment? https://news.ycombinator.com/item?id=46243298 https://news.ycombinator.com/item?id=46243298
- sirwhinesalot 11mo agoYeah something like that, though built-in to the compiler.