< prev index next >

src/hotspot/share/c1/c1_ValueStack.hpp

Print this page
rev 54069 : 8220501: Improve c1_ValueStack locks handling
Reviewed-by: TBD

@@ -45,11 +45,11 @@
   int      _bci;
   Kind     _kind;
 
   Values   _locals;                              // the locals
   Values   _stack;                               // the expression stack
-  Values   _locks;                               // the monitor stack (holding the locked values)
+  Values*  _locks;                               // the monitor stack (holding the locked values)
 
   Value check(ValueTag tag, Value t) {
     assert(tag == t->type()->tag() || tag == objectTag && t->type()->tag() == addressTag, "types must correspond");
     return t;
   }

@@ -58,11 +58,11 @@
     assert(h == NULL, "hi-word of doubleword value must be NULL");
     return check(tag, t);
   }
 
   // helper routine
-  static void apply(Values list, ValueVisitor* f);
+  static void apply(const Values& list, ValueVisitor* f);
 
   // for simplified copying
   ValueStack(ValueStack* copy_from, Kind kind, int bci);
 
  public:

@@ -88,13 +88,13 @@
   int bci() const                                { return _bci; }
   Kind kind() const                              { return _kind; }
 
   int locals_size() const                        { return _locals.length(); }
   int stack_size() const                         { return _stack.length(); }
-  int locks_size() const                         { return _locks.length(); }
+  int locks_size() const                         { return _locks == NULL ? 0 : _locks->length(); }
   bool stack_is_empty() const                    { return _stack.is_empty(); }
-  bool no_active_locks() const                   { return _locks.is_empty(); }
+  bool no_active_locks() const                   { return _locks == NULL || _locks->is_empty(); }
   int total_locks_size() const;
 
   // locals access
   void clear_locals();                           // sets all locals to NULL;
 

@@ -199,11 +199,11 @@
   Values* pop_arguments(int argument_size);
 
   // locks access
   int lock  (Value obj);
   int unlock();
-  Value lock_at(int i) const                     { return _locks.at(i); }
+  Value lock_at(int i) const                     { return _locks->at(i); }
 
   // SSA form IR support
   void setup_phi_for_stack(BlockBegin* b, int index);
   void setup_phi_for_local(BlockBegin* b, int index);
 

@@ -259,18 +259,10 @@
   for (index = 0;                                                                              \
        index < temp_var && (value = state->stack_at(index), true);                             \
        index += value->type()->size())
 
 
-#define for_each_lock_value(state, index, value)                                               \
-  int temp_var = state->locks_size();                                                          \
-  for (index = 0;                                                                              \
-       index < temp_var && (value = state->lock_at(index), true);                              \
-       index++)                                                                                \
-    if (value != NULL)
-
-
 // Macro definition for simple iteration of all state values of a ValueStack
 // Because the code cannot be executed in a single loop, the code must be passed
 // as a macro parameter.
 // Use the following code pattern to iterate all stack values and all nested local values:
 //
< prev index next >