Path: blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/asm/Register.java
62930 views
/*1* Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324package sun.jvm.hotspot.asm;2526/** <P> Register is an abstraction over machine registers. </P>2728<P> FIXME: should align constants with underlying VM code </P> */2930public abstract class Register extends ImmediateOrRegister {31/** Corresponds to the machine register code. -1 stands for invalid32register (initial value). */33protected int number;3435public Register() {36number = -1;37}3839public Register(int number) {40this.number = number;41}4243/** Must be overridden by subclass to indicate number of available44registers on this platform */45public abstract int getNumberOfRegisters();4647public boolean isValid() {48return ((0 <= number) && (number <= getNumberOfRegisters()));49}5051public int getNumber() {52return number;53}5455public boolean equals(Object x) {56if (x == null) {57return false;58}5960if (!getClass().equals(x.getClass())) {61return false;62}6364Register reg = (Register) x;6566return (reg.getNumber() == getNumber());67}6869public int hashCode() {70return number;71}7273public boolean isRegister() {74return true;75}7677public abstract boolean isStackPointer();78public abstract boolean isFramePointer();79public abstract boolean isFloat();80}818283