BUG-1485: optimize primitive range checks 66/21966/2
authorRobert Varga <rovarga@cisco.com>
Thu, 28 May 2015 23:50:23 +0000 (01:50 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 5 Jun 2015 21:08:35 +0000 (21:08 +0000)
commit7f9966216b46fa11dd73fff894b6f4e9d9029974
treeca14698a7154d07d1876d13b985a1583a106f891
parent7b13e493ec88a65eb2e13b7c73e540d2dea2e169
BUG-1485: optimize primitive range checks

When we are dealing with a primitive type, we can force unboxing of the
type by declaring the range checker method's argument as the primitive
type. This will result in the stack not containing references for the
fast path (e.g. successful check) as well as reduce the number of
virtual calls to one. Checks will then be performed using primitive
manipulation instructions, which should result in better fast-path
execution.

The slow path will take a hit, as for throwing the exception, we will
end up re-boxing the primitive type.

Change-Id: I7e6b0e25790f9a43dc99f2fc7426bb9fe25c505c
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 9b5366d775b93f0e2a37f028cda11832ba65ce6d)
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/AbstractPrimitiveRangeGenerator.java
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/AbstractSubIntegerRangeGenerator.java
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/ByteRangeGenerator.java
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/IntegerRangeGenerator.java
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/LongRangeGenerator.java
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/ShortRangeGenerator.java