RVM

Modify the implementation of table switch

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 3.0.1
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Activity

Hide
Ian Rogers added a comment -

The current implementation of table switches is messy and also causes problems for call-return based prediction on Intel processors (ie we implement tableswitches by modifying the PC value on the stack). I believe the following is more optimal, it uses an out-of-line thunk routine on IA32 and just an EIP move on x86-64:

T0 = getPCThunk() or RIP less offset from start of method
T0 += [T0 + m<<2 + tableDisplacement]
JMP T0
alignment NOP
tableDisplacement:
OFFSET 0 (case 0 target)
OFFSET 1 (case 1 target)
...
OFFSET n (case n target)

Show
Ian Rogers added a comment - The current implementation of table switches is messy and also causes problems for call-return based prediction on Intel processors (ie we implement tableswitches by modifying the PC value on the stack). I believe the following is more optimal, it uses an out-of-line thunk routine on IA32 and just an EIP move on x86-64: T0 = getPCThunk() or RIP less offset from start of method T0 += [T0 + m<<2 + tableDisplacement] JMP T0 alignment NOP tableDisplacement: OFFSET 0 (case 0 target) OFFSET 1 (case 1 target) ... OFFSET n (case n target)
Hide
Ian Rogers added a comment -

Fixed in r15045 with a healthy near 15% speedup of DaCapo luindex.

Show
Ian Rogers added a comment - Fixed in r15045 with a healthy near 15% speedup of DaCapo luindex.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: