When should a compiler expand garbage collection barriers?

10 points by jo3_l


mikedorf

There’s an interesting meta question that this brings up - can the compiler know ahead of time which chunks of IR are not worth optimizing?

It would cool if there was a kind of incremental, meta PGO that doesn’t optimize the program under compilation but the compiler passes over its IR. I know optimizing JIT compilers have to make judgement calls at runtime already, but “don’t optimize this because you’re going to spend more time optimizing it than you save” is a different heuristic than “don’t optimize this because it’s cold.” Do production JITs have that capability today?