81 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
81 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
82 */ |
82 */ |
83 |
83 |
84 package jdk.internal.dynalink.support; |
84 package jdk.internal.dynalink.support; |
85 |
85 |
|
86 import java.lang.invoke.CallSite; |
86 import java.lang.invoke.MethodHandle; |
87 import java.lang.invoke.MethodHandle; |
87 import java.lang.invoke.MutableCallSite; |
88 import java.lang.invoke.MutableCallSite; |
88 import jdk.internal.dynalink.CallSiteDescriptor; |
89 import jdk.internal.dynalink.CallSiteDescriptor; |
89 import jdk.internal.dynalink.RelinkableCallSite; |
90 import jdk.internal.dynalink.RelinkableCallSite; |
|
91 import jdk.internal.dynalink.linker.GuardedInvocation; |
90 |
92 |
91 /** |
93 /** |
92 * A basic implementation of the {@link RelinkableCallSite} as a {@link MutableCallSite} subclass. |
94 * A basic implementation of the {@link RelinkableCallSite} as a |
|
95 * {@link MutableCallSite}. It carries a {@link CallSiteDescriptor} passed in |
|
96 * the constructor and provides the correct implementation of the |
|
97 * {@link #initialize(MethodHandle)} method. Subclasses must provide |
|
98 * {@link #relink(GuardedInvocation, MethodHandle)} and |
|
99 * {@link #resetAndRelink(GuardedInvocation, MethodHandle)} |
|
100 * methods. |
93 */ |
101 */ |
94 public abstract class AbstractRelinkableCallSite extends MutableCallSite implements RelinkableCallSite { |
102 public abstract class AbstractRelinkableCallSite extends MutableCallSite implements RelinkableCallSite { |
95 private final CallSiteDescriptor descriptor; |
103 private final CallSiteDescriptor descriptor; |
96 |
104 |
97 /** |
105 /** |
98 * Creates a new relinkable call site. |
106 * Creates a new abstract relinkable call site. |
99 * @param descriptor the descriptor for this call site |
107 * @param descriptor the descriptor for this call site that will be returned |
|
108 * from {@link #getDescriptor()}. The call site's {@link CallSite#type()} |
|
109 * will be equal to descriptor's {@link CallSiteDescriptor#getMethodType()}. |
|
110 * @throws NullPointerException if {@code descriptor} is null. |
100 */ |
111 */ |
101 protected AbstractRelinkableCallSite(final CallSiteDescriptor descriptor) { |
112 protected AbstractRelinkableCallSite(final CallSiteDescriptor descriptor) { |
102 super(descriptor.getMethodType()); |
113 super(descriptor.getMethodType()); |
103 this.descriptor = descriptor; |
114 this.descriptor = descriptor; |
104 } |
115 } |