Opened 7 years ago

Last modified 21 months ago

#4823 new feature request

Loop strength reduction for array indexing

Reported by: tibbe Owned by:
Priority: low Milestone:
Component: Compiler Version: 7.1
Keywords: Cc: wren@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: #7116 Differential Rev(s):
Wiki Page:

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 (9)

comment:1 Changed 7 years ago by igloo

Milestone: 7.2.1

comment:2 Changed 6 years ago by igloo

Milestone: 7.4.17.6.1
Priority: normallow

comment:3 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

comment:4 Changed 3 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:5 Changed 3 years ago by thomie

difficulty: Unknown
Type of failure: None/UnknownRuntime performance bug

comment:6 Changed 3 years ago by thoughtpolice

Milestone: 7.10.17.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:7 Changed 2 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:8 Changed 2 years ago by WrenThornton

Cc: wren@… added

comment:9 Changed 21 months ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.