Path: blob/master/jcl/src/java.base/share/classes/java/lang/invoke/Insert1Handle.java
12520 views
/*[INCLUDE-IF Sidecar17 & !OPENJDK_METHODHANDLES]*/1/*******************************************************************************2* Copyright (c) 2011, 2020 IBM Corp. and others3*4* This program and the accompanying materials are made available under5* the terms of the Eclipse Public License 2.0 which accompanies this6* distribution and is available at https://www.eclipse.org/legal/epl-2.0/7* or the Apache License, Version 2.0 which accompanies this distribution and8* is available at https://www.apache.org/licenses/LICENSE-2.0.9*10* This Source Code may also be made available under the following11* Secondary Licenses when the conditions for such availability set12* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU13* General Public License, version 2 with the GNU Classpath14* Exception [1] and GNU General Public License, version 2 with the15* OpenJDK Assembly Exception [2].16*17* [1] https://www.gnu.org/software/classpath/license.html18* [2] http://openjdk.java.net/legal/assembly-exception.html19*20* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception21*******************************************************************************/22package java.lang.invoke;2324final class Insert1Handle extends InsertHandle {25final Object value;2627Insert1Handle(MethodType type, MethodHandle next, int insertionIndex, Object values[]) {28super(type, next, insertionIndex, values);29this.value = values[0];30}3132Insert1Handle(Insert1Handle originalHandle, MethodType nextType) {33super(originalHandle, nextType);34this.value = originalHandle.value;35}3637// {{{ JIT support38private static final ThunkTable _thunkTable = new ThunkTable();39protected final ThunkTable thunkTable(){ return _thunkTable; }4041protected final ThunkTuple computeThunks(Object arg) {42int[] info = (int[])arg;43return thunkTable().get(new ThunkKeyWithIntArray(ThunkKey.computeThunkableType(type()), info));44}4546@FrameIteratorSkip47private final int invokeExact_thunkArchetype_X(int argPlaceholder) {48if (ILGenMacros.isShareableThunk()) {49undoCustomizationLogic(next);50}51if (!ILGenMacros.isCustomThunk()) {52doCustomizationLogic();53}54return ILGenMacros.invokeExact_X(next, ILGenMacros.placeholder(55ILGenMacros.firstN(numPrefixArgs(), argPlaceholder),56value,57ILGenMacros.lastN(numSuffixArgs(), argPlaceholder)));58}5960// }}} JIT support6162@Override63MethodHandle cloneWithNewType(MethodType newType) {64return new Insert1Handle(this, newType);65}66}67686970