8213416: Replace some enums with static const members in hotspot/compiler
authorrraghavan
Tue, 28 May 2019 12:01:52 +0530
changeset 55050 feba48c5dfb4
parent 55049 4853b1ceb3d6
child 55051 fb9758536458
8213416: Replace some enums with static const members in hotspot/compiler Summary: Changes to fix enumeral and non-enumeral type in conditional expression warnings with -Wextra for gcc on hotspot Reviewed-by: kvn, thartmann
src/hotspot/share/ci/ciReplay.cpp
src/hotspot/share/opto/machnode.hpp
src/hotspot/share/opto/node.hpp
--- a/src/hotspot/share/ci/ciReplay.cpp	Mon May 27 19:46:34 2019 -0700
+++ b/src/hotspot/share/ci/ciReplay.cpp	Tue May 28 12:01:52 2019 +0530
@@ -532,7 +532,11 @@
     // old version w/o comp_level
     if (had_error() && (error_message() == comp_level_label)) {
       // use highest available tier
-      comp_level = TieredCompilation ? TieredStopAtLevel : CompLevel_highest_tier;
+      if (TieredCompilation) {
+        comp_level = TieredStopAtLevel;
+      } else {
+        comp_level = CompLevel_highest_tier;
+      }
     }
     if (!is_valid_comp_level(comp_level)) {
       return;
--- a/src/hotspot/share/opto/machnode.hpp	Mon May 27 19:46:34 2019 -0700
+++ b/src/hotspot/share/opto/machnode.hpp	Tue May 28 12:01:52 2019 +0530
@@ -301,7 +301,14 @@
 
   // Bottom_type call; value comes from operand0
   virtual const class Type *bottom_type() const { return _opnds[0]->type(); }
-  virtual uint ideal_reg() const { const Type *t = _opnds[0]->type(); return t == TypeInt::CC ? Op_RegFlags : t->ideal_reg(); }
+  virtual uint ideal_reg() const {
+    const Type *t = _opnds[0]->type();
+    if (t == TypeInt::CC) {
+      return Op_RegFlags;
+    } else {
+      return t->ideal_reg();
+    }
+  }
 
   // If this is a memory op, return the base pointer and fixed offset.
   // If there are no such, return NULL.  If there are multiple addresses
--- a/src/hotspot/share/opto/node.hpp	Mon May 27 19:46:34 2019 -0700
+++ b/src/hotspot/share/opto/node.hpp	Tue May 28 12:01:52 2019 +0530
@@ -998,7 +998,7 @@
   // the node is guaranteed never to compare equal to any other node.
   // If we accidentally generate a hash with value NO_HASH the node
   // won't go into the table and we'll lose a little optimization.
-  enum { NO_HASH = 0 };
+  static const uint NO_HASH = 0;
   virtual uint hash() const;
   virtual bool cmp( const Node &n ) const;