annotate src/share/vm/runtime/stackValueCollection.cpp @ 1483:ba37b9335e1e

New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL. This greatly simplifies command line arguments necessary to start the Graal VM.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Mon, 29 Nov 2010 16:58:26 +0100
parents a61af66fc99e
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 2001-2005 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 # include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # include "incls/_stackValueCollection.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 jint StackValueCollection::int_at(int slot) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
29 intptr_t val = at(slot)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
30 jint ival = *((jint*) (&val));
a61af66fc99e Initial load
duke
parents:
diff changeset
31 return ival;
a61af66fc99e Initial load
duke
parents:
diff changeset
32 }
a61af66fc99e Initial load
duke
parents:
diff changeset
33
a61af66fc99e Initial load
duke
parents:
diff changeset
34 jlong StackValueCollection::long_at(int slot) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
35 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
36 return at(slot+1)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
37 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
38 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 jlong jl;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 jint array[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
41 } value;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // Interpreter stack is reversed in memory:
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // low memory location is in higher java local slot.
a61af66fc99e Initial load
duke
parents:
diff changeset
44 value.array[0] = at(slot+1)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
45 value.array[1] = at(slot )->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
46 return value.jl;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
48 }
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 Handle StackValueCollection::obj_at(int slot) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 return at(slot)->get_obj();
a61af66fc99e Initial load
duke
parents:
diff changeset
52 }
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 jfloat StackValueCollection::float_at(int slot) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 intptr_t res = at(slot)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
56 return *((jfloat*) (&res));
a61af66fc99e Initial load
duke
parents:
diff changeset
57 }
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 jdouble StackValueCollection::double_at(int slot) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
60 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
61 intptr_t res = at(slot+1)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
62 return *((jdouble*) (&res));
a61af66fc99e Initial load
duke
parents:
diff changeset
63 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
64 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
65 jdouble jd;
a61af66fc99e Initial load
duke
parents:
diff changeset
66 jint array[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
67 } value;
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // Interpreter stack is reversed in memory:
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // low memory location is in higher java local slot.
a61af66fc99e Initial load
duke
parents:
diff changeset
70 value.array[0] = at(slot+1)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
71 value.array[1] = at(slot )->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
72 return value.jd;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
74 }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 void StackValueCollection::set_int_at(int slot, jint value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 intptr_t val;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 *((jint*) (&val)) = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
79 at(slot)->set_int(val);
a61af66fc99e Initial load
duke
parents:
diff changeset
80 }
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 void StackValueCollection::set_long_at(int slot, jlong value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
84 at(slot+1)->set_int(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
85 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
86 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
87 jlong jl;
a61af66fc99e Initial load
duke
parents:
diff changeset
88 jint array[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
89 } x;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 // Interpreter stack is reversed in memory:
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // low memory location is in higher java local slot.
a61af66fc99e Initial load
duke
parents:
diff changeset
92 x.jl = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 at(slot+1)->set_int(x.array[0]);
a61af66fc99e Initial load
duke
parents:
diff changeset
94 at(slot+0)->set_int(x.array[1]);
a61af66fc99e Initial load
duke
parents:
diff changeset
95 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 void StackValueCollection::set_obj_at(int slot, Handle value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
99 at(slot)->set_obj(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 void StackValueCollection::set_float_at(int slot, jfloat value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
104 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
105 intptr_t jd;
a61af66fc99e Initial load
duke
parents:
diff changeset
106 jint array[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
107 } val;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // Interpreter stores 32 bit floats in first half of 64 bit word.
a61af66fc99e Initial load
duke
parents:
diff changeset
109 val.array[0] = *(jint*)(&value);
a61af66fc99e Initial load
duke
parents:
diff changeset
110 val.array[1] = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
111 at(slot)->set_int(val.jd);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
113 at(slot)->set_int(*(jint*)(&value));
a61af66fc99e Initial load
duke
parents:
diff changeset
114 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
115 }
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 void StackValueCollection::set_double_at(int slot, jdouble value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
118 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
119 at(slot+1)->set_int(*(intptr_t*)(&value));
a61af66fc99e Initial load
duke
parents:
diff changeset
120 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
121 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
122 jdouble jd;
a61af66fc99e Initial load
duke
parents:
diff changeset
123 jint array[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
124 } x;
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // Interpreter stack is reversed in memory:
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // low memory location is in higher java local slot.
a61af66fc99e Initial load
duke
parents:
diff changeset
127 x.jd = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
128 at(slot+1)->set_int(x.array[0]);
a61af66fc99e Initial load
duke
parents:
diff changeset
129 at(slot+0)->set_int(x.array[1]);
a61af66fc99e Initial load
duke
parents:
diff changeset
130 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
131 }
a61af66fc99e Initial load
duke
parents:
diff changeset
132
a61af66fc99e Initial load
duke
parents:
diff changeset
133 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
134 void StackValueCollection::print() {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 for(int index = 0; index < size(); index++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
136 tty->print("\t %2d ", index);
a61af66fc99e Initial load
duke
parents:
diff changeset
137 at(index)->print_on(tty);
a61af66fc99e Initial load
duke
parents:
diff changeset
138 if( at(index )->type() == T_INT &&
a61af66fc99e Initial load
duke
parents:
diff changeset
139 index+1 < size() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
140 at(index+1)->type() == T_INT ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
141 tty->print(" " INT64_FORMAT " (long)", long_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
142 tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
143 tty->print("\t %.15e (double)", double_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
144 tty->print(" " PTR64_FORMAT " (longhex)", long_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
145 }
a61af66fc99e Initial load
duke
parents:
diff changeset
146 tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
147 }
a61af66fc99e Initial load
duke
parents:
diff changeset
148 }
a61af66fc99e Initial load
duke
parents:
diff changeset
149 #endif