switching on keys of type long

Venkatachalam, Vasanth Vasanth.Venkatachalam at amd.com
Thu Nov 7 12:49:51 PST 2013


I assume that the case for handling Object keys also comes from TypeSwitchNOde? 

I  also had a similar question about LIRGenerator.emitSwitch( )

The line that says:

If(keyCount == 0) { ...

Javac optimizes away switch statements that have no keys (e.g., cases) so that the switch doesn't appear in bytecode.
Was this condition also added to handle the TypeSwitchNode?

Vasanth

-----Original Message-----
From: Doug Simon [mailto:doug.simon at oracle.com] 
Sent: Wednesday, November 06, 2013 12:58 PM
To: Venkatachalam, Vasanth
Cc: graal-dev at openjdk.java.net
Subject: Re: switching on keys of type long

This comes from TypeSwitchNode.

On Nov 6, 2013, at 7:43 PM, Venkatachalam, Vasanth <Vasanth.Venkatachalam at amd.com> wrote:

> Can someone explain why the emitCode( ) routine of AMD64ControlFlow.SequentialSwitchOp is handling the case:
> 
> else if (key.getKind() = Kind.Long)  ?
> 
>> From my understanding of Java, it's not possible to switch on keys of type long. You get a compile time error.
> 
> Vasanth





More information about the graal-dev mailing list