code generation of a switch on an enum
John Rose
john.r.rose at oracle.com
Fri Sep 12 19:44:39 UTC 2014
On Sep 10, 2014, at 8:14 PM, Vitaly Davidovich <vitalyd at gmail.com> wrote:
> Is there a reason the code is generated like this?
>
Yes, because condition codes are not modeled as live ranges that can be tracked.
They could be tracked but the register allocator would need the power to spill also.
So they are always materialized immediately before the branch that uses them.
> Besides not special casing the FOUR constant here (which the bug report addresses), why is a lookup switch used and not a table switch?
The bytecodes are equivalent syntaxes for the same IR. It doesn't matter which switch bytecode javac emits.
The JIT decides based on its own heuristics whether to use a decision tree or something else.
— John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20140912/ef225c45/attachment.html>
More information about the hotspot-compiler-dev
mailing list