This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Google Summer of Code
- From: Per Bothner <per at bothner dot com>
- To: kawa at sourceware dot org
- Date: Tue, 22 Apr 2014 22:12:17 -0700
- Subject: Re: Google Summer of Code
- Authentication-results: sourceware.org; auth=none
- References: <20140305094242 dot 349492d0 at debian-andrebask> <5316F956 dot 8040303 at gmail dot com> <20140305132208 dot 3081f8dc at debian-andrebask> <m2lhwo48vi dot fsf at gmail dot com> <5319088C dot 5060401 at bothner dot com> <7B118191-4144-4937-B679-89392D5463EE at theptrgroup dot com> <20140316012026 dot 4e0ebfef at debian-andrebask> <53269580 dot 8040205 at bothner dot com> <20140320204856 dot 5aa0b4d3 at debian-andrebask> <532BAA5F dot 3000606 at bothner dot com> <20140328121426 dot 74f3e92d at vaio> <5337BD0C dot 8030301 at bothner dot com> <20140403021150 dot 0dc0f6f4 at vaio> <533F0CC5 dot 1060108 at bothner dot com> <20140413180307 dot 59d3fd9c at debian-andrebask> <534F2BB0 dot 1010208 at bothner dot com> <20140418011243 dot 7fc952d6 at vaio> <53507249 dot 3060707 at bothner dot com> <20140418130754 dot 00ae2396 at vaio> <5351C1CF dot 4090203 at bothner dot com> <20140423003723 dot 1e88205e at vaio>
On 04/22/2014 03:37 PM, Andrea Bernardini wrote:
Running the code with disAssembleWithFixups, I noticed that the
final return statement is missing also before the code reordering.
> ...
>
I tried to put some println inside code.emitReturn and code.put1.
It comes out that emitReturn is never called when the numCases == 1
code is generated.
What I usually in such cases is I put a:
new Error("emitReturn called").printStackTrace();
inside emitReturn. Then I look at the stack trace (for numCases == 2)
to understand who calls emitReturn and why. (It shouldn't have
anything to do (directly) with SwitchState.)
Then you try to figure out why emitReturn is not being called in the
numCases == 1 case. I.e. you try to figure out why the two cases are
acting differently. Either using a debugger or adding print statements
However, I have a hunch: The problem is most likely that
comp.method.reachableHere()
is false when compileEnd is called.
Clearly reachableHere() *should* be false after the (numcases==1)
code in SwitchState.finish. Logically, it should also be false
after a lookupswitch or tableswitch instruction. Perhaps things
accidentally work because we don't do code.setUnreachable() when
we really ought to.
I.e. a possible work-around would be to add a code.setReachable(true)
at the end of the numCases=1 logic. However I would like to understand
why that would be needed, and perhaps make a cleaner fix.
--
--Per Bothner
per@bothner.com http://per.bothner.com/