This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Google Summer of Code




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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]