jdk/src/share/classes/sun/dyn/SpreadGeneric.java
author ohair
Tue, 28 Dec 2010 15:53:50 -0800
changeset 7668 d4a77089c587
parent 7556 4a5711d43948
child 8347 e5daa5772ffd
permissions -rw-r--r--
6962318: Update copyright year Reviewed-by: xdono
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
     1
/*
7668
d4a77089c587 6962318: Update copyright year
ohair
parents: 7556
diff changeset
     2
 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
     4
 *
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4537
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4537
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    10
 *
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    15
 * accompanied this code).
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    16
 *
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4537
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4537
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4537
diff changeset
    23
 * questions.
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    24
 */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    25
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    26
package sun.dyn;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    27
7052
963a5baf2ba3 6980096: JSR 292 reflective lookup should throw checked exceptions
jrose
parents: 5725
diff changeset
    28
import java.dyn.*;
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    29
import java.lang.reflect.Constructor;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    30
import java.lang.reflect.InvocationTargetException;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    31
import java.util.ArrayList;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    32
import sun.dyn.util.ValueConversions;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    33
import static sun.dyn.MemberName.newIllegalArgumentException;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    34
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    35
/**
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    36
 * Generic spread adapter.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    37
 * Expands a final argument into multiple (zero or more) arguments, keeping the others the same.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    38
 * @author jrose
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    39
 */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    40
