RFR 8183146 [MVT] Create composed vwithfield constructor

Paul Sandoz paul.sandoz at oracle.com
Fri Jun 30 00:42:06 UTC 2017


Hi,

Please review the following:

  http://cr.openjdk.java.net/~psandoz/valhalla/c-wither/webrev/

This adds a method, named unrefllectWithers for want of a better name, that given a number of fields can produce a method handle that applies vwithfield, in order with each Field. SO it should produce some tight byte code for the production of values, which then can be optimized by the JIT (e.g. if a default value is obtained and all fields are updated then the JIT could optimize away the zeroing associated with vdefault).

This method is quite general, depending on the arguments passed in, it can reduce to an identity function, findWither, or defaultValueConstant, which suggests the latter two could defer to this method.

Rather than accepting an array of Field[] it should perhaps be a LinkedHashMap<String, Class<?>>, or two distinct arrays of the same size, String[] and Class[]. In any case we need a way for the caller to specify the set of fields in a defined order.

Paul.




More information about the valhalla-dev mailing list