On 23 April 2012 03:25, Peter Portante <pport...@redhat.com> wrote: > Can somebody speak to the history of using a global variable for env state > instead of passing it around in function calls? Is this because we could not > trust the compiler to keep it in a register between function calls? If so, > then do you think it might be worth a look at what the compilers can do to > help simplify somewhat complicated code and still maintain the performance? > Or was it that env had to be added to so many functions that it became too > tedious to maintain?
It's historical legacy, really. env is in a fixed register when running in TCG code, and so some functions called directly from TCG code have also been compiled to assume env to be in that fixed register, to avoid the overhead of having TCG code marshall it in as a function parameter. Blue Swirl has been working on patchsets that move towards always passing it in a register; unfortunately there is apparently a performance hit associated with this, though. -- PMM