class SpreadGeneric {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    41
    // type for the outgoing call
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    42
    private final MethodType targetType;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    43
    // number of arguments to spread
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    44
    private final int spreadCount;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    45
    // prototype adapter (clone and customize for each new target!)
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    46
    private final Adapter adapter;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    47
    // entry point for adapter (Adapter mh, a...) => ...
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    48
    private final MethodHandle entryPoint;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    49
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    50
    /** Compute and cache information common to all spreading adapters
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    51
     *  that accept calls of the given (generic) type.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    52
     */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    53
    private SpreadGeneric(MethodType targetType, int spreadCount) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    54
        assert(targetType == targetType.generic());
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    55
        this.targetType = targetType;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    56
        this.spreadCount = spreadCount;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    57
        // the target invoker will generally need casts on reference arguments
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    58
        MethodHandle[] ep = { null };
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    59
        Adapter ad = findAdapter(this, ep);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    60
        if (ad != null) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    61
            this.adapter = ad;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    62
            this.entryPoint = ep[0];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    63
            return;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    64
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    65
        this.adapter = buildAdapterFromBytecodes(targetType, spreadCount, ep);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    66
        this.entryPoint = ep[0];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    67
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    68
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    69
    /** From targetType remove the last spreadCount arguments, and instead
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    70
     *  append a simple Object argument.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    71
     */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    72
    static MethodType preSpreadType(MethodType targetType, int spreadCount) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    73
        @SuppressWarnings("unchecked")
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    74
        ArrayList<Class<?>> params = new ArrayList(targetType.parameterList());
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    75
        int outargs = params.size();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    76
        params.subList(outargs - spreadCount, outargs).clear();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    77
        params.add(Object.class);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    78
        return MethodType.methodType(targetType.returnType(), params);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    79
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    80
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    81
    MethodHandle makeInstance(MethodHandle target) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    82
        MethodType type = target.type();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    83
        if (type != targetType) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    84
            throw new UnsupportedOperationException("NYI type="+type);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    85
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    86
        return adapter.makeInstance(this, target);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    87
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    88
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    89
    /** Build an adapter of the given generic type, which invokes typedTarget
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    90
     *  on the incoming arguments, after unboxing as necessary.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    91
     *  The return value is boxed if necessary.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    92
     * @param genericType  the required type of the result
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    93
     * @param typedTarget the target
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    94
     * @return an adapter method handle
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    95
     */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    96
    public static MethodHandle make(MethodHandle target, int spreadCount) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    97
        MethodType type = target.type();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    98
        MethodType gtype = type.generic();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
    99
        if (type == gtype) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   100
            return SpreadGeneric.of(type, spreadCount).makeInstance(target);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   101
        } else {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   102
            MethodHandle gtarget = FromGeneric.make(target);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   103
            assert(gtarget.type() == gtype);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   104
            MethodHandle gspread = SpreadGeneric.of(gtype, spreadCount).makeInstance(gtarget);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   105
            return ToGeneric.make(preSpreadType(type, spreadCount), gspread);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   106
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   107
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   108
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   109
    /** Return the adapter information for this type's erasure. */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   110
    static SpreadGeneric of(MethodType targetType, int spreadCount) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   111
        if (targetType != targetType.generic())
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   112
            throw new UnsupportedOperationException("NYI type="+targetType);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   113
        MethodTypeImpl form = MethodTypeImpl.of(targetType);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   114
        int outcount = form.parameterCount();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   115
        assert(spreadCount <= outcount);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   116
        SpreadGeneric[] spreadGens = form.spreadGeneric;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   117
        if (spreadGens == null)
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   118
            form.spreadGeneric = spreadGens = new SpreadGeneric[outcount+1];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   119
        SpreadGeneric spreadGen = spreadGens[spreadCount];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   120
        if (spreadGen == null)
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   121
            spreadGens[spreadCount] = spreadGen = new SpreadGeneric(form.erasedType(), spreadCount);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   122
        return spreadGen;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   123
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   124
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   125
    public String toString() {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   126
        return getClass().getSimpleName()+targetType+"["+spreadCount+"]";
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   127
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   128
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   129
    // This mini-api is called from an Adapter to manage the spread.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   130
    /** A check/coercion that happens once before any selections. */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   131
    protected Object check(Object av, int n) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   132
        MethodHandleImpl.checkSpreadArgument(av, n);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   133
        return av;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   134
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   135
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   136
    /** The selection operator for spreading; note that it takes Object not Object[]. */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   137
    protected Object select(Object av, int n) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   138
        return ((Object[])av)[n];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   139
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   140
    /*
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   141
    protected int select_I(Object av, int n) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   142
        // maybe return ((int[])select)[n]
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   143
        throw new UnsupportedOperationException("subclass resp.");
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   144
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   145
    protected int select_J(Object av, int n) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   146
        // maybe return ((long[])select)[n]
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   147
        throw new UnsupportedOperationException("subclass resp.");
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   148
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   149
    // */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   150
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   151
    /* Create an adapter that handles spreading calls for the given type. */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   152
    static Adapter findAdapter(SpreadGeneric outer, MethodHandle[] ep) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   153
        MethodType targetType = outer.targetType;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   154
        int spreadCount = outer.spreadCount;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   155
        int outargs = targetType.parameterCount();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   156
        int inargs = outargs - spreadCount;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   157
        if (inargs < 0)  return null;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   158
        MethodType entryType = MethodType.genericMethodType(inargs + 1); // 1 for av
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   159
        String cname1 = "S" + outargs;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   160
        String[] cnames = { cname1 };
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   161
        String iname = "invoke_S"+spreadCount;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   162
        // e.g., D5I2, D5, L5I2, L5; invoke_D5
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   163
        for (String cname : cnames) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   164
            Class<? extends Adapter> acls = Adapter.findSubClass(cname);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   165
            if (acls == null)  continue;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   166
            // see if it has the required invoke method
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   167
            MethodHandle entryPoint = null;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   168
            try {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   169
                entryPoint = MethodHandleImpl.IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   170
            } catch (NoAccessException ex) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   171
            }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   172
            if (entryPoint == null)  continue;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   173
            Constructor<? extends Adapter> ctor = null;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   174
            try {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   175
                ctor = acls.getDeclaredConstructor(SpreadGeneric.class);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   176
            } catch (NoSuchMethodException ex) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   177
            } catch (SecurityException ex) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   178
            }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   179
            if (ctor == null)  continue;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   180
            try {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   181
                // Produce an instance configured as a prototype.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   182
                Adapter ad = ctor.newInstance(outer);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   183
                ep[0] = entryPoint;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   184
                return ad;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   185
            } catch (IllegalArgumentException ex) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   186
            } catch (InvocationTargetException wex) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   187
                Throwable ex = wex.getTargetException();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   188
                if (ex instanceof Error)  throw (Error)ex;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   189
                if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   190
            } catch (InstantiationException ex) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   191
            } catch (IllegalAccessException ex) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   192
            }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   193
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   194
        return null;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   195
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   196
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   197
    static Adapter buildAdapterFromBytecodes(MethodType targetType,
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   198
            int spreadCount, MethodHandle[] ep) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   199
        throw new UnsupportedOperationException("NYI");
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   200
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   201
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   202
    /**
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   203
     * This adapter takes some untyped arguments, and returns an untyped result.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   204
     * Internally, it applies the invoker to the target, which causes the
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   205
     * objects to be unboxed; the result is a raw type in L/I/J/F/D.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   206
     * This result is passed to convert, which is responsible for
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   207
     * converting the raw result into a boxed object.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   208
     * The invoker is kept separate from the target because it can be
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   209
     * generated once per type erasure family, and reused across adapters.
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   210
     */
