You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Joshua McKenzie (JIRA)" <ji...@apache.org> on 2016/08/03 20:41:21 UTC
[jira] [Updated] (CASSANDRA-12343) Make 'static final boolean'
easier to optimize for Hotspot
[ https://issues.apache.org/jira/browse/CASSANDRA-12343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joshua McKenzie updated CASSANDRA-12343:
----------------------------------------
Reviewer: Branimir Lambov
> Make 'static final boolean' easier to optimize for Hotspot
> ----------------------------------------------------------
>
> Key: CASSANDRA-12343
> URL: https://issues.apache.org/jira/browse/CASSANDRA-12343
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Robert Stupp
> Assignee: Robert Stupp
> Priority: Trivial
> Fix For: 3.x
>
>
> Hotspot is able to optimize condition checks on `static final` fields. But the compiler can only optimize if the referenced "constant" is the first condition to check. (If I understood the optimization in Hotspot correctly.)
> I.e. the first {{if}} block can be "eliminated" whereas the second cannot:
> {code}
> class Foo {
> static final boolean CONST = /* some fragment evaluating to false */;
>
> public void doSomeStuff(boolean param) {
> if (!CONST) {
> // this code block can be eliminated
> }
> if (!CONST && param) {
> // this code block can be eliminated
> }
> if (param && !CONST) {
> // this code block cannot be eliminated due to some compiler logic
> }
>
> }
> }
> {code}
> Linked patch changes the order in some {{if}} statements and migrates a few methods to static final fields.
> ||trunk|[branch|https://github.com/apache/cassandra/compare/trunk...snazy:boolean-hotspot]|[testall|http://cassci.datastax.com/view/Dev/view/snazy/job/snazy-boolean-hotspot-testall/lastSuccessfulBuild/]|[dtest|http://cassci.datastax.com/view/Dev/view/snazy/job/snazy-boolean-hotspot-dtest/lastSuccessfulBuild/]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)