public void nullsafe_megamorphic_invocation() throws Throwable {
CallSite toString = MethodInvocationSupport.bootstrap(lookup(), "toString", methodType(Object.class, Object.class), 1);
MethodInvocationSupport.InlineCache pic = (MethodInvocationSupport.InlineCache) toString;
pic.depth = MethodInvocationSupport.InlineCache.MEGAMORPHIC_THRESHOLD + 10;
MethodHandle invoker = toString.dynamicInvoker();
assertThat(invoker.invoke(null), nullValue());
assertThat((String) invoker.invoke("a"), is("a"));
assertThat((String) invoker.invoke(1), is("1"));
assertThat((String) invoker.invoke(1L), is("1"));
assertThat((String) invoker.invoke(Arrays.asList()), is("[]"));