下面列出了java.lang.invoke.CallSite#dynamicInvoker ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private MethodHandle createComposableInvoker(final boolean isConstructor) {
final MethodHandle handle = getInvokerOrConstructor(isConstructor);
// If compiled function is not optimistic, it can't ever change its invoker/constructor, so just return them
// directly.
if(!canBeDeoptimized()) {
return handle;
}
// Otherwise, we need a new level of indirection; need to introduce a mutable call site that can relink itself
// to the compiled function's changed target whenever the optimistic assumptions are invalidated.
final CallSite cs = new MutableCallSite(handle.type());
relinkComposableInvoker(cs, this, isConstructor);
return cs.dynamicInvoker();
}
private MethodHandle createComposableInvoker(final boolean isConstructor) {
final MethodHandle handle = getInvokerOrConstructor(isConstructor);
// If compiled function is not optimistic, it can't ever change its invoker/constructor, so just return them
// directly.
if(!canBeDeoptimized()) {
return handle;
}
// Otherwise, we need a new level of indirection; need to introduce a mutable call site that can relink itslef
// to the compiled function's changed target whenever the optimistic assumptions are invalidated.
final CallSite cs = new MutableCallSite(handle.type());
relinkComposableInvoker(cs, this, isConstructor);
return cs.dynamicInvoker();
}
private MethodHandle createComposableInvoker(final boolean isConstructor) {
final MethodHandle handle = getInvokerOrConstructor(isConstructor);
// If compiled function is not optimistic, it can't ever change its invoker/constructor, so just return them
// directly.
if(!canBeDeoptimized()) {
return handle;
}
// Otherwise, we need a new level of indirection; need to introduce a mutable call site that can relink itself
// to the compiled function's changed target whenever the optimistic assumptions are invalidated.
final CallSite cs = new MutableCallSite(handle.type());
relinkComposableInvoker(cs, this, isConstructor);
return cs.dynamicInvoker();
}
private MethodHandle createComposableInvoker(final boolean isConstructor) {
final MethodHandle handle = getInvokerOrConstructor(isConstructor);
// If compiled function is not optimistic, it can't ever change its invoker/constructor, so just return them
// directly.
if(!canBeDeoptimized()) {
return handle;
}
// Otherwise, we need a new level of indirection; need to introduce a mutable call site that can relink itself
// to the compiled function's changed target whenever the optimistic assumptions are invalidated.
final CallSite cs = new MutableCallSite(handle.type());
relinkComposableInvoker(cs, this, isConstructor);
return cs.dynamicInvoker();
}
private MethodHandle createComposableInvoker(final boolean isConstructor) {
final MethodHandle handle = getInvokerOrConstructor(isConstructor);
// If compiled function is not optimistic, it can't ever change its invoker/constructor, so just return them
// directly.
if(!canBeDeoptimized()) {
return handle;
}
// Otherwise, we need a new level of indirection; need to introduce a mutable call site that can relink itself
// to the compiled function's changed target whenever the optimistic assumptions are invalidated.
final CallSite cs = new MutableCallSite(handle.type());
relinkComposableInvoker(cs, this, isConstructor);
return cs.dynamicInvoker();
}
private MethodHandle createComposableInvoker(final boolean isConstructor) {
final MethodHandle handle = getInvokerOrConstructor(isConstructor);
// If compiled function is not optimistic, it can't ever change its invoker/constructor, so just return them
// directly.
if(!canBeDeoptimized()) {
return handle;
}
// Otherwise, we need a new level of indirection; need to introduce a mutable call site that can relink itself
// to the compiled function's changed target whenever the optimistic assumptions are invalidated.
final CallSite cs = new MutableCallSite(handle.type());
relinkComposableInvoker(cs, this, isConstructor);
return cs.dynamicInvoker();
}
private MethodHandle createComposableInvoker(final boolean isConstructor) {
final MethodHandle handle = getInvokerOrConstructor(isConstructor);
// If compiled function is not optimistic, it can't ever change its invoker/constructor, so just return them
// directly.
if(!canBeDeoptimized()) {
return handle;
}
// Otherwise, we need a new level of indirection; need to introduce a mutable call site that can relink itself
// to the compiled function's changed target whenever the optimistic assumptions are invalidated.
final CallSite cs = new MutableCallSite(handle.type());
relinkComposableInvoker(cs, this, isConstructor);
return cs.dynamicInvoker();
}