This reapplies JDK-8287384 and adjust the number of GCs for negative case, i.e. the condition is never met that is used to verify a reference is not GC'ed.
------------- Commit messages: - JDK-8287671: Adjust ForceGC to invoke System::gc fewer times for negative case Changes: https://git.openjdk.java.net/jdk/pull/9021/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=9021&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8287671 Stats: 19 lines in 1 file changed: 11 ins; 0 del; 8 mod Patch: https://git.openjdk.java.net/jdk/pull/9021.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/9021/head:pull/9021 PR: https://git.openjdk.java.net/jdk/pull/9021