On Mon, 22 Nov 2021 16:03:16 GMT, Jim Laskey <jlas...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/runtime/ObjectMethods.java line 314:
>> 
>>> 312:                     ).getTarget();
>>> 313:                     mhs[splitIndex] = 
>>> MethodHandles.filterArguments(mhs[splitIndex], 0, currentSplitGetters);
>>> 314:                     mhs[splitIndex] = MethodHandles.permuteArguments(
>> 
>> This is some gnarly logic. Could we add some comments on what 
>> permuteArguments with a reorder array of just zeros is doing here?
>
> This is not unusual. It spreads a single argument across several "getters". 
> But a comment wouldn't hurt.

I haven't seen it used like this before. The duplication behavior is mentioned 
explicitly with an example in the javadoc, sure, but it still took me a deep 
reading of the docs to understand what was going on here and what the intent 
was.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6403

Reply via email to