Path: blob/master/src/java.base/share/classes/jdk/internal/access/JavaLangInvokeAccess.java
41159 views
/*1* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package jdk.internal.access;2627import jdk.internal.invoke.NativeEntryPoint;2829import java.lang.invoke.MethodHandle;30import java.lang.invoke.MethodType;31import java.lang.invoke.VarHandle;32import java.nio.ByteOrder;33import java.util.List;34import java.util.Map;35import java.util.stream.Stream;3637public interface JavaLangInvokeAccess {38/**39* Create a new MemberName instance. Used by {@code StackFrameInfo}.40*/41Object newMemberName();4243/**44* Returns the name for the given MemberName. Used by {@code StackFrameInfo}.45*/46String getName(Object mname);4748/**49* Returns the {@code MethodType} for the given MemberName.50* Used by {@code StackFrameInfo}.51*/52MethodType getMethodType(Object mname);5354/**55* Returns the descriptor for the given MemberName.56* Used by {@code StackFrameInfo}.57*/58String getMethodDescriptor(Object mname);5960/**61* Returns {@code true} if the given MemberName is a native method.62* Used by {@code StackFrameInfo}.63*/64boolean isNative(Object mname);6566/**67* Returns the declaring class for the given MemberName.68* Used by {@code StackFrameInfo}.69*/70Class<?> getDeclaringClass(Object mname);7172/**73* Returns a map of class name in internal forms to its corresponding74* class bytes per the given stream of LF_RESOLVE and SPECIES_RESOLVE75* trace logs. Used by GenerateJLIClassesPlugin to enable generation76* of such classes during the jlink phase.77*/78Map<String, byte[]> generateHolderClasses(Stream<String> traces);7980/**81* Returns a var handle view of a given memory address.82* Used by {@code jdk.internal.foreign.LayoutPath} and83* {@code jdk.incubator.foreign.MemoryHandles}.84*/85VarHandle memoryAccessVarHandle(Class<?> carrier, boolean skipAlignmentMaskCheck, long alignmentMask,86ByteOrder order);8788/**89* Var handle carrier combinator.90* Used by {@code jdk.incubator.foreign.MemoryHandles}.91*/92VarHandle filterValue(VarHandle target, MethodHandle filterToTarget, MethodHandle filterFromTarget);9394/**95* Var handle filter coordinates combinator.96* Used by {@code jdk.incubator.foreign.MemoryHandles}.97*/98VarHandle filterCoordinates(VarHandle target, int pos, MethodHandle... filters);99100/**101* Var handle drop coordinates combinator.102* Used by {@code jdk.incubator.foreign.MemoryHandles}.103*/104VarHandle dropCoordinates(VarHandle target, int pos, Class<?>... valueTypes);105106/**107* Var handle permute coordinates combinator.108* Used by {@code jdk.incubator.foreign.MemoryHandles}.109*/110VarHandle permuteCoordinates(VarHandle target, List<Class<?>> newCoordinates, int... reorder);111112/**113* Var handle collect coordinates combinator.114* Used by {@code jdk.incubator.foreign.MemoryHandles}.115*/116VarHandle collectCoordinates(VarHandle target, int pos, MethodHandle filter);117118/**119* Var handle insert coordinates combinator.120* Used by {@code jdk.incubator.foreign.MemoryHandles}.121*/122VarHandle insertCoordinates(VarHandle target, int pos, Object... values);123124/**125* Returns a native method handle with given arguments as fallback and steering info.126*127* Will allow JIT to intrinsify.128*129* @param nep the native entry point130* @param fallback the fallback handle131* @return the native method handle132*/133MethodHandle nativeMethodHandle(NativeEntryPoint nep, MethodHandle fallback);134135/**136* Ensure given method handle is customized137*138* @param mh the method handle139*/140void ensureCustomized(MethodHandle mh);141}142143144