nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/MonomorphicCallSite.java
equal
deleted
inserted
replaced
86 import java.lang.invoke.MethodHandle; |
86 import java.lang.invoke.MethodHandle; |
87 import jdk.internal.dynalink.linker.GuardedInvocation; |
87 import jdk.internal.dynalink.linker.GuardedInvocation; |
88 import jdk.internal.dynalink.support.AbstractRelinkableCallSite; |
88 import jdk.internal.dynalink.support.AbstractRelinkableCallSite; |
89 |
89 |
90 /** |
90 /** |
91 * A relinkable call site that implements monomorphic inline caching strategy. After it linked a method, it will keep it |
91 * A relinkable call site that implements monomorphic inline caching strategy, |
92 * until either its guard evaluates to false, or its switchpoint is invalidated, at which time it will throw away the |
92 * only being linked to a single {@link GuardedInvocation}. If that invocation |
93 * previous linkage, and trigger relinking with its associated {@link DynamicLinker}. |
93 * is invalidated, it will throw it away and ask its associated |
|
94 * {@link DynamicLinker} to relink it. |
94 */ |
95 */ |
95 public class MonomorphicCallSite extends AbstractRelinkableCallSite { |
96 public class MonomorphicCallSite extends AbstractRelinkableCallSite { |
96 /** |
97 /** |
97 * Creates a new call site with monomorphic inline caching strategy. |
98 * Creates a new call site with monomorphic inline caching strategy. |
98 * @param descriptor the descriptor for this call site |
99 * @param descriptor the descriptor for this call site |
100 public MonomorphicCallSite(final CallSiteDescriptor descriptor) { |
101 public MonomorphicCallSite(final CallSiteDescriptor descriptor) { |
101 super(descriptor); |
102 super(descriptor); |
102 } |
103 } |
103 |
104 |
104 @Override |
105 @Override |
105 public void relink(final GuardedInvocation guardedInvocation, final MethodHandle relink) { |
106 public void relink(final GuardedInvocation guardedInvocation, final MethodHandle relinkAndInvoke) { |
106 setTarget(guardedInvocation.compose(relink)); |
107 setTarget(guardedInvocation.compose(relinkAndInvoke)); |
107 } |
108 } |
108 |
109 |
109 @Override |
110 @Override |
110 public void resetAndRelink(final GuardedInvocation guardedInvocation, final MethodHandle relink) { |
111 public void resetAndRelink(final GuardedInvocation guardedInvocation, final MethodHandle relinkAndInvoke) { |
111 relink(guardedInvocation, relink); |
112 relink(guardedInvocation, relinkAndInvoke); |
112 } |
113 } |
113 } |
114 } |