On 23.02.24 10:02, Remi Forax wrote:
Hello,
sorry for the late answer.

don't worry. Better late than never

If you use an invoker like the MethodHandles.exactInvoker() instead of using 
directly invokeExact() you will not have any stackframes from your vmPlugin. > 
The idea is that is to have a code like that

   public static CallSite bsm(Lookup lookup, String name, MethodType type) {
     return new InliningCache(type);
   }

   private static class InliningCache extends MutableCallSite {
     private static final MethodHandle SLOW_PATH;
     static {
       var lookup = MethodHandles.lookup();
       try {
         SLOW_PATH = lookup.findVirtual(InliningCache.class, "slowPath", 
methodType(MethodHandle.class, Object.class));
       } catch (NoSuchMethodException | IllegalAccessException e) {
         throw new AssertionError(e);
       }
     }

     public InliningCache(MethodType type) {
       super(type);
       setTarget(MethodHandles.foldArguments(MethodHandles.exactInvoker(type), 
SLOW_PATH.bindTo(this)));
     }

     private MethodHandle slowPath(Object Object receiver) {
       ...
     }
   }

so your slowpath return a method handle that is call by the exactInvoker, so 
the method slowPath is not on the stack.

ah... with fold it makes now sense to me!


merci beaucoup Remi

Jochen

--
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jvm-languages+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jvm-languages/22c00206-689f-4060-9bc1-e1bd56f1f0fe%40gmx.org.

Reply via email to