-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use JFR at build time if JFR is included in the native image #5556
base: master
Are you sure you want to change the base?
Use JFR at build time if JFR is included in the native image #5556
Conversation
cffaa1e
to
364b81b
Compare
Hi, Thank you for contributing, |
@roberttoyonaga: thanks for working on that. The changes look good but I encounter the following problem during testing:
On JDK 20, I only see this issue when all the test cases are executed in a single image. A reproducer is below:
|
Hi @christianhaeubl it seems like when the tests I'm having trouble understanding how |
I debugged the broken test case: JFR events such as |
Do you mean that the problem is that when a pre-allocated exception is thrown, the instrumentation code for exceptions is called which could violate the constraints of uninterruptible/allocation free-code? |
@roberttoyonaga: yes, the instrumentation violates the constraints of uninterruptible/allocation free-code. |
Hi @christianhaeubl , I think that the exception instrumentation code might actually only be called when a new exception is constructed, not when it eventually gets thrown (ConstructorTracerWriter#visitMethod and ConstructorWriter ). That could mean there won't be violations when using pre-allocated exceptions. Additionally, there might be noise in the build time recording from events due to pre-allocated exceptions, but at least they won't add noise to runtime recordings. What do you think of this? An alternative is to revisit using substitutions instead of using JFR at build time to add the instrumentation for file, socket, and exception events. |
@roberttoyonaga : I looked into that last week but I forgot to add a comment here: yes, as you mentioned, the instrumentation only instruments the allocation of exceptions and not the exception throw. It seems that I was mislead because a static initializer got called and that initializer did the allocation (so, it looked like as if the throw in the uninterruptible code was instrumented). It should be possible to work around that, I will try to have a more detailed look next week. |
This PR enforces JFR is used at build time when JFR support is going to be included in the native image.
This will add support for JFR events that are implemented via byte code instrumentation. These events include
jdk.SocketRead
,jdk.SocketWrite
,jdk.FileRead
,jdk.FileWrite
, andjdk.FileForce
.