-
Bug
-
Resolution: Fixed
-
P4
-
17
-
b10
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8262252 | 16.0.2 | Harold Seigel | P4 | Resolved | Fixed | b01 |
JDK-8262159 | 16.0.1 | Harold Seigel | P4 | Resolved | Fixed | b06 |
JDK-8264837 | 13.0.8 | Sergey Nazarkin | P4 | Resolved | Fixed | b01 |
JDK-8261955 | 11.0.12-oracle | Dukebot | P4 | Resolved | Fixed | b01 |
JDK-8262745 | 11.0.11 | Jie Fu | P4 | Resolved | Fixed | b05 |
In following test, WeakReference is expected cleared after GC, but it fails with option "-XX:-Inline -XX:-TieredCompilation -XX:CompileCommand=compileonly,UncommonTrapLeak.foo -XX:CompileThreshold=100 -XX:-BackgroundCompilation". Reference's referent object is still alive after "foo" finish, because with uncommon trap, oops are recorded in HandleArea and HandleArea is not poped after uncommon trap process.
public class UncommonTrapLeak {
static WeakReference<Object> ref = null;
static int val = 0;
public static void main(String args[]) {
for (int i = 0; i < 300; i++) {
val++;
foo(i);
System.gc();
if (ref.get() != null) {
throw new RuntimeException("Failed: referent not collected after trap " + ref.get());
}
if (i % 100 == 0) {
System.out.println(i);
}
}
}
static void foo(int i) {
Object o = new Object();
ref = new WeakReference<Object>(o);
if (val == 200) {
// trigger Deoptimization::uncommon_trap
if (o instanceof UncommonTrapLeak) {
}
}
}
}
When Deoptimization::fetch_unroll_info_helper return, all oops in deoptimized frames are saved in Deoptimization::UnrollBlock or Thread data structure, HandleArea can be restored safely.
1. local and expression oops raw address is stored in vframeArrayElement _locals/_expressions as intptr
2. return value restore, raw oop recoreded in frame // (oop *)map->location(rax->as_VMReg());
3. exception object, raw oop recorded on Thread._exception_oop
In deoptimize blob, JRT_BLOCK_ENTRY(Deoptimization::fetch_unroll_info) has HandleMarkCleaner, HandleArea is restored after Deoptimization::fetch_unroll_info_helper finish. So it's also safe to add HandleMark in Deoptimization::uncommon_trap before fetch_unroll_info_helper.
Proposed fix is adding HandleMark in Deoptimization::uncommon_trap before Deoptimization::fetch_unroll_info_helper.
- backported by
-
JDK-8261955 Restore HandleArea used in Deoptimization::uncommon_trap
- Resolved
-
JDK-8262159 Restore HandleArea used in Deoptimization::uncommon_trap
- Resolved
-
JDK-8262252 Restore HandleArea used in Deoptimization::uncommon_trap
- Resolved
-
JDK-8262745 Restore HandleArea used in Deoptimization::uncommon_trap
- Resolved
-
JDK-8264837 Restore HandleArea used in Deoptimization::uncommon_trap
- Resolved
- links to
-
Commit openjdk/jdk13u-dev/4d5f2ab4
-
Commit openjdk/jdk16u/5c130eb5
-
Commit openjdk/jdk/95d73129
-
Review openjdk/jdk13u-dev/171
-
Review openjdk/jdk16u/39
-
Review openjdk/jdk/2526