src/share/vm/opto/optoreg.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7088955 Sdiff src/share/vm/opto

src/share/vm/opto/optoreg.hpp

Print this page


   1 /*
   2  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 155 // Pairs of 32-bit registers for the allocator.
 156 // This is a very similar class to VMRegPair. C2 only interfaces with VMRegPair
 157 // via the calling convention code which is shared between the compilers.
 158 // Since C2 uses OptoRegs for register allocation it is more efficient to use
 159 // VMRegPair internally for nodes that can contain a pair of OptoRegs rather
 160 // than use VMRegPair and continually be converting back and forth. So normally
 161 // C2 will take in a VMRegPair from the calling convention code and immediately
 162 // convert them to an OptoRegPair and stay in the OptoReg world. The only over
 163 // conversion between OptoRegs and VMRegs is for debug info and oopMaps. This
 164 // is not a high bandwidth spot and so it is not an issue.
 165 // Note that onde other consequence of staying in the OptoReg world with OptoRegPairs
 166 // is that there are "physical" OptoRegs that are not representable in the VMReg
 167 // world, notably flags. [ But by design there is "space" in the VMReg world
 168 // for such registers they just may not be concrete ]. So if we were to use VMRegPair
 169 // then the VMReg world would have to have a representation for these registers
 170 // so that a OptoReg->VMReg->OptoReg would reproduce ther original OptoReg. As it
 171 // stands if you convert a flag (condition code) to a VMReg you will get VMRegImpl::Bad
 172 // and converting that will return OptoReg::Bad losing the identity of the OptoReg.
 173 
 174 class OptoRegPair {

 175 private:
 176   short _second;
 177   short _first;
 178 public:
 179   void set_bad (                   ) { _second = OptoReg::Bad; _first = OptoReg::Bad; }
 180   void set1    ( OptoReg::Name n  ) { _second = OptoReg::Bad; _first = n; }
 181   void set2    ( OptoReg::Name n  ) { _second = n + 1;       _first = n; }
 182   void set_pair( OptoReg::Name second, OptoReg::Name first    ) { _second= second;    _first= first; }
 183   void set_ptr ( OptoReg::Name ptr ) {
 184 #ifdef _LP64
 185     _second = ptr+1;
 186 #else
 187     _second = OptoReg::Bad;
 188 #endif
 189     _first = ptr;
 190   }
 191 
 192   OptoReg::Name second() const { return _second; }
 193   OptoReg::Name first() const { return _first; }
 194   OptoRegPair(OptoReg::Name second, OptoReg::Name first) {  _second = second; _first = first; }
   1 /*
   2  * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 155 // Pairs of 32-bit registers for the allocator.
 156 // This is a very similar class to VMRegPair. C2 only interfaces with VMRegPair
 157 // via the calling convention code which is shared between the compilers.
 158 // Since C2 uses OptoRegs for register allocation it is more efficient to use
 159 // VMRegPair internally for nodes that can contain a pair of OptoRegs rather
 160 // than use VMRegPair and continually be converting back and forth. So normally
 161 // C2 will take in a VMRegPair from the calling convention code and immediately
 162 // convert them to an OptoRegPair and stay in the OptoReg world. The only over
 163 // conversion between OptoRegs and VMRegs is for debug info and oopMaps. This
 164 // is not a high bandwidth spot and so it is not an issue.
 165 // Note that onde other consequence of staying in the OptoReg world with OptoRegPairs
 166 // is that there are "physical" OptoRegs that are not representable in the VMReg
 167 // world, notably flags. [ But by design there is "space" in the VMReg world
 168 // for such registers they just may not be concrete ]. So if we were to use VMRegPair
 169 // then the VMReg world would have to have a representation for these registers
 170 // so that a OptoReg->VMReg->OptoReg would reproduce ther original OptoReg. As it
 171 // stands if you convert a flag (condition code) to a VMReg you will get VMRegImpl::Bad
 172 // and converting that will return OptoReg::Bad losing the identity of the OptoReg.
 173 
 174 class OptoRegPair {
 175   friend class VMStructs;
 176 private:
 177   short _second;
 178   short _first;
 179 public:
 180   void set_bad (                   ) { _second = OptoReg::Bad; _first = OptoReg::Bad; }
 181   void set1    ( OptoReg::Name n  ) { _second = OptoReg::Bad; _first = n; }
 182   void set2    ( OptoReg::Name n  ) { _second = n + 1;       _first = n; }
 183   void set_pair( OptoReg::Name second, OptoReg::Name first    ) { _second= second;    _first= first; }
 184   void set_ptr ( OptoReg::Name ptr ) {
 185 #ifdef _LP64
 186     _second = ptr+1;
 187 #else
 188     _second = OptoReg::Bad;
 189 #endif
 190     _first = ptr;
 191   }
 192 
 193   OptoReg::Name second() const { return _second; }
 194   OptoReg::Name first() const { return _first; }
 195   OptoRegPair(OptoReg::Name second, OptoReg::Name first) {  _second = second; _first = first; }
src/share/vm/opto/optoreg.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File