eclipse / omr

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

Simplify handling of references (compressed, full, mixed-static, mixed-dynamic) #5695

Open sharon-wang opened 3 years ago

sharon-wang commented 3 years ago

Related: https://github.com/ibmruntimes/openj9-openjdk-jdk11/issues/361 More mixed builds discussion: https://github.com/eclipse/openj9/issues/8878.

Suggested by @keithc-ca in https://github.com/eclipse/omr/pull/5657:

I think there should be plans to simplify the handling of references. Back when the only choices were compressed or not, OMR_GC_COMPRESSED_POINTERS was a reasonable flag. We've since added OMR_GC_FULL_POINTERS and OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES and, in my opinion, it's tough to juggle all the combinations in one's head. I think it would be clearer if there was one macro, say, OMR_GC_POINTER_MODE, which would be configured as one of the following:

* `OMR_GC_POINTER_MODE_FULL` - no compression (the only choice for 32-bit environments)

* `OMR_GC_POINTER_MODE_COMPRESSED` - compressed pointers (what `OMR_GC_COMPRESSED_POINTERS` used to mean)

* `OMR_GC_POINTER_MODE_MIXED_STATIC` - both compressed and non-compressed references supported by compiling certain code twice

* `OMR_GC_POINTER_MODE_MIXED_DYNAMIC` - both compressed and non-compressed references supported via dynamic runtime tests

Here's a table with all the settings, for reference (based on the implementation in https://github.com/eclipse/omr/pull/5657): Configure Mode OMR_GC_POINTER_MODE OMR_GC_COMPRESSED_POINTERS OMR_GC_FULL_POINTERS OMR_MIXED_REFERENCES_MODE_STATIC OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES
compressed compressed ON OFF OFF UNDEFINED
full full OFF ON OFF UNDEFINED
mixed-static mixed ON ON ON DEFINED (0 or 1)
mixed-dynamic mixed ON ON OFF UNDEFINED

Going with Keith's proposal, we would no longer need OMR_MIXED_REFERENCES_MODE_STATIC, since we could work with OMR_GC_POINTER_MODE=OMR_GC_POINTER_MODE_MIXED_STATIC. We could also remove OMR_GC_COMPRESSED_POINTERS/OMR_GC_FULL_POINTERS and replace them with OMR_GC_POINTER_MODE=OMR_GC_POINTER_MODE_FULL/OMR_GC_POINTER_MODE_COMPRESSED. However, we'd still need OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES so that the separate regular/full libraries built in static can have the appropriate pointer mode set.

sharon-wang commented 3 years ago

FYI @gacholio

fjeremic commented 3 years ago

@amicic @dmitripivkine FYI.