< prev index next >
src/java.base/share/classes/java/lang/invoke/Invokers.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 303,315 ****
}
/** Static definition of MethodHandle.invokeExact checking code. */
/*non-public*/ static
@ForceInline
! void checkExactType(Object mhObj, Object expectedObj) {
! MethodHandle mh = (MethodHandle) mhObj;
! MethodType expected = (MethodType) expectedObj;
MethodType actual = mh.type();
if (actual != expected)
throw newWrongMethodTypeException(expected, actual);
}
--- 303,313 ----
}
/** Static definition of MethodHandle.invokeExact checking code. */
/*non-public*/ static
@ForceInline
! void checkExactType(MethodHandle mh, MethodType expected) {
MethodType actual = mh.type();
if (actual != expected)
throw newWrongMethodTypeException(expected, actual);
}
*** 317,329 ****
* Directly returns the type-adjusted MH to invoke, as follows:
* {@code (R)MH.invoke(a*) => MH.asType(TYPEOF(a*:R)).invokeBasic(a*)}
*/
/*non-public*/ static
@ForceInline
! Object checkGenericType(Object mhObj, Object expectedObj) {
! MethodHandle mh = (MethodHandle) mhObj;
! MethodType expected = (MethodType) expectedObj;
return mh.asType(expected);
/* Maybe add more paths here. Possible optimizations:
* for (R)MH.invoke(a*),
* let MT0 = TYPEOF(a*:R), MT1 = MH.type
*
--- 315,325 ----
* Directly returns the type-adjusted MH to invoke, as follows:
* {@code (R)MH.invoke(a*) => MH.asType(TYPEOF(a*:R)).invokeBasic(a*)}
*/
/*non-public*/ static
@ForceInline
! MethodHandle checkGenericType(MethodHandle mh, MethodType expected) {
return mh.asType(expected);
/* Maybe add more paths here. Possible optimizations:
* for (R)MH.invoke(a*),
* let MT0 = TYPEOF(a*:R), MT1 = MH.type
*
*** 388,405 ****
}
/** Static definition of MethodHandle.invokeGeneric checking code. */
/*non-public*/ static
@ForceInline
! Object getCallSiteTarget(Object site) {
! return ((CallSite)site).getTarget();
}
/*non-public*/ static
@ForceInline
! void checkCustomized(Object o) {
! MethodHandle mh = (MethodHandle)o;
if (MethodHandleImpl.isCompileConstant(mh)) return;
if (mh.form.customized == null) {
maybeCustomize(mh);
}
}
--- 384,400 ----
}
/** Static definition of MethodHandle.invokeGeneric checking code. */
/*non-public*/ static
@ForceInline
! MethodHandle getCallSiteTarget(CallSite site) {
! return site.getTarget();
}
/*non-public*/ static
@ForceInline
! void checkCustomized(MethodHandle mh) {
if (MethodHandleImpl.isCompileConstant(mh)) return;
if (mh.form.customized == null) {
maybeCustomize(mh);
}
}
*** 423,439 ****
NF_checkCustomized;
static {
try {
NamedFunction nfs[] = {
NF_checkExactType = new NamedFunction(Invokers.class
! .getDeclaredMethod("checkExactType", Object.class, Object.class)),
NF_checkGenericType = new NamedFunction(Invokers.class
! .getDeclaredMethod("checkGenericType", Object.class, Object.class)),
NF_getCallSiteTarget = new NamedFunction(Invokers.class
! .getDeclaredMethod("getCallSiteTarget", Object.class)),
NF_checkCustomized = new NamedFunction(Invokers.class
! .getDeclaredMethod("checkCustomized", Object.class))
};
// Each nf must be statically invocable or we get tied up in our bootstraps.
assert(InvokerBytecodeGenerator.isStaticallyInvocable(nfs));
} catch (ReflectiveOperationException ex) {
throw newInternalError(ex);
--- 418,434 ----
NF_checkCustomized;
static {
try {
NamedFunction nfs[] = {
NF_checkExactType = new NamedFunction(Invokers.class
! .getDeclaredMethod("checkExactType", MethodHandle.class, MethodType.class)),
NF_checkGenericType = new NamedFunction(Invokers.class
! .getDeclaredMethod("checkGenericType", MethodHandle.class, MethodType.class)),
NF_getCallSiteTarget = new NamedFunction(Invokers.class
! .getDeclaredMethod("getCallSiteTarget", CallSite.class)),
NF_checkCustomized = new NamedFunction(Invokers.class
! .getDeclaredMethod("checkCustomized", MethodHandle.class))
};
// Each nf must be statically invocable or we get tied up in our bootstraps.
assert(InvokerBytecodeGenerator.isStaticallyInvocable(nfs));
} catch (ReflectiveOperationException ex) {
throw newInternalError(ex);
< prev index next >