[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pnet-developers] stack variables in unroller
From: |
Aleksey Demakov |
Subject: |
[Pnet-developers] stack variables in unroller |
Date: |
Sat, 17 Mar 2007 19:14:06 +0600 |
Hi all,
The attached patch allows unroller to load/store CVM special loop
variables (that is pc, stacktop, frame) from the native stack.
So far it was possible to use unroller only if gcc's explicit register
declarations for these variables were used.
The following two #defines control how CVM interpreter is compiled:
IL_NO_REGISTERS_USED
IL_VMCASE_BARRIER
By default the interpreter still uses register variables.
If IL_NO_REGISTERS_USED is #defined then the register use is
disabled and the new unroller code that loads/stores the required
variables is enabled. Also the registers that are used to load the
variables are saved on the stack when the unrolled code is enterred
and restored before the exit.
If additionally IL_VMCASE_BARRIER is enabled then the save and
restore code for those registers is eliminated but on each VMCASE
in the interpreter loop the following bit off gcc assembly is inserted.
__asm__ __volatile__("" : : : "memory").
The idea is that this forces gcc spill all variables from registers
and as all registers are now dead there is no need for extra push
and pop instructions within the unroller.
Unfortuantely, I had to use a nasty trick to insert those __asm__
snippets everywhere and IL_VMCASE_BARRIER causes a whole lot
of compiler warnings about unused labels.
Currently, this feature is implemented only for x86. The code that
uses explicit register declarations is still faster than the code that
does not use it. So it is just a proof of concept that might be used
for platforms where explicit register declaration does not work for
some reason.
The pnetmark results with no registers and no barriers:
Sieve ... 9348
Loop ... 17912
Logic ... 7216
String ... 14725
Float ... 1425
Method ... 3761
PNetMark rating is 6759
The pnetmark results with no registers and with barriers:
Sieve ... 11307
Loop ... 21366
Logic ... 10934
String ... 15217
Float ... 1439
Method ... 5656
PNetMark rating is 8300
The pnetmark results with registers:
Sieve ... 15480
Loop ... 28836
Logic ... 19942
String ... 16202
Float ... 1649
Method ... 6742
PNetMark rating is 10818
Any suggestions on improving my patch are wellocme.
Regards,
Aleksey
stack_vars.diff
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pnet-developers] stack variables in unroller,
Aleksey Demakov <=