JDK-8058846 : c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8u40,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2014-09-20
  • Updated: 2015-09-29
  • Resolved: 2014-11-28
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
8u60Fixed 9 b43Fixed
Related Reports
Relates :  
Relates :  
Description
Some tests in compiler/intrinsics/bmi/verifycode fail for me on my Mac laptop with Haswell. Specifically all tests that operate on long operands. The generated code seems to be perfectly fine. For example, for compiler/intrinsics/bmi/verifycode/AddnTestL.java:

jtreg -v -ignore:quiet -vmoption:-XX:CompileCommand=print,TestAndnL\$AndnLExpr.longExpr -jdk:/Users/iggy/work/jdk9b29-experimental compiler/intrinsics/bmi/verifycode/AddnTestL.java

runner starting test: compiler/intrinsics/bmi/verifycode/AddnTestL.java
runner finished test: compiler/intrinsics/bmi/verifycode/AddnTestL.java
Failed. Execution failed: `main' threw exception: java.lang.AssertionError: public long TestAndnL$AndnLExpr.longExpr(Expr$MemL,Expr$MemL)CPU instructions expected not found: 44 8B 56 08 49 C1 E2 03 49 3B C2 0F 85 8F 3A 62 F8 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 89 84 24 00 A0 FE FF 55 48 83 EC 10 4C 8B 52 10 48 85 C9 74 12 C4 E2 A8 F2 41 10 48 83 C4 10 5D 85 05 DA 48 D4 F5 C3 BE F6 FF FF FF 90 90 90 E8 2C 57 62 F8 E8 99 7E 4B F7 BE F6 FF FF FF 90 E8 1C 57 62 F8 E8 89 7E 4B F7 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4
Test results: failed: 1

The actual code that we generate works and seems totally fine:

Loaded disassembler from hsdis-amd64.dylib
Compiled method (c2)    1089  294       4       TestAndnL$AndnLExpr::longExpr (14 bytes)
 total in heap  [0x000000011082b590,0x000000011082b868] = 728
 relocation     [0x000000011082b6c0,0x000000011082b6d8] = 24
 main code      [0x000000011082b6e0,0x000000011082b760] = 128
 stub code      [0x000000011082b760,0x000000011082b778] = 24
 oops           [0x000000011082b778,0x000000011082b780] = 8
 metadata       [0x000000011082b780,0x000000011082b788] = 8
 scopes data    [0x000000011082b788,0x000000011082b7c0] = 56
 scopes pcs     [0x000000011082b7c0,0x000000011082b850] = 144
 dependencies   [0x000000011082b850,0x000000011082b858] = 8
 nul chk table  [0x000000011082b858,0x000000011082b868] = 16
Decoding compiled method 0x000000011082b590:
Code:
[Disassembling for mach='i386:x86-64']
[Entry Point]
[Constants]
  # {method} {0x0000000122125a78} 'longExpr' '(LExpr$MemL;LExpr$MemL;)J' in 'TestAndnL$AndnLExpr'
  # this:     rsi:rsi   = 'TestAndnL$AndnLExpr'
  # parm0:    rdx:rdx   = 'Expr$MemL'
  # parm1:    rcx:rcx   = 'Expr$MemL'
  #           [sp+0x20]  (sp of caller)
  ;; N46: #	B1 <- BLOCK HEAD IS JUNK   Freq: 1

  0x000000011082b6e0: mov    0x8(%rsi),%r10d
  0x000000011082b6e4: shl    $0x3,%r10
  0x000000011082b6e8: cmp    %r10,%rax
  0x000000011082b6eb: jne    0x0000000108e4f180  ;   {runtime_call}
  0x000000011082b6f1: nop
  0x000000011082b6f2: nop
  0x000000011082b6f3: nop
  0x000000011082b6f4: nop
  0x000000011082b6f5: nop
  0x000000011082b6f6: nop
  0x000000011082b6f7: nop
  0x000000011082b6f8: nop
  0x000000011082b6f9: nop
  0x000000011082b6fa: nop
  0x000000011082b6fb: nop
  0x000000011082b6fc: nop
  0x000000011082b6fd: nop
  0x000000011082b6fe: nop
  0x000000011082b6ff: nop
[Verified Entry Point]
  ;; B1: #	B5 B2 <- BLOCK HEAD IS JUNK   Freq: 1

  0x000000011082b700: mov    %eax,-0x16000(%rsp)
  0x000000011082b707: push   %rbp
  0x000000011082b708: sub    $0x10,%rsp         ;*synchronization entry
                                                ; - TestAndnL$AndnLExpr::longExpr@-1 (line 70)

  0x000000011082b70c: mov    0x10(%rdx),%r10    ; implicit exception: dispatches to 0x000000011082b739
  ;; B2: #	B4 B3 <- B1  Freq: 0.999999

  0x000000011082b710: test   %rcx,%rcx
  0x000000011082b713: je     0x000000011082b727  ;*getfield value
                                                ; - TestAndnL$AndnLExpr::longExpr@9 (line 70)

  ;; B3: #	N46 <- B2  Freq: 0.999998

  0x000000011082b715: andn   0x10(%rcx),%r10,%rax  ;*land
                                                ; - TestAndnL$AndnLExpr::longExpr@12 (line 70)

  0x000000011082b71b: add    $0x10,%rsp
  0x000000011082b71f: pop    %rbp
  0x000000011082b720: test   %eax,-0xa2bb726(%rip)        # 0x0000000106570000
                                                ;   {poll_return}
  0x000000011082b726: retq   
  ;; B4: #	N46 <- B2  Freq: 1.01328e-06

  0x000000011082b727: mov    $0xfffffff6,%esi
  0x000000011082b72c: nop
  0x000000011082b72d: nop
  0x000000011082b72e: nop
  0x000000011082b72f: callq  0x0000000108e50e60  ; OopMap{off=84}
                                                ;*getfield value
                                                ; - TestAndnL$AndnLExpr::longExpr@9 (line 70)
                                                ;   {runtime_call}
  0x000000011082b734: callq  0x0000000107ce35d2  ;*getfield value
                                                ; - TestAndnL$AndnLExpr::longExpr@9 (line 70)
                                                ;   {runtime_call}
  ;; B5: #	N46 <- B1  Freq: 1.01328e-06

  0x000000011082b739: mov    $0xfffffff6,%esi
  0x000000011082b73e: nop
  0x000000011082b73f: callq  0x0000000108e50e60  ; OopMap{off=100}
                                                ;*getfield value
                                                ; - TestAndnL$AndnLExpr::longExpr@1 (line 70)
                                                ;   {runtime_call}
  0x000000011082b744: callq  0x0000000107ce35d2  ;*getfield value
                                                ; - TestAndnL$AndnLExpr::longExpr@1 (line 70)
                                                ;   {runtime_call}
  0x000000011082b749: hlt    
  0x000000011082b74a: hlt    
  0x000000011082b74b: hlt    
  0x000000011082b74c: hlt    
  0x000000011082b74d: hlt    
  0x000000011082b74e: hlt    
  0x000000011082b74f: hlt    
  0x000000011082b750: hlt    
  0x000000011082b751: hlt    
  0x000000011082b752: hlt    
  0x000000011082b753: hlt    
  0x000000011082b754: hlt    
  0x000000011082b755: hlt    
  0x000000011082b756: hlt    
  0x000000011082b757: hlt    
  0x000000011082b758: hlt    
  0x000000011082b759: hlt    
  0x000000011082b75a: hlt    
  0x000000011082b75b: hlt    
  0x000000011082b75c: hlt    
  0x000000011082b75d: hlt    
  0x000000011082b75e: hlt    
  0x000000011082b75f: hlt    
[Exception Handler]
[Stub Code]
  0x000000011082b760: jmpq   0x0000000108f3c8e0  ;   {no_reloc}
[Deopt Handler Code]
  0x000000011082b765: callq  0x000000011082b76a
  0x000000011082b76a: subq   $0x5,(%rsp)
  0x000000011082b76f: jmpq   0x0000000108e50920  ;   {runtime_call}
  0x000000011082b774: hlt    
  0x000000011082b775: hlt    
  0x000000011082b776: hlt    
  0x000000011082b777: hlt    
pc-bytecode offsets:
PcDesc(pc=0x11082b6df offset=ffffffff bits=0):
PcDesc(pc=0x11082b70c offset=2c bits=0):
   TestAndnL$AndnLExpr::longExpr  @-1
PcDesc(pc=0x11082b715 offset=35 bits=0):
   TestAndnL$AndnLExpr::longExpr  @9
PcDesc(pc=0x11082b71b offset=3b bits=0):
   TestAndnL$AndnLExpr::longExpr  @12
PcDesc(pc=0x11082b734 offset=54 bits=1):
   TestAndnL$AndnLExpr::longExpr  @9  reexecute=true
PcDesc(pc=0x11082b739 offset=59 bits=0):
   TestAndnL$AndnLExpr::longExpr  @9
PcDesc(pc=0x11082b744 offset=64 bits=1):
   TestAndnL$AndnLExpr::longExpr  @1  reexecute=true
PcDesc(pc=0x11082b749 offset=69 bits=0):
   TestAndnL$AndnLExpr::longExpr  @1
PcDesc(pc=0x11082b779 offset=99 bits=0):
OopMapSet contains 2 OopMaps

#0 
OopMap{off=84}
#1 
OopMap{off=100}

Comments
Is it applicable to JDK 7 and below? If not can you please set 7-na?
08-04-2015

Issue: com.oracle.java.testlibrary.Platform::{isX86, isX64} simultaneously return true. Root cause: Both methods verify that os.arch value starts from particular string. In case of isX86 such string are "i386" and "x86", in case of isX64 - "amd64" and "x86_64". So if os.arch is X86_64. then both these methods will return true. Suggested fix: Update Platform::isX86 to check that os.arch is "x86", but not "x86_64".
23-09-2014

ILW = incorrect behaviour of tests that depend on Platform::{isX86, isX64}, always happens on OSX, none = MMH => P3
23-09-2014

Igor, thank you for help.
23-09-2014

[~fzhinkin], works fine now. Thanks for the fix.
22-09-2014

[~iveresov], I don't have an access to any Mac w/ Haswell CPU. Could you check that attached diff will resolve the issue with BMI tests on your laptop?
22-09-2014

Failures caused by an issue in c.o.j.t.Platform::{isX86, isX64} implementation: these methods checks that os.arch property' value starts with {i386, X86} and {amd64, X86_64} respectively. On OSX both methods return true. bmi/verifycode tests use Platform::isX86 to choose between checks targeted to 32-bit and 64-bit code. As a result tests listed above use wrong set of checks and fail. We never hit this issue before, because these tests were never executed on OSX w/ HSW CPU.
22-09-2014

ILW=Test fails - code seems fine, only seen in specific tests, none=LLH=P5
22-09-2014

Tests that fail: runner starting test: compiler/intrinsics/bmi/verifycode/AddnTestL.java runner finished test: compiler/intrinsics/bmi/verifycode/AddnTestL.java Failed. Execution failed: `main' threw exception: java.lang.AssertionError: public long TestAndnL$AndnLExpr.longExpr(Expr$MemL,Expr$MemL)CPU instructions expected not found: 44 8B 56 08 49 C1 E2 03 49 3B C2 0F 85 8F 3A 62 F8 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 89 84 24 00 A0 FE FF 55 48 83 EC 10 4C 8B 52 10 48 85 C9 74 12 C4 E2 A8 F2 41 10 48 83 C4 10 5D 85 05 DA 18 DC F5 C3 BE F6 FF FF FF 90 90 90 E8 2C 57 62 F8 E8 99 7E 4B F7 BE F6 FF FF FF 90 E8 1C 57 62 F8 E8 89 7E 4B F7 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 F4 runner starting test: compiler/intrinsics/bmi/verifycode/BlsiTestL.java runner finished test: compiler/intrinsics/bmi/verifycode/BlsiTestL.java Failed. Execution failed: `main' threw exception: java.lang.AssertionError: public long TestBlsiL$BlsiLExpr.longExpr(long)CPU instructions expected not found: 44 8B 56 08 49 C1 E2 03 49 3B C2 0F 85 8F 3A 62 F8 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 89 84 24 00 A0 FE FF 55 48 83 EC 10 C4 E2 F8 F3 DA 48 83 C4 10 5D 85 05 E4 08 E9 F5 C3 F4 F4 F4 runner starting test: compiler/intrinsics/bmi/verifycode/BlsmskTestL.java runner finished test: compiler/intrinsics/bmi/verifycode/BlsmskTestL.java Failed. Execution failed: `main' threw exception: java.lang.AssertionError: public long TestBlsmskL$BlsmskLExpr.longExpr(long)CPU instructions expected not found: 44 8B 56 08 49 C1 E2 03 49 3B C2 0F 85 8F 3A 62 F8 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 89 84 24 00 A0 FE FF 55 48 83 EC 10 C4 E2 F8 F3 D2 48 83 C4 10 5D 85 05 E4 88 D1 F5 C3 F4 F4 F4 runner starting test: compiler/intrinsics/bmi/verifycode/BlsrTestL.java runner finished test: compiler/intrinsics/bmi/verifycode/BlsrTestL.java Failed. Execution failed: `main' threw exception: java.lang.AssertionError: public long TestBlsrL$BlsrLExpr.longExpr(long)CPU instructions expected not found: 44 8B 56 08 49 C1 E2 03 49 3B C2 0F 85 8F 3A 62 F8 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 89 84 24 00 A0 FE FF 55 48 83 EC 10 C4 E2 F8 F3 CA 48 83 C4 10 5D 85 05 E4 D8 E6 F5 C3 F4 F4 F4 runner starting test: compiler/intrinsics/bmi/verifycode/LZcntTestL.java runner finished test: compiler/intrinsics/bmi/verifycode/LZcntTestL.java Failed. Execution failed: `main' threw exception: java.lang.AssertionError: public long TestLzcntL$LzcntLExpr.longExpr(long)CPU instructions expected not found: 44 8B 56 08 49 C1 E2 03 49 3B C2 0F 85 8F 3C 62 F8 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 89 84 24 00 A0 FE FF 55 48 83 EC 10 F3 4C 0F BD DA 49 63 C3 48 83 C4 10 5D 85 05 E1 9A D1 F5 C3 runner starting test: compiler/intrinsics/bmi/verifycode/TZcntTestL.java runner finished test: compiler/intrinsics/bmi/verifycode/TZcntTestL.java Failed. Execution failed: `main' threw exception: java.lang.AssertionError: public long TestTzcntL$TzcntLExpr.longExpr(long)CPU instructions expected not found: 44 8B 56 08 49 C1 E2 03 49 3B C2 0F 85 8F 3C 62 F8 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 89 84 24 00 A0 FE FF 55 48 83 EC 10 F3 4C 0F BC DA 49 63 C3 48 83 C4 10 5D 85 05 E1 3A EC F5 C3
20-09-2014