a neat idea, i thunk
hi all, first and foremost sorry for the bad joke, the misspelling of think is deliberate.

anyway i was sitting around in the CSE (computer science engineering) lounge at UNSW and for some reason we were talking about emulators. First we were discussing the problems with completely recompiling an executable for another platform, and in the end decided it would probably be feasible assuming you had >= the number of registers used by the target program, other than that it would just be too complex.

the interesting idea that came up however was that the recompiler is constantly analyzing and recompiling blocks of EE machine code to i386/ia-64 machine code. the question is is it possible to save a recompiled block so that it does not have to be recompiled every time its needed. Its kind of like how functional languages use the idea of thunks for lazy evaluation, a thunk can either be evaluated or unevaluated. If it is unevaluated, when it is needed it will be evaluated and the result will be used, if it is already evaluated then the result is used. An example i can give is

f x = x + 2
g y = (f y) + (f y)

this will be optimized out so that the thunk containing f y will be used twice, and only evaluated once.

The reason this would work is because most code spends 90% of its time within 10% of the program, so that portion would be recompiled first and after that point there would already be a significant speedup.

as a disclaimer, i have literally only the faintest idea about how PCSX2 works, to be honest ive had a poke around in the sources and its scary. It could very well be that this is already done, or completely unnecessary because the time to recompile a block is insignificant compared to time taken by register thrashing.



Sponsored links

The point in the recompiler is to just recompiler it once then never again, so it already does that.

As to the second suggestion, microvu already does that as it analyses the block before recompilation to optimize the generated code, for the ee, that's a complete rewrite Sad
[Image: ref_sig_anim.gif]
Like our Facebook Page and visit our Facebook Group!
Exact replica of this thread:
Core i5 3570k -- Geforce GTX 670  --  Windows 7 x64
Didn't see that, trying to take credit for someone else's idea. Tsk.
[Image: ref_sig_anim.gif]
Like our Facebook Page and visit our Facebook Group!

Users browsing this thread: 1 Guest(s)