|
|
|
|
|
by Dylan16807
2056 days ago
|
|
> Speculating that a debugger is not attached and modifying local variables, is one example. A debugger can do anything. You can't outthink a debugger and shouldn't try. > Yes that’s why it’s speculation - handle the common cases and speculate away the uncommon cases. Speculation is when you guess and need to have a guard in case the guess is wrong. They're describing a situation where it can't be wrong and you wouldn't need to speculate. |
|
Yes that's what we're saying. So you deoptimise when someone starts debugging.
> and shouldn't try
You'd get extremely slow code with this approach!
> Speculation is when you guess and need to have a guard in case the guess is wrong.
Yes, you're guessing that nobody will attach a debugger and you're guarding that no debugger has been attached. That guard is usually implicit.
> They're describing a situation where it can't be wrong and you wouldn't need to speculate.
It can be wrong... if someone's using a debugger. So you need to speculate that they aren't using a debugger.
I wrote a PhD about using speculation and deoptimisation to solve the problem of people debugging optimised code.