7555
a279ebc3b25c 6981777: implement JSR 292 EG adjustments from summer 2010
jrose
parents: 7052
diff changeset
   211
    static abstract class Adapter extends BoundMethodHandle {
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   212
        /*
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   213
         * class X<<R,int M,int N>> extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   214
         *   (Object**N)=>R target;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   215
         *   static int S = N-M;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   216
         *   Object invoke(Object**M a, Object v) = target(a..., v[0]...v[S-1]);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   217
         * }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   218
         */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   219
        protected final SpreadGeneric outer;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   220
        protected final MethodHandle target;   // (any**N) => R
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   221
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   222
        @Override
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   223
        public String toString() {
7555
a279ebc3b25c 6981777: implement JSR 292 EG adjustments from summer 2010
jrose
parents: 7052
diff changeset
   224
            return MethodHandleImpl.addTypeString(target, this);
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   225
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   226
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   227
        static final MethodHandle NO_ENTRY = ValueConversions.identity();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   228
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   229
        protected boolean isPrototype() { return target == null; }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   230
        protected Adapter(SpreadGeneric outer) {
7555
a279ebc3b25c 6981777: implement JSR 292 EG adjustments from summer 2010
jrose
parents: 7052
diff changeset
   231
            super(Access.TOKEN, NO_ENTRY);
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   232
            this.outer = outer;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   233
            this.target = null;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   234
            assert(isPrototype());
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   235
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   236
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   237
        protected Adapter(SpreadGeneric outer, MethodHandle target) {
7555
a279ebc3b25c 6981777: implement JSR 292 EG adjustments from summer 2010
jrose
parents: 7052
diff changeset
   238
            super(Access.TOKEN, outer.entryPoint);
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   239
            this.outer = outer;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   240
            this.target = target;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   241
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   242
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   243
        /** Make a copy of self, with new fields. */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   244
        protected abstract Adapter makeInstance(SpreadGeneric outer, MethodHandle target);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   245
        // { return new ThisType(outer, target); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   246
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   247
        protected Object check(Object av, int n) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   248
            return outer.check(av, n);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   249
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   250
        protected Object select(Object av, int n) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   251
            return outer.select(av, n);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   252
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   253
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   254
        static private final String CLASS_PREFIX; // "sun.dyn.SpreadGeneric$"
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   255
        static {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   256
            String aname = Adapter.class.getName();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   257
            String sname = Adapter.class.getSimpleName();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   258
            if (!aname.endsWith(sname))  throw new InternalError();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   259
            CLASS_PREFIX = aname.substring(0, aname.length() - sname.length());
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   260
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   261
        /** Find a sibing class of Adapter. */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   262
        static Class<? extends Adapter> findSubClass(String name) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   263
            String cname = Adapter.CLASS_PREFIX + name;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   264
            try {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   265
                return Class.forName(cname).asSubclass(Adapter.class);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   266
            } catch (ClassNotFoundException ex) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   267
                return null;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   268
            } catch (ClassCastException ex) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   269
                return null;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   270
            }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   271
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   272
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   273
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   274
    /* generated classes follow this pattern:
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   275
    static class xS2 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   276
        protected xS2(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   277
        protected xS2(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   278
        protected xS2 makeInstance(SpreadGeneric outer, MethodHandle t) { return new xS2(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   279
        protected Object invoke_S0(Object a0, Object a1, Object av) throws Throwable { av = super.check(av,0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   280
             return target.invokeExact(a0, a1)); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   281
        protected Object invoke_S1(Object a0, Object av) throws Throwable { av = super.check(av,1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   282
             return target.invokeExact(a0,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   283
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   284
        protected Object invoke_S2(Object a0, Object av) throws Throwable { av = super.check(av,1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   285
             return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   286
                super.select(av,0), super.select(av,1)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   287
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   288
    // */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   289
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   290
/*
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   291
: SHELL; n=SpreadGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -cp . genclasses) >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   292
//{{{
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   293
import java.util.*;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   294
class genclasses {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   295
    static String[][] TEMPLATES = { {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   296
        "@for@ N=0..10",
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   297
        "    //@each-cat@",
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   298
        "    static class @cat@ extends Adapter {",
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   299
        "        protected @cat@(SpreadGeneric outer) { super(outer); }  // to build prototype",
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   300
        "        protected @cat@(SpreadGeneric outer, MethodHandle t) { super(outer, t); }",
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   301
        "        protected @cat@ makeInstance(SpreadGeneric outer, MethodHandle t) { return new @cat@(outer, t); }",
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   302
        "        protected Object invoke_S0(@Tvav,@Object av) throws Throwable { av = super.check(av, 0);",
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   303
        "            return target.invokeExact(@av@); }",
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   304
        "        //@each-S@",
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   305
        "        protected Object invoke_S@S@(@Tvav,@Object av) throws Throwable { av = super.check(av, @S@);",
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   306
        "            return target.invokeExact(@av,@@sv@); }",
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   307
        "        //@end-S@",
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   308
        "    }",
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   309
    } };
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   310
    static final String NEWLINE_INDENT = "\n                ";
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   311
    enum VAR {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   312
        cat, N, S, av, av_, Tvav_, sv;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   313
        public final String pattern = "@"+toString().replace('_','.')+"@";
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   314
        public String binding = toString();
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   315
        static void makeBindings(boolean topLevel, int outargs, int spread) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   316
            int inargs = outargs - spread;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   317
            VAR.cat.binding = "S"+outargs;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   318
            VAR.N.binding = String.valueOf(outargs); // outgoing arg count
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   319
            VAR.S.binding = String.valueOf(spread);  // spread count
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   320
            String[] av = new String[inargs];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   321
            String[] Tvav = new String[inargs];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   322
            for (int i = 0; i < inargs; i++) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   323
                av[i] = arg(i);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   324
                Tvav[i] = param("Object", av[i]);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   325
            }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   326
            VAR.av.binding = comma(av);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   327
            VAR.av_.binding = comma(av, ", ");
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   328
            VAR.Tvav_.binding = comma(Tvav, ", ");
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   329
            String[] sv = new String[spread];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   330
            for (int i = 0; i < spread; i++) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   331
                String spc = "";
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   332
                if (i % 4 == 0) spc = NEWLINE_INDENT;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   333
                sv[i] = spc+"super.select(av,"+i+")";
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   334
            }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   335
            VAR.sv.binding = comma(sv);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   336
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   337
        static String arg(int i) { return "a"+i; }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   338
        static String param(String t, String a) { return t+" "+a; }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   339
        static String comma(String[] v) { return comma(v, ""); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   340
        static String comma(String[] v, String sep) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   341
            if (v.length == 0)  return "";
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   342
            String res = v[0];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   343
            for (int i = 1; i < v.length; i++)  res += ", "+v[i];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   344
            return res + sep;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   345
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   346
        static String transform(String string) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   347
            for (VAR var : values())
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   348
                string = string.replaceAll(var.pattern, var.binding);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   349
            return string;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   350
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   351
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   352
    static String[] stringsIn(String[] strings, int beg, int end) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   353
        return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length));
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   354
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   355
    static String[] stringsBefore(String[] strings, int pos) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   356
        return stringsIn(strings, 0, pos);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   357
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   358
    static String[] stringsAfter(String[] strings, int pos) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   359
        return stringsIn(strings, pos, strings.length);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   360
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   361
    static int indexAfter(String[] strings, int pos, String tag) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   362
        return Math.min(indexBefore(strings, pos, tag) + 1, strings.length);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   363
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   364
    static int indexBefore(String[] strings, int pos, String tag) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   365
        for (int i = pos, end = strings.length; ; i++) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   366
            if (i == end || strings[i].endsWith(tag))  return i;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   367
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   368
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   369
    static int MIN_ARITY, MAX_ARITY;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   370
    public static void main(String... av) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   371
        for (String[] template : TEMPLATES) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   372
            int forLinesLimit = indexBefore(template, 0, "@each-cat@");
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   373
            String[] forLines = stringsBefore(template, forLinesLimit);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   374
            template = stringsAfter(template, forLinesLimit);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   375
            for (String forLine : forLines)
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   376
                expandTemplate(forLine, template);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   377
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   378
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   379
    static void expandTemplate(String forLine, String[] template) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   380
        String[] params = forLine.split("[^0-9]+");
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   381
        if (params[0].length() == 0)  params = stringsAfter(params, 1);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   382
        System.out.println("//params="+Arrays.asList(params));
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   383
        int pcur = 0;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   384
        MIN_ARITY = Integer.valueOf(params[pcur++]);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   385
        MAX_ARITY = Integer.valueOf(params[pcur++]);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   386
        if (pcur != params.length)  throw new RuntimeException("bad extra param: "+forLine);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   387
        for (int outargs = MIN_ARITY; outargs <= MAX_ARITY; outargs++) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   388
            expandTemplate(template, true, outargs, 0);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   389
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   390
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   391
    static void expandTemplate(String[] template, boolean topLevel, int outargs, int spread) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   392
        VAR.makeBindings(topLevel, outargs, spread);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   393
        for (int i = 0; i < template.length; i++) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   394
            String line = template[i];
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   395
            if (line.endsWith("@each-cat@")) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   396
                // ignore
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   397
            } else if (line.endsWith("@each-S@")) {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   398
                int blockEnd = indexAfter(template, i, "@end-S@");
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   399
                String[] block = stringsIn(template, i+1, blockEnd-1);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   400
                for (int spread1 = spread+1; spread1 <= outargs; spread1++)
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   401
                    expandTemplate(block, false, outargs, spread1);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   402
                VAR.makeBindings(topLevel, outargs, spread);
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   403
                i = blockEnd-1; continue;
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   404
            } else {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   405
                System.out.println(VAR.transform(line));
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   406
            }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   407
        }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   408
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   409
}
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   410
//}}} */
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   411
//params=[0, 10]
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   412
    static class S0 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   413
        protected S0(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   414
        protected S0(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   415
        protected S0 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S0(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   416
        protected Object invoke_S0(Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   417
            return target.invokeExact(); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   418
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   419
    static class S1 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   420
        protected S1(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   421
        protected S1(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   422
        protected S1 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S1(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   423
        protected Object invoke_S0(Object a0, Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   424
            return target.invokeExact(a0); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   425
        protected Object invoke_S1(Object av) throws Throwable { av = super.check(av, 1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   426
            return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   427
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   428
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   429
    static class S2 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   430
        protected S2(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   431
        protected S2(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   432
        protected S2 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S2(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   433
        protected Object invoke_S0(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   434
            return target.invokeExact(a0, a1); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   435
        protected Object invoke_S1(Object a0, Object av) throws Throwable { av = super.check(av, 1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   436
            return target.invokeExact(a0,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   437
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   438
        protected Object invoke_S2(Object av) throws Throwable { av = super.check(av, 2);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   439
            return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   440
                super.select(av,0), super.select(av,1)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   441
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   442
    static class S3 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   443
        protected S3(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   444
        protected S3(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   445
        protected S3 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S3(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   446
        protected Object invoke_S0(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   447
            return target.invokeExact(a0, a1, a2); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   448
        protected Object invoke_S1(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   449
            return target.invokeExact(a0, a1,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   450
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   451
        protected Object invoke_S2(Object a0, Object av) throws Throwable { av = super.check(av, 2);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   452
            return target.invokeExact(a0,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   453
                super.select(av,0), super.select(av,1)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   454
        protected Object invoke_S3(Object av) throws Throwable { av = super.check(av, 3);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   455
            return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   456
                super.select(av,0), super.select(av,1), super.select(av,2)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   457
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   458
    static class S4 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   459
        protected S4(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   460
        protected S4(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   461
        protected S4 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S4(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   462
        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   463
            return target.invokeExact(a0, a1, a2, a3); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   464
        protected Object invoke_S1(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   465
            return target.invokeExact(a0, a1, a2,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   466
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   467
        protected Object invoke_S2(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 2);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   468
            return target.invokeExact(a0, a1,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   469
                super.select(av,0), super.select(av,1)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   470
        protected Object invoke_S3(Object a0, Object av) throws Throwable { av = super.check(av, 3);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   471
            return target.invokeExact(a0,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   472
                super.select(av,0), super.select(av,1), super.select(av,2)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   473
        protected Object invoke_S4(Object av) throws Throwable { av = super.check(av, 4);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   474
            return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   475
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   476
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   477
    static class S5 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   478
        protected S5(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   479
        protected S5(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   480
        protected S5 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S5(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   481
        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   482
            return target.invokeExact(a0, a1, a2, a3, a4); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   483
        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   484
            return target.invokeExact(a0, a1, a2, a3,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   485
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   486
        protected Object invoke_S2(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 2);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   487
            return target.invokeExact(a0, a1, a2,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   488
                super.select(av,0), super.select(av,1)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   489
        protected Object invoke_S3(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 3);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   490
            return target.invokeExact(a0, a1,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   491
                super.select(av,0), super.select(av,1), super.select(av,2)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   492
        protected Object invoke_S4(Object a0, Object av) throws Throwable { av = super.check(av, 4);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   493
            return target.invokeExact(a0,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   494
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   495
        protected Object invoke_S5(Object av) throws Throwable { av = super.check(av, 5);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   496
            return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   497
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   498
                super.select(av,4)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   499
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   500
    static class S6 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   501
        protected S6(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   502
        protected S6(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   503
        protected S6 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S6(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   504
        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   505
            return target.invokeExact(a0, a1, a2, a3, a4, a5); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   506
        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   507
            return target.invokeExact(a0, a1, a2, a3, a4,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   508
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   509
        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 2);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   510
            return target.invokeExact(a0, a1, a2, a3,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   511
                super.select(av,0), super.select(av,1)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   512
        protected Object invoke_S3(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 3);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   513
            return target.invokeExact(a0, a1, a2,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   514
                super.select(av,0), super.select(av,1), super.select(av,2)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   515
        protected Object invoke_S4(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 4);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   516
            return target.invokeExact(a0, a1,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   517
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   518
        protected Object invoke_S5(Object a0, Object av) throws Throwable { av = super.check(av, 5);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   519
            return target.invokeExact(a0,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   520
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   521
                super.select(av,4)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   522
        protected Object invoke_S6(Object av) throws Throwable { av = super.check(av, 6);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   523
            return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   524
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   525
                super.select(av,4), super.select(av,5)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   526
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   527
    static class S7 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   528
        protected S7(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   529
        protected S7(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   530
        protected S7 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S7(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   531
        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   532
            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   533
        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   534
            return target.invokeExact(a0, a1, a2, a3, a4, a5,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   535
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   536
        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 2);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   537
            return target.invokeExact(a0, a1, a2, a3, a4,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   538
                super.select(av,0), super.select(av,1)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   539
        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 3);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   540
            return target.invokeExact(a0, a1, a2, a3,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   541
                super.select(av,0), super.select(av,1), super.select(av,2)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   542
        protected Object invoke_S4(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 4);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   543
            return target.invokeExact(a0, a1, a2,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   544
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   545
        protected Object invoke_S5(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 5);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   546
            return target.invokeExact(a0, a1,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   547
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   548
                super.select(av,4)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   549
        protected Object invoke_S6(Object a0, Object av) throws Throwable { av = super.check(av, 6);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   550
            return target.invokeExact(a0,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   551
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   552
                super.select(av,4), super.select(av,5)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   553
        protected Object invoke_S7(Object av) throws Throwable { av = super.check(av, 7);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   554
            return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   555
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   556
                super.select(av,4), super.select(av,5), super.select(av,6)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   557
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   558
    static class S8 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   559
        protected S8(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   560
        protected S8(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   561
        protected S8 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S8(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   562
        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   563
            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   564
        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   565
            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   566
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   567
        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 2);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   568
            return target.invokeExact(a0, a1, a2, a3, a4, a5,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   569
                super.select(av,0), super.select(av,1)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   570
        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 3);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   571
            return target.invokeExact(a0, a1, a2, a3, a4,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   572
                super.select(av,0), super.select(av,1), super.select(av,2)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   573
        protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 4);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   574
            return target.invokeExact(a0, a1, a2, a3,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   575
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   576
        protected Object invoke_S5(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 5);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   577
            return target.invokeExact(a0, a1, a2,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   578
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   579
                super.select(av,4)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   580
        protected Object invoke_S6(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 6);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   581
            return target.invokeExact(a0, a1,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   582
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   583
                super.select(av,4), super.select(av,5)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   584
        protected Object invoke_S7(Object a0, Object av) throws Throwable { av = super.check(av, 7);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   585
            return target.invokeExact(a0,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   586
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   587
                super.select(av,4), super.select(av,5), super.select(av,6)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   588
        protected Object invoke_S8(Object av) throws Throwable { av = super.check(av, 8);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   589
            return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   590
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   591
                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   592
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   593
    static class S9 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   594
        protected S9(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   595
        protected S9(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   596
        protected S9 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S9(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   597
        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   598
            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   599
        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   600
            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   601
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   602
        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 2);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   603
            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   604
                super.select(av,0), super.select(av,1)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   605
        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 3);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   606
            return target.invokeExact(a0, a1, a2, a3, a4, a5,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   607
                super.select(av,0), super.select(av,1), super.select(av,2)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   608
        protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 4);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   609
            return target.invokeExact(a0, a1, a2, a3, a4,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   610
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   611
        protected Object invoke_S5(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 5);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   612
            return target.invokeExact(a0, a1, a2, a3,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   613
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   614
                super.select(av,4)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   615
        protected Object invoke_S6(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 6);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   616
            return target.invokeExact(a0, a1, a2,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   617
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   618
                super.select(av,4), super.select(av,5)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   619
        protected Object invoke_S7(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 7);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   620
            return target.invokeExact(a0, a1,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   621
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   622
                super.select(av,4), super.select(av,5), super.select(av,6)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   623
        protected Object invoke_S8(Object a0, Object av) throws Throwable { av = super.check(av, 8);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   624
            return target.invokeExact(a0,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   625
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   626
                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   627
        protected Object invoke_S9(Object av) throws Throwable { av = super.check(av, 9);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   628
            return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   629
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   630
                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   631
                super.select(av,8)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   632
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   633
    static class S10 extends Adapter {
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   634
        protected S10(SpreadGeneric outer) { super(outer); }  // to build prototype
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   635
        protected S10(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   636
        protected S10 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S10(outer, t); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   637
        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9, Object av) throws Throwable { av = super.check(av, 0);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   638
            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   639
        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object av) throws Throwable { av = super.check(av, 1);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   640
            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   641
                super.select(av,0)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   642
        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 2);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   643
            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   644
                super.select(av,0), super.select(av,1)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   645
        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 3);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   646
            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   647
                super.select(av,0), super.select(av,1), super.select(av,2)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   648
        protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 4);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   649
            return target.invokeExact(a0, a1, a2, a3, a4, a5,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   650
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   651
        protected Object invoke_S5(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 5);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   652
            return target.invokeExact(a0, a1, a2, a3, a4,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   653
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   654
                super.select(av,4)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   655
        protected Object invoke_S6(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 6);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   656
            return target.invokeExact(a0, a1, a2, a3,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   657
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   658
                super.select(av,4), super.select(av,5)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   659
        protected Object invoke_S7(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 7);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   660
            return target.invokeExact(a0, a1, a2,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   661
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   662
                super.select(av,4), super.select(av,5), super.select(av,6)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   663
        protected Object invoke_S8(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 8);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   664
            return target.invokeExact(a0, a1,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   665
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   666
                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   667
        protected Object invoke_S9(Object a0, Object av) throws Throwable { av = super.check(av, 9);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   668
            return target.invokeExact(a0,
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   669
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   670
                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   671
                super.select(av,8)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   672
        protected Object invoke_S10(Object av) throws Throwable { av = super.check(av, 10);
7556
4a5711d43948 6979327: method handle invocation should use casts instead of type parameters to specify return type
jrose
parents: 7555
diff changeset
   673
            return target.invokeExact(
4537
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   674
                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   675
                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7),
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   676
                super.select(av,8), super.select(av,9)); }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   677
    }
7c3c7f8d5195 6914665: update jdk code for JSR 292 (post 6858164)
jrose
parents:
diff changeset
   678
}