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

Rename common codegen APIs #3373

Open dchopra001 opened 5 years ago

dchopra001 commented 5 years ago

As part of #3316 we identified some common codegen APIs that can be renamed better to be more consistent: https://github.com/eclipse/omr/blob/79be16936d281373a16ebde0cef43a1f06d10b7e/compiler/codegen/OMRCodeGenerator.hpp#L1149-L1156

Specifically: internalControlFlowNestingDepth() can be changed to getInternalControlFlowNestingDepth() and internalControlFlowSafeNestingDepth() can be changed to getInternalControlFlowSafeNestingDepth(). This way the API naming convention will be consisted with how the setters are named here.

We can also change insideInternalControlFlow() to isInsideInternalControlFlow().

0xdaryl commented 5 years ago

This is actually a much more widespread inconsistency throughout the compiler. Many of the "legacy" getters use getMyField() while use of myField() has grown in popularity for many new fields in recent years because of the influence of Objective-C and to improve statement readability ("get" is often implied, and when multiple getters are used in the same statement they just consume real estate). I also suspect each developer has a philosophical preference to a particular style.

It might be worth reining this practice in if we want to maintain a consistent look-and-feel to the codebase and impose a naming style for getters going forward (and with the long term objective of renaming getters named in an alternate style to our agreed-upon style). It's something we could document in a style guide eventually.