< prev index next >

src/java.base/share/classes/java/lang/invoke/VarHandle.java

Print this page
rev 55127 : 8223351: [lworld] Primary mirror and nullable mirror for inline type
Reviewed-by: tbd


1537         SET(void.class),
1538         COMPARE_AND_SET(boolean.class),
1539         COMPARE_AND_EXCHANGE(Object.class),
1540         GET_AND_UPDATE(Object.class);
1541 
1542         final Class<?> returnType;
1543         final boolean isMonomorphicInReturnType;
1544 
1545         AccessType(Class<?> returnType) {
1546             this.returnType = returnType;
1547             isMonomorphicInReturnType = returnType != Object.class;
1548         }
1549 
1550         MethodType accessModeType(Class<?> receiver, Class<?> value,
1551                                   Class<?>... intermediate) {
1552             Class<?>[] ps;
1553             int i;
1554             // the field type (value) is mapped to the return type of MethodType
1555             // the receiver type is mapped to a parameter type of MethodType
1556             // So use the value type as receiver may be a box type.
1557             if (receiver != null && receiver.isValue())
1558                 receiver = receiver.asValueType();
1559             switch (this) {
1560                 case GET:
1561                     ps = allocateParameters(0, receiver, intermediate);
1562                     fillParameters(ps, receiver, intermediate);
1563                     return MethodType.methodType(value, ps);
1564                 case SET:
1565                     ps = allocateParameters(1, receiver, intermediate);
1566                     i = fillParameters(ps, receiver, intermediate);
1567                     ps[i] = value;
1568                     return MethodType.methodType(void.class, ps);
1569                 case COMPARE_AND_SET:
1570                     ps = allocateParameters(2, receiver, intermediate);
1571                     i = fillParameters(ps, receiver, intermediate);
1572                     ps[i++] = value;
1573                     ps[i] = value;
1574                     return MethodType.methodType(boolean.class, ps);
1575                 case COMPARE_AND_EXCHANGE:
1576                     ps = allocateParameters(2, receiver, intermediate);
1577                     i = fillParameters(ps, receiver, intermediate);
1578                     ps[i++] = value;




1537         SET(void.class),
1538         COMPARE_AND_SET(boolean.class),
1539         COMPARE_AND_EXCHANGE(Object.class),
1540         GET_AND_UPDATE(Object.class);
1541 
1542         final Class<?> returnType;
1543         final boolean isMonomorphicInReturnType;
1544 
1545         AccessType(Class<?> returnType) {
1546             this.returnType = returnType;
1547             isMonomorphicInReturnType = returnType != Object.class;
1548         }
1549 
1550         MethodType accessModeType(Class<?> receiver, Class<?> value,
1551                                   Class<?>... intermediate) {
1552             Class<?>[] ps;
1553             int i;
1554             // the field type (value) is mapped to the return type of MethodType
1555             // the receiver type is mapped to a parameter type of MethodType
1556             // So use the value type as receiver may be a box type.
1557             if (receiver != null)
1558                 receiver = receiver.asPrimaryType();
1559             switch (this) {
1560                 case GET:
1561                     ps = allocateParameters(0, receiver, intermediate);
1562                     fillParameters(ps, receiver, intermediate);
1563                     return MethodType.methodType(value, ps);
1564                 case SET:
1565                     ps = allocateParameters(1, receiver, intermediate);
1566                     i = fillParameters(ps, receiver, intermediate);
1567                     ps[i] = value;
1568                     return MethodType.methodType(void.class, ps);
1569                 case COMPARE_AND_SET:
1570                     ps = allocateParameters(2, receiver, intermediate);
1571                     i = fillParameters(ps, receiver, intermediate);
1572                     ps[i++] = value;
1573                     ps[i] = value;
1574                     return MethodType.methodType(boolean.class, ps);
1575                 case COMPARE_AND_EXCHANGE:
1576                     ps = allocateParameters(2, receiver, intermediate);
1577                     i = fillParameters(ps, receiver, intermediate);
1578                     ps[i++] = value;


< prev index next >