/*
  Run with:
  java --add-opens java.base/java.lang=ALL-UNNAMED -Xbatch -XX:+UseZGC -XX:-UseTypeProfile Test.java
 */

import java.lang.invoke.*;

public class Test {

    public static void privateLookupIn() throws Exception {
        MethodHandles.Lookup privateLookup = MethodHandles.privateLookupIn(Object.class, MethodHandles.lookup());
        MethodType mt = MethodType.methodType(Object.class);
        MethodHandle mh = privateLookup.findVirtual(Object.class, "clone", mt);
        try {
            for (int i = 0; i < 20_000; i++) {
                Object foo = mh.invokeExact((Object)new String[42]);
            }
        } catch (Throwable e) {}
    }

    public static void main(String[] args) throws Exception {
        privateLookupIn();
    }
}
