| 575 | } |
| 576 | |
| 577 | private addToCache(arg: InstructionRange) { |
| 578 | for (let ix = 0; ix < this.cache.length;) { |
| 579 | const old = this.cache[ix++]; |
| 580 | if (old.tryMerge(arg)) { |
| 581 | // See if we can merge with next neighbor |
| 582 | if ((ix < this.cache.length) && old.tryMerge(this.cache[ix])) { |
| 583 | this.cache.splice(ix, 1); |
| 584 | } |
| 585 | return; |
| 586 | } |
| 587 | } |
| 588 | this.cache.push(arg); |
| 589 | this.cache.sort((a, b) => a.startAddress - b.startAddress); |
| 590 | } |
| 591 | |
| 592 | // |
| 593 | // This is not normal disassembly. We have to conform to what VSCode expects even beyond |