Ticket #4823 (new feature request)

Opened 2 years ago

Last modified 8 months ago

Loop strength reduction for array indexing

Reported by: tibbe Owned by:
Priority: low Milestone: 7.6.2
Component: Compiler Version: 7.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Indexing into a ByteArray# in a loop is currently more expensive than working on a ForeignPtr due to lack of strength reduction. Pointer arithmetic is cheaper than using base + offset indexing. We could convert indexing into pointer arithmetic if it weren't for the GC being able to move objects around.

Tom Rodriguez had the following to say about Java HotSpot? and loop strength reduction:

"The server compiler doesn't do explicit loop strength reduction though it can get a bit of it as a result of other transformations loop invariant code motion. I've played a bit with doing it more explicitly but had some difficulty getting benefit from it. The resulting pointers are handled by the notion of derived pointers. These are interior pointers that are tracked along with their base pointers. At the beginning of GC the offset from the base of the derived pointer is saved and the pointer is converted to the base and after GC the offset is added back in. That part all happens automatically. Searching for DerivedPointer? will lead you to the relevant code."

Perhaps it's an idea we could try?

Change History

Changed 2 years ago by igloo

  • milestone set to 7.2.1

Changed 16 months ago by igloo

  • priority changed from normal to low
  • milestone changed from 7.4.1 to 7.6.1

Changed 8 months ago by igloo

  • milestone changed from 7.6.1 to 7.6.2
Note: See TracTickets for help on using tickets.