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

Print this page
rev 17771 : 8184777: species logic for BoundMethodHandle doesn't scale, needs refactor

*** 299,309 **** Name[] names = arguments(nameCursor - INARG_LIMIT, invokerFormType); assert(names.length == nameCursor) : Arrays.asList(mtype, customized, which, nameCursor, names.length); if (MTYPE_ARG >= INARG_LIMIT) { assert(names[MTYPE_ARG] == null); ! BoundMethodHandle.SpeciesData speciesData = BoundMethodHandle.speciesData_L(); names[THIS_MH] = names[THIS_MH].withConstraint(speciesData); NamedFunction getter = speciesData.getterFunction(0); names[MTYPE_ARG] = new Name(getter, names[THIS_MH]); // else if isLinker, then MTYPE is passed in from the caller (e.g., the JVM) } --- 299,309 ---- Name[] names = arguments(nameCursor - INARG_LIMIT, invokerFormType); assert(names.length == nameCursor) : Arrays.asList(mtype, customized, which, nameCursor, names.length); if (MTYPE_ARG >= INARG_LIMIT) { assert(names[MTYPE_ARG] == null); ! BoundMethodHandle.BMHSpecies speciesData = BoundMethodHandle.speciesData_L(); names[THIS_MH] = names[THIS_MH].withConstraint(speciesData); NamedFunction getter = speciesData.getterFunction(0); names[MTYPE_ARG] = new Name(getter, names[THIS_MH]); // else if isLinker, then MTYPE is passed in from the caller (e.g., the JVM) }
*** 411,421 **** names[CALL_VH] = argument(CALL_VH, BasicType.basicType(Object.class)); for (int i = 0; i < mtype.parameterCount(); i++) { names[ARG_BASE + i] = argument(ARG_BASE + i, BasicType.basicType(mtype.parameterType(i))); } ! BoundMethodHandle.SpeciesData speciesData = BoundMethodHandle.speciesData_L(); names[THIS_MH] = names[THIS_MH].withConstraint(speciesData); NamedFunction getter = speciesData.getterFunction(0); names[VAD_ARG] = new Name(getter, names[THIS_MH]); --- 411,421 ---- names[CALL_VH] = argument(CALL_VH, BasicType.basicType(Object.class)); for (int i = 0; i < mtype.parameterCount(); i++) { names[ARG_BASE + i] = argument(ARG_BASE + i, BasicType.basicType(mtype.parameterType(i))); } ! BoundMethodHandle.BMHSpecies speciesData = BoundMethodHandle.speciesData_L(); names[THIS_MH] = names[THIS_MH].withConstraint(speciesData); NamedFunction getter = speciesData.getterFunction(0); names[VAD_ARG] = new Name(getter, names[THIS_MH]);