Greetings,

The following change set addresses the data loss resulting in the assertion 
"Missing object ID X in pool jdk.types.Method".

It involves three components:

1. Address a regression introduced by 
[JDK-835221](https://bugs.openjdk.org/browse/JDK-8352251). By locating 
JFR_ONLY(Jfr::check_and_process_sample_request(thread);) before the 
global_poll() in SafepointMechanism::process(), a stacktrace can be captured, 
and artifacts tagged, during a safepoint. This breaks an invariant as 
artifacts, i.e. methods, can be tagged in the wrong epoch (also a stacktrace 
can be stored in the wrong epoch). Must be moved to post global_poll().

2. Retransform/Redefine classes include a non-safe copy of Method trace flags, 
leading to stale bits being set onto the new Methods. Method trace flags need 
to be copied, but must be done under a safepoint.

3. It seems that there has been an increase in the frequency of issuing calls 
to InstanceKlass::purge_previous_versions(), making scratch klasses and old 
methods disappear before JFR gets the chance to serialize also tagged old 
methods. Therefore, we need to ensure that we always tag the latest version of 
a Method.

There is also a cleanup of gratuitous type conversions, from Klass* to 
InstanceKlass* in the newly introduced MethodTracing subsystem.

Testing: jdk_jfr, stress testing

Thank you
Markus

-------------

Commit messages:
 - 8356587

Changes: https://git.openjdk.org/jdk/pull/26458/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26458&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8356587
  Stats: 304 lines in 23 files changed: 123 ins; 106 del; 75 mod
  Patch: https://git.openjdk.org/jdk/pull/26458.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26458/head:pull/26458

PR: https://git.openjdk.org/jdk/pull/26458

Reply via email to