[9] RFR (M): 8050877: Improve code for pairwise argument conversions and value boxing/unboxing
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Wed Jul 16 16:28:26 UTC 2014
http://cr.openjdk.java.net/~vlivanov/8050877/webrev.00/
https://bugs.openjdk.java.net/browse/JDK-8050877
Improved MethodHandleImpl.makePairwiseConvert & ValueConversions.unbox
and small cleanups in related code.
Also, improved method handle caching in ValueConversions.
MethodHandleImpl.makePairwiseConvert:
- * @param level which strength of conversion is allowed
+ * @param strict if true, only asType conversions are allowed; if
false, explicitCastArguments conversions allowed
+ * @param monobox if true, unboxing conversions are assumed to be
exactly typed (Integer to int only, not long or double)
ValueConversions.unbox:
- private static MethodHandle unbox(Wrapper wrap, boolean cast) {
+ private static MethodHandle unbox(Wrapper wrap, int kind) {
+ // kind 0 -> strongly typed with NPE
+ // kind 1 -> strongly typed but zero for null,
+ // kind 2 -> asType rules: accept multiple box types but only
widening conversions with NPE
+ // kind 3 -> explicitCastArguments rules: allow narrowing
conversions, zero for null
+ WrapperCache cache = UNBOX_CONVERSIONS[kind];
Testing: jdk/java/lang/invoke, jdk/java/util/streams, nashorn, octane w/
"-ea -esa" and COMPILE_THRESHOLD={0,30}.
Reviewed-by: vlivanov, ?
Contributed-by: john.r.rose at oracle.com
Thanks!
Best regards,
Vladimir Ivanov
More information about the mlvm-dev
mailing list