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

Use scoped enums to represent RealRegister Enums #2590

Open dchopra001 opened 6 years ago

dchopra001 commented 6 years ago

As part of this issue: https://github.com/eclipse/omr/issues/2491 and this PR: https://github.com/eclipse/omr/pull/2577, we broke TR::RealRegister::RegNum inside compiler/codegen/OMRRealRegister.hpp into two enums.

Initially we had: https://github.com/eclipse/omr/blob/de70faf87f67ffe9cd9571d30e5a378009b85b7c/compiler/codegen/OMRRealRegister.hpp#L61-L65

The new design was to have two scoped enums: RegNum and RegDep, where RegNum represents all hardware backed registers and RegDep represents all hardware backed registers + all register concepts such as TR::RealRegister::AssignAny. However, due to compiler support (MSVC 2010 doesn't support scoped enums) we currently cannot implement scoped enums. So for now https://github.com/eclipse/omr/pull/2577 is a temporary solution which should be improved with scoped enums once support is available.

fjeremic commented 3 years ago

FYI according to [1] OpenJ9 has switched to compile Windows with VS2013 which according to [2] supports scoped (strongly typed) enums since VS2012. We should be able to complete this work item now if we propose for OMR to bump to compiling with VS2013 on Windows as well. We should first double check all the platforms have compiler support though before diving in.

[1] https://openj9.slack.com/archives/C8312LCV9/p1604503096095300 [2] https://docs.microsoft.com/en-us/previous-versions/hh567368(v=vs.140)?redirectedfrom=MSDN

fjeremic commented 3 years ago

Actually just realized that Slack link may expire eventually so I'll link the actual issue https://github.com/eclipse/openj9/issues/10129 here.