diff src/share/vm/adlc/formssel.hpp @ 599:0ad1cb407fa1

6805427: adlc compiler may generate incorrect machnode emission code Reviewed-by: kvn, twisti
author never
date Wed, 25 Feb 2009 10:53:14 -0800
parents ad8c8ca4ab0f
children dbbe28fc66b5
line wrap: on
line diff
--- a/src/share/vm/adlc/formssel.hpp	Tue Feb 24 09:53:20 2009 -0800
+++ b/src/share/vm/adlc/formssel.hpp	Wed Feb 25 10:53:14 2009 -0800
@@ -101,6 +101,7 @@
   const char    *_ins_pipe;        // Instruction Scheduline description class
 
   uint          *_uniq_idx;        // Indexes of unique operands
+  int            _uniq_idx_length; // Length of _uniq_idx array
   uint           _num_uniq;        // Number  of unique operands
   ComponentList  _components;      // List of Components matches MachNode's
                                    // operand structure
@@ -257,11 +258,13 @@
   void                set_unique_opnds();
   uint                num_unique_opnds() { return _num_uniq; }
   uint                unique_opnds_idx(int idx) {
-                        if( _uniq_idx != NULL && idx > 0 )
+                        if( _uniq_idx != NULL && idx > 0 ) {
+                          assert(idx < _uniq_idx_length, "out of bounds");
                           return _uniq_idx[idx];
-                        else
+                        } else {
                           return idx;
-                      }
+                        }
+  }
 
   // Operands which are only KILLs aren't part of the input array and
   // require special handling in some cases.  Their position in this