• Kevin Modzelewski's avatar
    Generate cxx "fixups" on-demand · 21b20e3b
    Kevin Modzelewski authored
    fixups aka the stubs that decref whatever's needed when an exception is thrown
    
    I looked into this because most (75%?) of the refcounting overhead
    comes from the cxx fixups.  Previously we would always generate them in
    the IRGenerator, regardless of whether they were needed.  Now they are
    generated in the refcounter, which knows whether they are needed or not.
    
    Unfortunately it looks like they are usually needed, so the gains here
    aren't that great (saves about 10% llvm instructions whereas cxx fixups
    in general added about 400% more llvm instructions).
    
    I think this is still a good change because it's also necessary in order to use
    Marius's EH stuff.
    
    I think the cost of the fixups is mostly related to the cost of the decrefs
    that it adds, so even though most of the refcounting overhead seems to be due to
    adding the cxx fixups, reducing general decref overhead might reduce cxx fixup overhead
    21b20e3b
runtime_hooks.h 2.9 KB