Il 27/05/2014 16:54, Sebastian Tanase ha scritto:
> if (insns_left > 0) {
> /* Execute remaining instructions. */
> cpu_exec_nocache(env, insns_left, tb);
> + if (icount_align_option) {
> + instr_exec_time = original_low -
> +
> cpu->icount_decr.u16.low;
> + instr_exec_time = instr_exec_time <<
> + icount_time_shift;
> + diff_clk += instr_exec_time;
> + if (diff_clk > VM_CLOCK_ADVANCE) {
> + delay_host();
> + }
> + }
Why doesn't it have to update original_low and original_extra, and
why doesn't it have to take into account original_extra (the new
cpu->icount_extra is zero, but what about the old one)?
> + case 1:
> + case 0:
> + if (icount_align_option) {
> + instr_exec_time = original_extra -
> + cpu->icount_extra +
> + original_low -
> + cpu->icount_decr.u16.low;
> + instr_exec_time = instr_exec_time <<
> + icount_time_shift;
I wonder if tracking cpu->icount_extra + cpu->icount_decr.u16.low
(instead of the two separately) will lead to nicer code overall.
int64_t current_icount = cpu->icount_extra + cpu->icount_decr.u16.low;
diff_clk += (current_icount - old_icount) << icount_time_shift;
old_icount = current_icount;
Paolo
> + diff_clk += instr_exec_time;
> + original_extra = cpu->icount_extra;
> + original_low = cpu->icount_decr.u16.low;
> + }
> + break;
This can go in the "default" label.
> default: