Debugging in the Time of JITs
rfrn.org
rfrn.org
If it turns out that what you mostly pay for, when using a GC, is that collection happens at one point in time instead of incrementally, then Go's plan for the evolution of their GC just became a lot more interesting.
There should never be a need to completely disable the JIT optimizer, except perhaps to debug the JIT itself.
Here's the example as described in the article: your page is stuck in a busy loop, but you don't have the debugger active. You'd like to debug this without needing to find a repro with the debugger active. But the JIT's compiled code doesn't expose enough information for Firefox's debugger to work with.
How is your statement relevant? To enable the debugger to work on code that is currently in a busy loop in JITted code, it needs to introspect stack frames, and modify code (one way or another, for breakpoints). The current JIT design doesn't permit this. How do you propose doing these things in a less complicated way? Either you deoptimize the existing frames (which the JIT apparently already has support for, and is described in the article) or you annotate generated code with extra debug info (which AFAIK it doesn't have support for).
I also don't know what you mean by "pepper the code that enters the JIT" in the context of stack traces. Having the stack trace of the code that entered the JIT is not necessarily the same stack trace for code that is running entirely in JITted code.
One way to understand the requirement for deoptimization is to to think about where the programmer can observe the difference between an optimized construct and the naive version. In regular execution there are relatively few places where the state of the program is observable, allowing freedom to aggressively optimize - under the debugger there are no places where the state of the program is unobservable.