JDK-8144935 : C2: safepoint is pruned from a non-counted loop
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • CPU: generic
  • Submitted: 2015-12-08
  • Updated: 2017-07-26
  • Resolved: 2015-12-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u101Fixed 9 b103Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
Hang (infinite loop w/o safepoint checks) in j.u.c.ForkJoinPool::helpStealer when JVM tries to reach a safepoint.

Comments
verified by nightly testing
26-07-2017

The problem was introduced by JDK-6869327.
09-12-2015

Loop tree and safepoint placement is the following: Loop: N0/N0 nest=0 has_call has_sfpt Loop: N1773/N1762 nest=1 has_call Loop: N1786/N1578 counted [0,int),+1 (1 iters) nest=2 has_sfpt Loop: N1775/N1554 nest=2 has_call 1542 SafePoint ... !jvms: ForkJoinPool::helpStealer @ bci:445 Loop: N1776/N1459 nest=3 has_call has_sfpt If safepoint elimination is disabled, the problematic loop has a safepoint poll and the test passes. Loop: N0/N0 nest=0 has_call has_sfpt Loop: N1774/N1763 nest=1 has_call 1584 SafePoint ... !jvms: ForkJoinPool::helpStealer @ bci:448 1541 SafePoint ... !jvms: ForkJoinPool::helpStealer @ bci:442 Loop: N1787/N1579 counted [0,int),+1 (1 iters) nest=2 has_sfpt 1574 SafePoint ... !jvms: ForkJoinPool::helpStealer @ bci:144 Loop: N1776/N1555 nest=2 has_call 1543 SafePoint ... !jvms: ForkJoinPool::helpStealer @ bci:445 Loop: N1777/N1460 nest=3 has_call has_sfpt 1287 SafePoint ... !jvms: ForkJoinPool::helpStealer @ bci:378 ; ;; B22: # B23 <- B40 top-of-loop Freq: 150.084 0x00007f138d1ecd09: test %eax,0xbdca2f1(%rip) # 0x00007f1398fb7000 ;*goto {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@442 (line 2154) ; {poll} ;; B23: # B24 <- B22 B53 Freq: 240.79 ;; B24: # B142 B25 <- B21 B87 B23 Loop: B24-B23 Freq: 241.791 ;; B25: # B45 B26 <- B24 Freq: 241.791 ;; B26: # B143 B27 <- B25 Freq: 152.076 ;; B27: # B144 B28 <- B26 Freq: 152.076 ;; B28: # B94 B29 <- B27 Freq: 152.076 ;; B29: # B30 <- B28 Freq: 152.076 ;; B30: # B93 B31 <- B29 B80 Loop: B30-B80 inner Freq: 152.239 ;; B31: # B79 B32 <- B30 Freq: 152.239 ;; B32: # B78 B33 <- B31 Freq: 152.184 ;; B33: # B45 B34 <- B32 Freq: 152.075 ;; B34: # B35 <- B33 Freq: 152.075 ;; B35: # B38 B36 <- B34 B91 Loop: B35-B91 Freq: 152.076 ;; B36: # B38 B37 <- B35 Freq: 152.076 ;; B37: # B88 B38 <- B36 Freq: 152.076 ;; B38: # B90 B39 <- B35 B36 B37 Freq: 152.075 ;; B39: # B90 B40 <- B38 Freq: 152.075 ;; B40: # B22 B41 <- B39 Freq: 152.075 0x00007f138d1ece94: jne 0x00007f138d1ecd09 ;*ifnonnull {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@412 (line 2147) The missing poll is generated for "1541 SafePoint ... !jvms: ForkJoinPool::helpStealer @ bci:442". There are 2 safepoints associated with Loop: N1774/N1763: 1584 SafePoint ... !jvms: ForkJoinPool::helpStealer @ bci:448 1541 SafePoint ... !jvms: ForkJoinPool::helpStealer @ bci:442
09-12-2015

The problem showed up in nightlies recently (on weekend). Though I haven't found the culprit changeset, it shouldn't escape hs-comp.
09-12-2015

When was this problem introduced? Has it escaped from hs-comp? Thanks.
08-12-2015

