hotspot/src/share/vm/code/vmreg.cpp

Print this page
rev 611 : Merge
   1 #ifdef USE_PRAGMA_IDENT_SRC
   2 #pragma ident "@(#)vmreg.cpp    1.35 07/05/05 17:05:22 JVM"
   3 #endif
   4 /*
   5  * Copyright 1998-2007 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  
  26  */
  27 
  28 #include "incls/_precompiled.incl"
  29 #include "incls/_vmreg.cpp.incl"
  30 
  31 // First VMReg value that could refer to a stack slot
  32 VMReg VMRegImpl::stack0 = (VMReg)(intptr_t)((ConcreteRegisterImpl::number_of_registers + 1) & ~1);
  33 
  34 // VMRegs are 4 bytes wide on all platforms
  35 const int VMRegImpl::stack_slot_size = 4;
  36 const int VMRegImpl::slots_per_word = wordSize / stack_slot_size;
  37 
  38 const int VMRegImpl::register_count = ConcreteRegisterImpl::number_of_registers;
  39 // Register names
  40 const char *VMRegImpl::regName[ConcreteRegisterImpl::number_of_registers];
  41 
  42 void VMRegImpl::print() {
  43 #ifndef PRODUCT
  44   if( is_reg() ) {
  45     assert( VMRegImpl::regName[value()], "" );
  46     tty->print("%s",VMRegImpl::regName[value()]);
  47   } else if (is_stack()) {
  48     int stk = value() - stack0->value();
  49     tty->print("[%d]", stk*4);
  50   } else {
  51     tty->print("BAD!");
  52   }
  53 #endif // PRODUCT
  54 }
   1 #ifdef USE_PRAGMA_IDENT_SRC
   2 #pragma ident "@(#)vmreg.cpp    1.35 07/05/05 17:05:22 JVM"
   3 #endif
   4 /*
   5  * Copyright 1998-2008 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  
  26  */
  27 
  28 #include "incls/_precompiled.incl"
  29 #include "incls/_vmreg.cpp.incl"
  30 
  31 // First VMReg value that could refer to a stack slot
  32 VMReg VMRegImpl::stack0 = (VMReg)(intptr_t)((ConcreteRegisterImpl::number_of_registers + 1) & ~1);
  33 
  34 // VMRegs are 4 bytes wide on all platforms
  35 const int VMRegImpl::stack_slot_size = 4;
  36 const int VMRegImpl::slots_per_word = wordSize / stack_slot_size;
  37 
  38 const int VMRegImpl::register_count = ConcreteRegisterImpl::number_of_registers;
  39 // Register names
  40 const char *VMRegImpl::regName[ConcreteRegisterImpl::number_of_registers];
  41 
  42 void VMRegImpl::print_on(outputStream* st) const {

  43   if( is_reg() ) {
  44     assert( VMRegImpl::regName[value()], "" );
  45     st->print("%s",VMRegImpl::regName[value()]);
  46   } else if (is_stack()) {
  47     int stk = value() - stack0->value();
  48     st->print("[%d]", stk*4);
  49   } else {
  50     st->print("BAD!");
  51   }

  52 }