Caterpillar

Daily Thought - 2024-09-29

< back to list

Okay, so the code update algorithm will determine how code got updated. But what can the compiler do with that information?

Here's my idea: If code inside a function has updates, the new version of the function is compiled, and the resulting instructions are appended at the end of the already existing code. This means in this first step, we only add new code, and the old code stays the same. That alone isn't enough, however, because how would that new code ever get executed?

And that's where the output from the update algorithm comes in. We know that x replaced b. We already compiled the new function containing x. To make sure that new function then gets executed, we replace all calls to the old function with calls to the new function. But we also replace b with a jump to x. So if we were about to execute b, we'll execute x instead.

<< previous thoughtnext thought >>