RFR 8183146 [MVT] Create composed vwithfield constructor

Paul Sandoz paul.sandoz at oracle.com
Fri Jun 30 16:15:18 UTC 2017

> On 30 Jun 2017, at 03:20, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
> Looks good.


> I think even this could be expressed with a combinator; you need to walk field in reverse and repeatedly call mh = collectArguments(mh, 0, withfield). At the end of the process you get some MH whose type is QT1T2T3...Tn, where T1, T2, T3 ... Tn are the types of the fields. Now, if 'fromDefault' is set, you do another collectArgumemts(mh, 0, defaultConstantValue). If it is not set, you just leave the MH as is.

It’s possible to do that, as Vladimir did in his recent patch. I was concerned that we may have a limited budget for LFs and it would be better for the developer to spend that budget on their own combinators.

> That said, I have little clue as to what it's best for the VM to optimize - I suspect the combinator based one generates plenty of LFs under the hood, so might be more problematic than a single monolithic method?

Yes, the VM is remarkably effective at folding away the MH invocations but in this case i think we can help with more focused code (a bit like the existing intrinsics already do, and i wonder if later on we could make intrinsic the wither functionality).


More information about the valhalla-dev mailing list