JDK-6935994 : Use as less bits as necessary
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 6u10
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2010-03-18
  • Updated: 2011-10-11
  • Resolved: 2010-08-25
Description
A DESCRIPTION OF THE REQUEST :

Examples:
on
    a = b & 0xFF00
only 8 bits shold be moved (mov %ah,%bh).
on
    a = (b >> 8) & 0xFF
only 8 bits shold be moved and shift should be saved (mov %al,%bh).
on
    a = (b & 0xFF00) + c
only 8 bits shold be added.
on
    a = b & 0xFFFF0000
only 16 bits shold be moved.
on
    a = (b >> 16) & 0xFFFF
only 16 bits shold be moved and shift should be saved.

etc...



JUSTIFICATION :

- saves memory footprint and should be faster



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -

For comparisons:
on
    if (a & 0xFF > 0x12)
use
    cmp %al, 0x12
on
    if (a & 0xFF00 >= 0x1200)
use
    cmp %ah, 0x12
on
    char a;
    if (a <= 0x11FF)
use
    cmp %ah, 0x12
    jl
instead
    cmp %ax, 0x11FF
    jle

etc...

Comments
EVALUATION Should not do this since the other part of register will not be initialized to 0.
11-10-2011