On 21 August 2013 14:02, Schrober <franzschro...@yahoo.de> wrote: > Is qemu just recompiling the block again when it encounters a different entry > point to an already translated block?
Yes. We only use a previously translated block if it matches all of: * starts at the PC we want to execute * same flags (CPU-specific, usually means things like "same privilege level", possibly "fpu enabled/not enabled") (this is checked in tb_find_fast()/tb_find_slow() Otherwise we just retranslate. > I am currently starring at the code in > translate-all.c and cpu-exec.c and don't seem to find the right part of the > code which would help to understand this basic concept. At least it seems to > me that labels are not used very often because it ruins the code optimization. Mostly we don't use labels much because (a) a guest branch instruction means the end of the TB (b) there aren't many reasons to use labels for the average guest instruction (c) we do have TCG instructions like setcond for the common conditional-but-not-a-branch instructions. > Btw. do I understand it correctly and the memory for the TCG compiled code is > allocated in the "lets hope everything will fit in there or we are all doomed" > way? Well, we have compile time defines for "most TCG ops a guest instruction could possibly expand into" and similar limits, which means we can assume that when we're generating code we won't run out of space in our buffer (we end the TB if we wouldn't have enough space left for the next instruction). And if we fill the buffer up completely because we've created a lot of TBs, we just throw them all away and start again with an empty buffer (which might mean we have to retranslate something we just threw away, but it's easy and safe). -- PMM