|
From: Jeremy F. <je...@go...> - 2005-02-01 23:06:40
|
I just checked in a series of patches which remove the baseBlock and all its uses. The main reason for this was to simplify the code (~1000 lines gone), and to simplify accessing the CPU state. There's now only one place to look for VCPU state - the thread's ThreadState. While generated code is running, %ebp points to the thread's entry in VG_(threads). I also checked in some improvements to the handling of dispatch_ctr. It is per-thread rather than global, and so is easily accessible as an offset from %ebp. This reduces the per-basic block preamble from 15 bytes to 7 (16->8 if you use --branchpred=yes). It also makes the meaning of dispatch_ctr a bit more precise. It used to mean "switch contexts after 50k BBs were run, regardless of which thread", now it means "switch after this thread runs 50k BBs" - the difference probably isn't significant at the moment. The result of these changes gave me pretty significant performance improvements; ~7% for a single threaded CPU-bound task (gcc's cc1 on vg_from_ucode.i). The cost of a context switch is much cheaper now, since there's no copying between baseBlock<->ThreadState, so programs which do lots of syscalls or client requests could be significantly faster. The Tool interface is mostly unchanged. VG_(get_VCPU_thread)() doesn't mean quite the same thing as before (it used to mean "thread who's state is in the baseBlock"; now it means "thread currently holding the run_sema"), but as far as I can tell it hasn't made a difference. The one change I had to make was add a ThreadId argument to post_regs_write_init, since there's no thread actually running at that point. J |