JDK-6932837 : Better use unsigned jump if one of the range limits is 0
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7
  • Priority: P5
  • Status: Resolved
  • Resolution: Not an Issue
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2010-03-08
  • Updated: 2014-02-10
  • Resolved: 2014-02-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.
Other
tbd_minorResolved
Description
A DESCRIPTION OF THE REQUEST :
On comparing a signed integer against a range, if one of the range limits is 0, the test on less or greater than 0 should be ommited by HotSpot compiler.
Instead use unsigned compare against the remaining limit.


JUSTIFICATION :
See example in SOURCE section and HotSpot compiled code in EXPECTED and ACTUAL section.
The unsigned compare would need the half of bytes and execution time than the actual 2 signed compares.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -

HotSpot compiler result:

  0x00001000: cmp    $0x10000,%ebp
  0x00001006: jb     0x00001040


ACTUAL -

HotSpot compiler result:

  0x00001000: test   %ebp,%ebp
  0x00001002: jl     0x0000100c
  0x00001004: cmp    $0x10000,%ebp
  0x0000100a: jl     0x00001044



---------- BEGIN SOURCE ----------

        int c = ...;
        if (c >= Character.MIN_CODE_POINT &&
                c < Character.MIN_SUPPLEMENTARY_CODE_POINT)

---------- END SOURCE ----------

Comments
This is the output from the current Hotspot version of the attached test. This issue seems to be solved. Closing this as 'Not an Issue' 0xf359a9c0: mov %eax,-0x4000(%esp) 0xf359a9c7: push %ebp 0xf359a9c8: sub $0x8,%esp ;*synchronization entry ; - Test::jump_test_go@-1 (line 10) 0xf359a9cb: mov $0xdde10ec8,%ebx ; {oop(a 'java/lang/Class' = 'Test')} 0xf359a9d0: mov 0x50(%ebx),%ecx ;*getstatic GLOBAL ; - Test::jump_test_go@0 (line 10) -> 0xf359a9d3: cmp $0x10000,%ecx 0xf359a9d9: jb 0xf359a9e6 ;*if_icmpge ; - Test::jump_test_go@11 (line 11) 0xf359a9db: add $0x8,%esp 0xf359a9de: pop %ebp 0xf359a9df: test %eax,0xf77c1000 ; {poll_return} 0xf359a9e5: ret 0xf359a9e6: mov $0x1a,%ecx 0xf359a9eb: call 0xf34d5aa0 ; OopMap{off=48} ;*getstatic out ; - Test::jump_test_go@14 (line 12) ; {runtime_call} 0xf359a9f0: call 0xf6d9cca0 ;*getstatic out ; - Test::jump_test_go@14 (line 12) ; {runtime_call}
10-02-2014