jilc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Jilc-dev] "switch-case" Causing Problems


From: Gopal.V
Subject: Re: [Jilc-dev] "switch-case" Causing Problems
Date: Mon, 25 Feb 2002 19:40:03 +0530
User-agent: Mutt/1.2.5i

If memory serves me right, Gaurav Vaish wrote:
>     I tried experimenting with the values in the SWITCH block in jdasm.c, but
> only wasting my time. All the bytes (code[start +n], 0<=n<=3) give values as
> ZERO!!
        K, this is not my fault (theoretically). I had implemented the lookup
switch instruction for SWITCH type. All my test code was based on the this
instruction !.

        Since I am missing my O'Reilly book, I'll try to remember "tableswitch"
from memory and put it down as code. The stuff works like this....
170d is TableSwitch, Int32 default, Int32 low, Int32 high, Int32 offsets for 
low to high, So in your example it goes like this. 

00 : 27
01 : 170           -> tableswitch
02 : 0,0           -> the padding for Int32
04 : 0,0,0,86      -> default offset
08 : 0,0,0,0       -> low value 0
12 : 0,0,0,9       -> high value 9
16 : 0,0,0,56      -> offset for 0
20 : 0,0,0,67      -> offset for 1
24 : 0,0,0,75      -> offset for 2
28 : 0,0,0,86      -> offset for 3
32 : 0,0,0,86      -> offset for 4
36 : 0,0,0,86      -> offset for 5
40 : 0,0,0,86      -> offset for 6
44 : 0,0,0,86      -> offset for 7
48 : 0,0,0,86      -> offset for 8
52 : 0,0,0,55      -> offset for 9 (all offsets are relative of tableswitch)
56 : 177           -> return for 9
.....
        I'll put in an extra if for the opcode in the SWITCH block ;)
>     (Don't worry about the numbers before the deassembled code, I was working
> with label management.)
        I think I'll cvs up before starting on the patch.... Also I think
we are missing an important part here "Exception" table. Will work
that out....

        BTW try the following Java program....

Gopal.V
-- 
 The difference between insanity and genius is only measured by success
 //===<=>===\\
|| GNU RULEZ ||
 \\===<=>===//

Attachment: foo.java
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]