Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
|
|
|
|
Poster | Thread | cdimauro
| |
Re: Productivity Amiga Emulation Posted on 25-Jul-2015 9:35:40
| | [ #81 ] |
| |
|
Elite Member |
Joined: 29-Oct-2012 Posts: 3650
From: Germany | | |
|
| @Wanderer
Quote:
Wanderer wrote:
Granularity: without having really seen WinUAE's JIT code, my intuition would be to translate all opcodes until a jump/branch happens or a maximum number of opcodes is translated. If the code is small and the jump is forward in the code, it could be included too, just loops won't work since the execution time is unpredictable. |
If you treat a block as an atomic unit of execution, you have to explicitly check for loops (inside it, of course) and provide some "escapes". Analyzing the code you can take smart decisions against trivial, but also very common cases.
For example, using a DBRA we know that the counter, which is 16-bit, will expire soon. So, you can leave this block as atomic, because the loop will be executed 65536 times at most, and it's acceptable (we are talking about a compiled/native code!).
You can also intercept the usual SUBQ + BNE and take the same decision IF the SUBQ is a byte or word. If it's a long, well, you can take a look a the previous instructions and see if the counter is loaded with a reasonable value. But it's quite complicated.
For the general case, it's better to put an internal counter which keeps track of how many times you executed this block (without exiting from it): problem solved. Quote:
Rollout of n loops would be possible though. Ideally we always get around the same "N" instructions in one chunk. |
Let's do it when you introduce some "hot spot" algorithm.
For all other things that you wrote, I agree... or I wait to see something more. |
| Status: Offline |
| | Wanderer
| |
Re: Productivity Amiga Emulation Posted on 25-Jul-2015 13:04:01
| | [ #82 ] |
| |
|
Cult Member |
Joined: 16-Aug-2008 Posts: 654
From: Germany | | |
|
| @cdimauro
As I said, you target N instructions.
If you want N = 1000, and you see a loop of 100 instructions, you can roll it out 10 times (rolling out is simple). This way you get at most 1000 instructions i one block, sometimes less if the loop terminates. But you make pretty good use of the host CPU without too many interruptions.
_________________ -- Author of HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more... Homepage: http://www.hd-rec.de |
| Status: Offline |
| | cdimauro
| |
Re: Productivity Amiga Emulation Posted on 25-Jul-2015 16:42:24
| | [ #83 ] |
| |
|
Elite Member |
Joined: 29-Oct-2012 Posts: 3650
From: Germany | | |
|
| @Wanderer: you can use such big blocks only unrolling loops. That's because, on average, there's a jump instruction every ten. It means that normally you'll get a lot of small decoded blocks, if you follow the rule of: "I start decoding and I stop when I find a jump".
The only way to "defrag" such myriad of micro-blocks is by using a smart policy of "fusion", in order to get bigger chunks. But, again, it's a bit premature talking of such stuff (which includes block chaining). |
| Status: Offline |
| |
|
|
|
[ home ][ about us ][ privacy ]
[ forums ][ classifieds ]
[ links ][ news archive ]
[ link to us ][ user account ]
|