Peter Kuschnerus
2014-05-06 16:23:45 UTC
Hi !
Multi-way Radix Search Tree (MRST)
In arch powerpc, module code.c
there I did find a not finished implementation ( inactive by #if 0 )
of the MRST algorithm for generating code for switch/case
Reading the papers of the originators of that algorithm
I could understand this implementation.
I adapted this to my port.
I solved several issues.
A main issue was: this code supports only int as argument for switch,
while the standard allowes any width of integer.
I changed that.
I also rewrote the emitting of the "indexed jump"
by using XASM.
Then it seemed to work, but only without optimisation.
Optimizing threated all code that is referenced by pointers
as unreachable and removes it.
Then I did find the interface to keep deljumps from removing a label,
by setting a list of labels in epp->ip_labels.
This interface looks never beeing used.
I used this interface. Finaly it seemed to work.
Most of the code is arch independent,
exept the emitting of the instuction of "indexed jump".
If the arch has suitable instructions for that,
theese are not in table.c, but are instead expressable by XASM.
I made a version for i386 and for amd64 and tested it.
Of course all this needs more regession tests
before it can be used generally.
Now how to proceed with this ??
My idea is, that someone reviews it.
Regards
Peter Kuschnerus
Multi-way Radix Search Tree (MRST)
In arch powerpc, module code.c
there I did find a not finished implementation ( inactive by #if 0 )
of the MRST algorithm for generating code for switch/case
Reading the papers of the originators of that algorithm
I could understand this implementation.
I adapted this to my port.
I solved several issues.
A main issue was: this code supports only int as argument for switch,
while the standard allowes any width of integer.
I changed that.
I also rewrote the emitting of the "indexed jump"
by using XASM.
Then it seemed to work, but only without optimisation.
Optimizing threated all code that is referenced by pointers
as unreachable and removes it.
Then I did find the interface to keep deljumps from removing a label,
by setting a list of labels in epp->ip_labels.
This interface looks never beeing used.
I used this interface. Finaly it seemed to work.
Most of the code is arch independent,
exept the emitting of the instuction of "indexed jump".
If the arch has suitable instructions for that,
theese are not in table.c, but are instead expressable by XASM.
I made a version for i386 and for amd64 and tested it.
Of course all this needs more regession tests
before it can be used generally.
Now how to proceed with this ??
My idea is, that someone reviews it.
Regards
Peter Kuschnerus