java - OpenJDK 8 Lambdas processing -
in current project want able "reinstantiate" lambda method (don't know if "reinstantiate" right word though)
consider following example
public static void main(string[] args) throws throwable { testuser tu = new testuser(); itest1 lam = t->{ system.out.println("whoops" + tu.tostring()); return 1; }; tu.doexec(lam); calls++; if( calls == 1) main(args); } here ve tried debug through jvm calls , noticed jvm creates , methodtype , methodhandle objects metafactory method (which creates builds callsite) , lambda method. once done linkcallsite invoked. method builds callsite , links lambda method once. @ point, question is, can somehow delete lambda callsite , lambdaform jvm , somehow trigger whole process again?
and question, when debugging through jvm calls noticed every time when jvm executes lambda method, method ljava/lang/invoke/lambdaform$mh/818403870;.linktotargetmethod(object) gets invoked, cannot find sourcecode of, neither in jvm cpp sources, nor in java. how method called, or invoked?
i know question kind of complicated, open questions. thank in advance.
can somehow delete lambda callsite , lambdaform jvm , somehow trigger whole process again?
invokedynamic linked callsite (or directly target method) once @ bytecode resolution time. resolution result saved in constant pool cache , not modified afterwards.
one possible way reset constant pool cache redefine class. don't count reloading class in different classloader, since technically same loading new class not related old one.
so, in order trigger linkcallsite stuff once again, may call instrumentation.redefineclasses or equivalent jvm ti redefineclasses function.
how method called, or invoked?
linktotargetmethod adapter created dynamically in runtime invoke methodhandle linked specific invokedynamic bytecode. implementation of invokedynamic calls adapter.
here is source adapter generated.
Comments
Post a Comment