Generated code contains no safepoints on that path: 0x00007fda90cfe213: mov (%rsp),%edi 0x00007fda90cfe216: mov 0x4(%rsp),%edx 0x00007fda90cfe21a: mov 0x24(%rsp),%r9d 0x00007fda90cfe21f: mov 0x58(%rsp),%r10 0x00007fda90cfe224: mov 0x68(%rsp),%r11 0x00007fda90cfe229: mov 0x30(%rsp),%rbx ;; B34: # B35 <- B33 B32 Freq: 3.331 0x00007fda90cfe22e: mov %edi,(%rsp) 0x00007fda90cfe231: mov 0x8(%rsp),%rcx 0x00007fda90cfe236: mov %edx,0x4(%rsp) 0x00007fda90cfe23a: mov %r9d,0x24(%rsp) 0x00007fda90cfe23f: mov %r10,0x58(%rsp) 0x00007fda90cfe244: mov %r11,0x68(%rsp) 0x00007fda90cfe249: mov %rbx,0x30(%rsp) ;*aload {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@65 (line 2099) 0x00007fda90cfe24e: mov %r8,%r11 0x00007fda90cfe251: mov 0x10(%r8),%r8d ;*getfield status {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@67 (line 2099) ; implicit exception: dispatches to 0x00007fda90cfeafd 0x00007fda90cfe255: test %r8d,%r8d 0x00007fda90cfe258: jl 0x00007fda90cfe19b ;*iflt {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@70 (line 2099) ;; B37: # B144 B38 <- B36 Freq: 3.49571 0x00007fda90cfe25e: mov $0x1,%r8d 0x00007fda90cfe264: or 0x9c(%rcx),%r8d ;*ior {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@79 (line 2100) ; implicit exception: dispatches to 0x00007fda90cfeb0d ;; B38: # B145 B39 <- B37 Freq: 3.4957 0x00007fda90cfe26b: mov 0x30(%rsp),%r9 0x00007fda90cfe270: mov 0x10(%r9),%edi ;*aaload {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@100 (line 2101) ; implicit exception: dispatches to 0x00007fda90cfeb1d ;; B39: # B75 B40 <- B38 Freq: 3.4957 0x00007fda90cfe274: mov 0x24(%rsp),%r10d 0x00007fda90cfe279: cmp $0x7ffffffe,%r10d 0x00007fda90cfe280: jg 0x00007fda90cfe525 ;; B40: # B41 <- B39 Freq: 3.4957 0x00007fda90cfe286: mov %rcx,%r10 0x00007fda90cfe289: xor %r9d,%r9d 0x00007fda90cfe28c: xor %ecx,%ecx ;*aload {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@85 (line 2101) ;; B41: # B74 B42 <- B40 B57 Loop: B41-B57 inner Freq: 3.53779 0x00007fda90cfe28e: add %r8d,%r9d 0x00007fda90cfe291: and 0x24(%rsp),%r9d ;*iand {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@96 (line 2101) 0x00007fda90cfe296: cmp %edi,%r9d 0x00007fda90cfe299: jae 0x00007fda90cfe4f4 ;; B42: # B56 B43 <- B41 Freq: 3.53778 0x00007fda90cfe29f: mov 0x30(%rsp),%rbx 0x00007fda90cfe2a4: mov 0x18(%rbx,%r9,8),%rbx ;*aaload {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@100 (line 2101) 0x00007fda90cfe2a9: mov %rbx,0x8(%rsp) 0x00007fda90cfe2ae: test %rbx,%rbx 0x00007fda90cfe2b1: je 0x00007fda90cfe3e7 ;*ifnull {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@104 (line 2101) ;; B43: # B55 B44 <- B42 Freq: 3.52607 0x00007fda90cfe2b7: mov 0x158(%rbx),%rbx ;*getfield currentSteal {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@109 (line 2102) 0x00007fda90cfe2be: cmp %r11,%rbx 0x00007fda90cfe2c1: jne 0x00007fda90cfe3d2 ;*if_acmpne {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@114 (line 2102) ;; B44: # B24 B45 <- B43 Freq: 3.49551 0x00007fda90cfe2c7: mov %r10,%rcx 0x00007fda90cfe2ca: mov %r9d,0x9c(%rcx) ;*getfield currentSteal {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@109 (line 2102) // for(;;) 0x00007fda90cfe2d1: mov 0x10(%r11),%r10d ;*getfield status {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@152 (line 2114) 0x00007fda90cfe2d5: test %r10d,%r10d 0x00007fda90cfe2d8: jl 0x00007fda90cfe19b ;*ifge {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@155 (line 2114) ;; B45: # B46 <- B44 Freq: 3.49536 0x00007fda90cfe2de: mov %rcx,0x78(%rsp) 0x00007fda90cfe2e3: mov %r11,0x70(%rsp) 0x00007fda90cfe2e8: mov %r9d,0x38(%rsp) ;*iload {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@161 (line 2116) ;; checkSum += (b = v.base); 0x00007fda90cfe2ed: mov 0x8(%rsp),%r10 0x00007fda90cfe2f2: mov 0xa8(%r10),%r11d 0x00007fda90cfe2f9: mov (%rsp),%r8d 0x00007fda90cfe2fd: add %r11d,%r8d 0x00007fda90cfe300: mov %r8d,(%rsp) 0x00007fda90cfe304: mov 0xd0(%r10),%r10 0x00007fda90cfe30b: mov %r10,0x10(%rsp) ;*getfield currentJoin {reexecute=0 rethrow=0 return_oop=0} 0x00007fda90cfe310: mov 0x8(%rsp),%r10 0x00007fda90cfe315: mov 0xb0(%r10),%r10 ;*getfield array {reexecute=0 rethrow=0 return_oop=0} 0x00007fda90cfe31c: mov %r10,0x18(%rsp) 0x00007fda90cfe321: test %r10,%r10 0x00007fda90cfe324: je 0x00007fda90cfe361 ;*ifnull {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@192 (line 2119) ;; B47: # B49 B48 <- B46 Freq: 3.49591 0x00007fda90cfe326: mov 0x10(%r10),%r10d ;*arraylength {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@197 (line 2119) 0x00007fda90cfe32a: mov %r10d,0x38(%rsp) 0x00007fda90cfe32f: test %r10d,%r10d 0x00007fda90cfe332: jle 0x00007fda90cfe361 ;*invokevirtual getObjectVolatile {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@234 (line 2123) ;; B48: # B65 B49 <- B47 Freq: 3.49591 0x00007fda90cfe334: mov %r10d,%r8d 0x00007fda90cfe337: dec %r8d 0x00007fda90cfe33a: and %r11d,%r8d ;*iand {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@210 (line 2120) 0x00007fda90cfe33d: mov %r8d,0x3c(%rsp) 0x00007fda90cfe342: movslq %r8d,%rbx ;*i2l {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@215 (line 2121) 0x00007fda90cfe345: shl $0x3,%rbx ;*lshl {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@219 (line 2121) 0x00007fda90cfe349: mov 0x18(%rsp),%r10 0x00007fda90cfe34e: mov 0x18(%r10,%rbx,1),%r10 0x00007fda90cfe353: mov %r10,0x40(%rsp) ;*invokevirtual getObjectVolatile {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@234 (line 2123) 0x00007fda90cfe358: test %r10,%r10 0x00007fda90cfe35b: jne 0x00007fda90cfe45a ;*ifle {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@201 (line 2119) 2146 if (t == null && b == v.base && b - v.top >= 0) { b == v.base 0x00007fda90cfe361: mov 0x8(%rsp),%r10 0x00007fda90cfe366: mov 0xa8(%r10),%r10d ;*getfield base {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@390 (line 2146) 0x00007fda90cfe36d: cmp %r10d,%r11d 0x00007fda90cfe370: jne 0x00007fda90cfe47d ;*if_icmpne {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@393 (line 2146) b - v.top >= 0) { 0x00007fda90cfe376: mov 0x8(%rsp),%r10 0x00007fda90cfe37b: mov 0xac(%r10),%r10d ;*getfield top {reexecute=0 rethrow=0 return_oop=0} 0x00007fda90cfe382: mov %r11d,%r9d 0x00007fda90cfe385: sub %r10d,%r9d 0x00007fda90cfe388: test %r9d,%r9d 0x00007fda90cfe38b: jl 0x00007fda90cfe47d ;*iflt {reexecute=0 rethrow=0 return_oop=0} 2147 if ((subtask = next) == null) { // try to descend 0x00007fda90cfe391: mov 0x10(%rsp),%r8 0x00007fda90cfe396: test %r8,%r8 0x00007fda90cfe399: jne 0x00007fda90cfe213 ;*ifnonnull {reexecute=0 rethrow=0 return_oop=0} ; - java.util.concurrent.ForkJoinPool::helpStealer@412 (line 2147)
08-12-2015

