This is a rather large work to reimplement the indy linking to avoid deadlocks between tracing and linking.
Unfortunately, this involves some hackery - we need to instrument java.lang.invoke.MethodHandleNatives and track the start and end of the linking process. The reason is that we need to hook-in deeply into the JDK linking process, otherwise we are not able to prevent BTrace probes firing while in the indy linking.
That particular instrumentation will increment thread-local value of a linking flag when the linking starts and decrement once the linking is finished. Then, the injected code needs to be adjusted such that the BTrace action invocation is guarded by a check for the linking flag, skipping the action if the linking is in progress.
Once all of this is in place, it is possible to drastically reduce the exclusion filter for 'sensitive' classes, leaving just a bunch of classes that are crucial to BTrace. Here is the minimal list of excluded classes, still allowing full functionality of BTrace
This is a rather large work to reimplement the indy linking to avoid deadlocks between tracing and linking.
Unfortunately, this involves some hackery - we need to instrument
java.lang.invoke.MethodHandleNatives
and track the start and end of the linking process. The reason is that we need to hook-in deeply into the JDK linking process, otherwise we are not able to prevent BTrace probes firing while in the indy linking.That particular instrumentation will increment thread-local value of a linking flag when the linking starts and decrement once the linking is finished. Then, the injected code needs to be adjusted such that the BTrace action invocation is guarded by a check for the linking flag, skipping the action if the linking is in progress.
Once all of this is in place, it is possible to drastically reduce the exclusion filter for 'sensitive' classes, leaving just a bunch of classes that are crucial to BTrace. Here is the minimal list of excluded classes, still allowing full functionality of BTrace
While working on this change, the instrumentor tests were converted to parametric tests and using golden files.