Hacker News new | ask | show | jobs
by codedokode 1103 days ago
> you need to track the possibility of a branch at every single arithmetic operation

Every memory access can cause a trap, but CPUs seem to have no problem about it. The branch is very unlikely and can always be predicted as "not taken".

2 comments

Hell, with non-maskable interrupts, any instruction can cause a trap!
Not even that - instruction fetch can cause a page fault. When an NMI happens,the CPU still has the choice of when to service it. If it needs to flush the pipeline, it might as well retire the instructions up to the first store.
Managing memory coherency is probably the single hardest part to design in any given CPU. Why add even more hard things (especially if they can interact and add even more complexity on top)?

Get rid of what complexity you can then deal with the rest that you must have.

Coherency is very hard but it's not what causes traps from accessing memory. That part is a relatively simple permission check.