Rémi Forax skrev: > Wow ... > So this code will create a forever loop and not a StackOverflowError ? > > MethodHandle target=MethodHandles.exactInvoker( > MethodType.make(void.class)); > MethodHandle combiner=lookup().findVirtual(ThisClass, "combine", > MethodType.make(MethodHandle.class)); > ... > MethodHandle combine() { > System.our.println("loop"); > return MethodHandles.combineArguments(target, 0, combiner); > } > ... > combiner.invoke(); > I assume that you mean combine().invoke() ? :-) When I read the spec, the method handle invocations is specified to behave "as if" an invokestatic/invokespecial/invokevirtual call was made. This means that, most likely the JVM will throw a StackOverflowError. Unless the JVM has implemented tail recursion. I.e. it is not specified.
//Fredrik > Is it the behavior of the hotspot implementation or the one required > by the spec ? > > >> I expect to implement guardWithTest on top of combineArguments. >> >> -- John >> >> > Rémi > _______________________________________________ > mlvm-dev mailing list > mlvm-dev@openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev