Re: [ATTN Matt & PeteL] Re: IL Disassembler?
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Apr 12, 2005
- 515 views
On Mon, 11 Apr 2005 14:11:27 -0700, Alexander Toresson <guest at RapidEuphoria.com> wrote: >posted by: Alexander Toresson <alexander.toresson at gmail.com> > >I can't get the IL output to work for sieve8k.exw in either of your programs >(ildis&ooeu). > >Ildis can run it correctly, but if I do: > >exu eu.ex sieve8k.exw -i > >I get the following error: > >./main.e:170 in function name() >subscript value 283 is out of bounds, reading from a sequence of length 234 >... called from ./main.e:511 in procedure EmitIL() >... called from ./main.e:862 in procedure main() >... called from ./main.e:873 > >An interesting thing is that it can output the il code of eu.ex correctly, >however. Aye, it is failing on the name part, not the actual il code. The thing that has happened here is that, in main.e you will find: elsif find(eii,{POWER,LESS,GREATEREQ,EQUALS,NOTEQ,LESSEQ,GREATER, MULTIPLY,PLUS,MINUS,OR,AND,DIVIDE,FLOOR_DIV, XOR,OR_BITS,XOR_BITS,AND_BITS,REMAINDER, SC1_AND,SC1_AND_IF,SC1_OR,SC1_OR_IF, APPEND,PREPEND,COMPARE,FIND,MATCH,CONCAT, DIV2,FLOOR_DIV2,REPEAT,PLUS1,PASSIGN_OP_SUBS, PLUS_I,MINUS_I,PLUS1_I,SPRINTF,EQUAL, MACHINE_FUNC,OPEN,SYSTEM_EXEC}) then -- -- two operands and a result -- **BUT** SC1_AND_IF's third parameter is *NOT* a variable, but an address (mea culpa), so it dies trying to get a name for it. Actually, there will be cases where eu.ex would output a random name for '283' (or whatever) but the il produced would run fine anyway... In fact, this bug only surfaces when there is one routine "longer" than the entire program, if you get my drift. I am a bit too busy to polish this (sorry), but you need to insert something like this in the above, and possibly similar for some of the other SCxxx instructions: elsif find(eii,{SC1_AND_IF}) then printf(fn,"%s%s,%d,%d,%d --%d:?? goto %d iff??:=?? %s(%s,%s)\n", {strep,ein,ei1,ei2,ei3, eidx,ei3,ein,name(ei1)}) ie ...%d... ei3, not ...%s...name(ei3). It might be simpler just to make name() more robust, say by returning "***ERROR***" instead of crashing, as its results are only comments anyway. Thanks for reporting this! Regards, Pete