On Thu, 13 Apr 2023 10:15:02 GMT, Serguei Spitsyn <[email protected]> wrote:
> Your fix introduced a hidden dependency of this new structure on the
> JPLISEnvironment structure and some Java agents implementation details:
>
> ```
> 202 struct JPLISEnvironmentMirror {
> 203 jvmtiEnv* mJVMTIEnv; // the JVMTI environment
> 204 const void* mAgent; // corresponding agent
> 205 jboolean mIsRetransformer; // indicates if special environment
> 206 };
> ```
>
> It does not look good to me but I can't suggest any other approach at the
> moment. How important is this part? Have you considered other ways to achieve
> what is needed?
Yes. It is the key to locating which JavaAgent maps to which JvmtiEnv. I tried
some other variants, but those would change the layout of the exported structs
in jplisAgent.h, and I don't know if people depend on that layout, implicitly
or explicitly. So I choose not go down that route.
This seemed the best alternative since we own jdk.instrument and the
implementation on the JDK side is unlikely to change very much.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/12923#issuecomment-1506830279