Currently, jdi only check and process class unloading event when it detects a new GC cycle.
After [JDK-8212879](https://bugs.openjdk.org/browse/JDK-8212879), posting class events can overlap with GC finish event, that results, sometimes, it only captures partial or even empty unloaded class list. The pending list usually can be flushed out at next GC cycle. But for the classes unloaded during the last GC cycle, the class unloading events may lost forever. This patch checks and processes class unloading events unconditionally, suggested by @kbarrett, it also performs `commonRef_compact()` only when there are classes unloaded. ------------- Commit messages: - Remove redundant check - Update - Cleanup - Remove empty line - Update - Update - Add test - v0 Changes: https://git.openjdk.org/jdk/pull/9168/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9168&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8256811 Stats: 172 lines in 2 files changed: 142 ins; 19 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/9168.diff Fetch: git fetch https://git.openjdk.org/jdk pull/9168/head:pull/9168 PR: https://git.openjdk.org/jdk/pull/9168
