8161379: Force inline methods calling Reflection.getCallerClass
Reviewed-by: shade, mchung
This commit is contained in:
parent
f154b67d33
commit
8cf37c5448
@ -70,6 +70,7 @@ import jdk.internal.reflect.CallerSensitive;
|
||||
import jdk.internal.reflect.ConstantPool;
|
||||
import jdk.internal.reflect.Reflection;
|
||||
import jdk.internal.reflect.ReflectionFactory;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import sun.reflect.generics.factory.CoreReflectionFactory;
|
||||
import sun.reflect.generics.factory.GenericsFactory;
|
||||
import sun.reflect.generics.repository.ClassRepository;
|
||||
@ -802,6 +803,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
* @see java.lang.RuntimePermission
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public ClassLoader getClassLoader() {
|
||||
ClassLoader cl = getClassLoader0();
|
||||
if (cl == null)
|
||||
|
@ -30,6 +30,7 @@ import jdk.internal.org.objectweb.asm.ClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.MethodVisitor;
|
||||
import jdk.internal.reflect.CallerSensitive;
|
||||
import jdk.internal.reflect.Reflection;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
import sun.invoke.empty.Empty;
|
||||
import sun.invoke.util.ValueConversions;
|
||||
@ -44,7 +45,6 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.lang.invoke.LambdaForm.*;
|
||||
@ -1246,6 +1246,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
}
|
||||
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
private static boolean checkCallerClass(Class<?> expected) {
|
||||
// This method is called via MH_checkCallerClass and so it's correct to ask for the immediate caller here.
|
||||
Class<?> actual = Reflection.getCallerClass();
|
||||
|
@ -29,6 +29,7 @@ import jdk.internal.org.objectweb.asm.ClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.Opcodes;
|
||||
import jdk.internal.reflect.CallerSensitive;
|
||||
import jdk.internal.reflect.Reflection;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import sun.invoke.util.ValueConversions;
|
||||
import sun.invoke.util.VerifyAccess;
|
||||
import sun.invoke.util.Wrapper;
|
||||
@ -104,6 +105,7 @@ public class MethodHandles {
|
||||
* @return a lookup object for the caller of this method, with private access
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public static Lookup lookup() {
|
||||
return new Lookup(Reflection.getCallerClass());
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.reflect.CallerSensitive;
|
||||
import jdk.internal.reflect.ConstructorAccessor;
|
||||
import jdk.internal.reflect.Reflection;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import sun.reflect.annotation.TypeAnnotation;
|
||||
import sun.reflect.annotation.TypeAnnotationParser;
|
||||
import sun.reflect.generics.repository.ConstructorRepository;
|
||||
@ -435,6 +436,7 @@ public final class Constructor<T> extends Executable {
|
||||
* by this method fails.
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public T newInstance(Object ... initargs)
|
||||
throws InstantiationException, IllegalAccessException,
|
||||
IllegalArgumentException, InvocationTargetException
|
||||
|
@ -29,6 +29,7 @@ import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.reflect.CallerSensitive;
|
||||
import jdk.internal.reflect.FieldAccessor;
|
||||
import jdk.internal.reflect.Reflection;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import sun.reflect.generics.repository.FieldRepository;
|
||||
import sun.reflect.generics.factory.CoreReflectionFactory;
|
||||
import sun.reflect.generics.factory.GenericsFactory;
|
||||
@ -396,6 +397,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* by this method fails.
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public Object get(Object obj)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -429,6 +431,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#get
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public boolean getBoolean(Object obj)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -462,6 +465,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#get
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public byte getByte(Object obj)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -497,6 +501,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#get
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public char getChar(Object obj)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -532,6 +537,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#get
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public short getShort(Object obj)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -567,6 +573,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#get
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public int getInt(Object obj)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -602,6 +609,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#get
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public long getLong(Object obj)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -637,6 +645,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#get
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public float getFloat(Object obj)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -672,6 +681,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#get
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public double getDouble(Object obj)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -749,6 +759,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* by this method fails.
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public void set(Object obj, Object value)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -784,6 +795,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#set
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public void setBoolean(Object obj, boolean z)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -819,6 +831,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#set
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public void setByte(Object obj, byte b)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -854,6 +867,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#set
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public void setChar(Object obj, char c)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -889,6 +903,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#set
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public void setShort(Object obj, short s)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -924,6 +939,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#set
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public void setInt(Object obj, int i)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -959,6 +975,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#set
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public void setLong(Object obj, long l)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -994,6 +1011,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#set
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public void setFloat(Object obj, float f)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
@ -1029,6 +1047,7 @@ class Field extends AccessibleObject implements Member {
|
||||
* @see Field#set
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
public void setDouble(Object obj, double d)
|
||||
throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
|
@ -30,6 +30,7 @@ import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.reflect.CallerSensitive;
|
||||
import jdk.internal.reflect.MethodAccessor;
|
||||
import jdk.internal.reflect.Reflection;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import sun.reflect.annotation.ExceptionProxy;
|
||||
import sun.reflect.annotation.TypeNotPresentExceptionProxy;
|
||||
import sun.reflect.generics.repository.MethodRepository;
|
||||
@ -517,6 +518,7 @@ public final class Method extends Executable {
|
||||
* provoked by this method fails.
|
||||
*/
|
||||
@CallerSensitive
|
||||
@ForceInline // to ensure Reflection.getCallerClass optimization
|
||||
@HotSpotIntrinsicCandidate
|
||||
public Object invoke(Object obj, Object... args)
|
||||
throws IllegalAccessException, IllegalArgumentException,
|
||||
|
Loading…
x
Reference in New Issue
Block a user