eclipse-omr / omr

Eclipse OMR™ Cross platform components for building reliable, high performance language runtimes
http://www.eclipse.org/omr
Other
945 stars 396 forks source link

Local compaction is only supported on x86 and Z #5284

Open fjeremic opened 4 years ago

fjeremic commented 4 years ago

While working on #5283 I noticed x86 and Z are the only platforms where we set:

self()->setSupportsCompactedLocals();

This means compact locals is only enabled on those two platforms. Taking a closer look at things it seems the Z support only lives in OpenJ9 [1] which is also a problem. More generally, local compaction doesn't really have to have any real codegen support as the optimization which computes the interference graph is a common opt. The codegen consumes the interference graph and uses the computed graph colors to map locals to stack offsets.

This entire operation should be codegen agnostic, and indeed looking at the x86 and Z implementations of mapCompactedStack [2] [3] we can see that most (all?) of the code can be shared. As part of this task we should do the following:

  1. Sink the Z local compaction from OpenJ9 into OMR
  2. Common the x86 and Z implementations of mapping the compacted stack
  3. Make the implementation cross-codegen and shared
  4. Enable local compaction for all codegens

[1] https://github.com/eclipse/openj9/blob/dc9a6dd43cf060b3ad3e34eb6490570723deb718/runtime/compiler/z/codegen/J9CodeGenerator.cpp#L127-L129 [2] https://github.com/eclipse/omr/blob/77c5c5b76ea1c7685979c5a9b1ee45ad58dca889/compiler/x/codegen/OMRLinkage.cpp#L83-L332 [3] https://github.com/eclipse/openj9/blob/dc9a6dd43cf060b3ad3e34eb6490570723deb718/runtime/compiler/z/codegen/S390PrivateLinkage.cpp#L247-L634

fjeremic commented 4 years ago

@aviansie-ben @knn-k @0xdaryl FYI.

0xdaryl commented 4 years ago

Relevant discussion in OpenJ9: eclipse/openj9#5910