Problematic nmethod: 2608 % 4 java.util.concurrent.ForkJoinPool::helpStealer @ 65 (452 bytes) It loops in the following code: 2099 descent: for (subtask = task; subtask.status >= 0; ) { 2100 for (int h = j.hint | 1, k = 0, i;;) { 2101 if ((v = ws[i = (h + (k << 1)) & m]) != null) { 2102 if (v.currentSteal == subtask) { 2103 j.hint = i; 2104 break; 2112 for (;;) { // help v or descend 2113 ForkJoinTask<?>[] a; int b, al; 2114 if (subtask.status < 0) // too late to help 2116 checkSum += (b = v.base); 2117 ForkJoinTask<?> next = v.currentJoin; 2118 ForkJoinTask<?> t = null; 2119 if ((a = v.array) != null && (al = a.length) > 0) { 2120 int index = (al - 1) & b; 2121 long offset = ((long)index << ASHIFT) + ABASE; 2122 t = (ForkJoinTask<?>) 2123 U.getObjectVolatile(a, offset); // == null 2124 if (t != null && b++ == v.base) { ... 2146 if (t == null && b == v.base && b - v.top >= 0) { 2147 if ((subtask = next) == null) { // next != null ... 2153 j = v; between 2 tasks: SecureCommonPool$GetThreadLocalFibTask - klass: 'SecureCommonPool$GetThreadLocalFibTask' - ---- fields (total size 5 words): - volatile 'status' 'I' @16 0 - strict 'result' 'Ljava/lang/Object;' @24 NULL (0 0) - 'number' 'I' @32 8 SecureCommonPool$GetThreadLocalFibTask - klass: 'SecureCommonPool$GetThreadLocalFibTask' - ---- fields (total size 5 words): - volatile 'status' 'I' @16 0 - strict 'result' 'Ljava/lang/Object;' @24 NULL (0 0) - 'number' 'I' @32 7 and 2 queues: j = 0x7fd89e3d2f68 java.util.concurrent.ForkJoinPool$WorkQueue - klass: 'java/util/concurrent/ForkJoinPool$WorkQueue' - ---- fields (total size 76 words): - volatile 'scanState' 'I' @144 831127577 (318a0019) - 'stackPred' 'I' @148 -1703608225 (9a75005f) - 'nsteals' 'I' @152 1 - 'hint' 'I' @156 51 (33) - 'config' 'I' @160 25 (19) - volatile 'qlock' 'I' @164 0 - volatile 'base' 'I' @168 4099 (1003) - 'top' 'I' @172 4099 (1003) - strict 'array' '[Ljava/util/concurrent/ForkJoinTask;' @176 a 'java/util/concurrent/ForkJoinTask'[8192] (9fc33eb0 7fd8) - final 'pool' 'Ljava/util/concurrent/ForkJoinPool;' @184 a 'java/util/concurrent/ForkJoinPool' (9e405348 7fd8) - final 'owner' 'Ljava/util/concurrent/ForkJoinWorkerThread;' @192 a 'java/util/concurrent/ForkJoinWorkerThread$InnocuousForkJoinWorkerThread' (9e40ea70 7fd8) - volatile 'parker' 'Ljava/lang/Thread;' @200 NULL (0 0) - volatile strict 'currentJoin' 'Ljava/util/concurrent/ForkJoinTask;' @208 a 'SecureCommonPool$GetThreadLocalFibTask' (9fc447f8 7fd8) - volatile strict 'currentSteal' 'Ljava/util/concurrent/ForkJoinTask;' @344 a 'SecureCommonPool$GetThreadLocalFibTask' (9e906250 7fd8) v = 0x7fd89e410958 java.util.concurrent.ForkJoinPool$WorkQueue - klass: 'java/util/concurrent/ForkJoinPool$WorkQueue' - ---- fields (total size 76 words): - volatile 'scanState' 'I' @144 1697185843 (65290033) - 'stackPred' 'I' @148 -119603127 (f8df0049) - 'nsteals' 'I' @152 4 - 'hint' 'I' @156 25 (19) - 'config' 'I' @160 51 (33) - volatile 'qlock' 'I' @164 0 - volatile 'base' 'I' @168 4102 (1006) - 'top' 'I' @172 4102 (1006) - strict 'array' '[Ljava/util/concurrent/ForkJoinTask;' @176 a 'java/util/concurrent/ForkJoinTask'[8192] (9e2a64b8 7fd8) - final 'pool' 'Ljava/util/concurrent/ForkJoinPool;' @184 a 'java/util/concurrent/ForkJoinPool' (9e405348 7fd8) - final 'owner' 'Ljava/util/concurrent/ForkJoinWorkerThread;' @192 a 'java/util/concurrent/ForkJoinWorkerThread$InnocuousForkJoinWorkerThread' (9e40d568 7fd8) - volatile 'parker' 'Ljava/lang/Thread;' @200 NULL (0 0) - volatile strict 'currentJoin' 'Ljava/util/concurrent/ForkJoinTask;' @208 a 'SecureCommonPool$GetThreadLocalFibTask' (9e906250 7fd8) - volatile strict 'currentSteal' 'Ljava/util/concurrent/ForkJoinTask;' @344 a 'SecureCommonPool$GetThreadLocalFibTask' (9fc447f8 7fd8)
08-12-2015