BUG-1485: optimize primitive range checks
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)
commit72591fab39e7865d74b3ec9266c54ef4642e9533
treeea2796fec92f0841e2269db12c1aa884cc3567d2
parent542576fed522be3e38435368a6bd85e5f52f9638
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