comparison agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCArgument.java @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children c18cbe5936b8
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright 2000-2001 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 package sun.jvm.hotspot.asm.sparc;
26
27 import sun.jvm.hotspot.asm.*;
28 import sun.jvm.hotspot.utilities.*;
29
30 /** SPARCArgument is an abstraction used to represent an outgoing
31 actual argument or an incoming formal parameter, whether it
32 resides in memory or in a register, in a manner consistent with
33 the SPARC Application Binary Interface, or ABI. This is often
34 referred to as the native or C calling convention. */
35
36 public class SPARCArgument {
37 private int number;
38 private boolean isIn;
39
40 // FIXME: add 64-bit stuff here (support for FP registers)
41
42 /** Only 6 registers may contain integer parameters */
43 public static final int NUM_REGISTER_PARAMETERS = 6;
44
45 public SPARCArgument(int number, boolean isIn) {
46 this.number = number;
47 this.isIn = isIn;
48 }
49
50 int getNumber() { return number; }
51 boolean getIsIn() { return isIn; }
52 boolean getIsOut() { return !getIsIn(); }
53
54 public SPARCArgument getSuccessor() { return new SPARCArgument(getNumber() + 1, getIsIn()); }
55 public SPARCArgument asIn() { return new SPARCArgument(getNumber(), true); }
56 public SPARCArgument asOut() { return new SPARCArgument(getNumber(), false); }
57
58 /** Locating register-based arguments */
59 public boolean isRegister() { return number < NUM_REGISTER_PARAMETERS; }
60
61 public SPARCRegister asRegister() {
62 if (Assert.ASSERTS_ENABLED) {
63 Assert.that(isRegister(), "must be a register argument");
64 }
65 return new SPARCRegister(getIsIn() ? SPARCRegisterType.IN : SPARCRegisterType.OUT, getNumber());
66 }
67
68 // locating memory-based arguments (FIXME: elided for now, will
69 // necessitate creating new SPARCAddress class)
70 // public SPARCAddress asAddress() {
71 // if (Assert.ASSERTS_ENABLED) {
72 // Assert.that(!isRegister(), "must be a memory argument");
73 // }
74 // return addressInFrame();
75 // }
76 //
77 // /** When applied to a register-based argument, give the corresponding address
78 // into the 6-word area "into which callee may store register arguments"
79 // (This is a different place than the corresponding register-save area location.) */
80 // public SPARCAddress addressInFrame() const {
81 // return SPARCAddress( is_in() ? Address::extra_in_argument
82 // : Address::extra_out_argument,
83 // _number );
84 // }
85 }