1 /*
2 * Copyright 2000-2006 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 *
189 // Then package it right depending on type
190 if (loc.holdsFloat()) { // Holds a float in a double register?
191 // The callee has no clue whether the register holds a float,
192 // double or is unused. He always saves a double. Here we know
193 // a double was saved, but we only want a float back. Narrow the
194 // saved double to the float that the JVM wants.
195 if (Assert.ASSERTS_ENABLED) {
196 Assert.that( loc.isRegister(), "floats always saved to stack in 1 word" );
197 }
198 float value = (float) valueAddr.getJDoubleAt(0);
199 return new StackValue(Float.floatToIntBits(value) & 0xFFFFFFFF); // 64-bit high half is stack junk
200 } else if (loc.holdsInt()) { // Holds an int in a long register?
201 // The callee has no clue whether the register holds an int,
202 // long or is unused. He always saves a long. Here we know
203 // a long was saved, but we only want an int back. Narrow the
204 // saved long to the int that the JVM wants.
205 if (Assert.ASSERTS_ENABLED) {
206 Assert.that( loc.isRegister(), "ints always saved to stack in 1 word" );
207 }
208 return new StackValue(valueAddr.getJLongAt(0) & 0xFFFFFFFF);
209 } else if( loc.holdsOop() ) { // Holds an oop?
210 return new StackValue(valueAddr.getOopHandleAt(0));
211 } else if( loc.holdsDouble() ) {
212 // Double value in a single stack slot
213 return new StackValue(valueAddr.getJIntAt(0) & 0xFFFFFFFF);
214 } else if(loc.holdsAddr()) {
215 if (Assert.ASSERTS_ENABLED) {
216 Assert.that(!VM.getVM().isServerCompiler(), "No address type for locations with C2 (jsr-s are inlined)");
217 }
218 // FIXME: not yet implemented (no access to safepoint state yet)
219 return new StackValue(0);
220 // intptr_t return_addr_tmp = *(intptr_t *)value_addr;
221 // int bci = -1;
222 // // Get the bci of the jsr that generated this returnAddress value.
223 // // If the destination of a jsr is a block that ends with a return or throw, then
224 // // the GraphBuilder converts the jsr into a direct goto. This has the side effect that
225 // // the return address for the jsr gets emitted as a bci instead of as a real pc
226 // if (code()->contains((address)return_addr_tmp)) {
227 // ScopeDesc* scope = code()->scope_desc_at((address)(return_addr_tmp - jsr_call_offset), false);
228 // bci = scope->bci();
|
1 /*
2 * Copyright 2000-2008 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 *
189 // Then package it right depending on type
190 if (loc.holdsFloat()) { // Holds a float in a double register?
191 // The callee has no clue whether the register holds a float,
192 // double or is unused. He always saves a double. Here we know
193 // a double was saved, but we only want a float back. Narrow the
194 // saved double to the float that the JVM wants.
195 if (Assert.ASSERTS_ENABLED) {
196 Assert.that( loc.isRegister(), "floats always saved to stack in 1 word" );
197 }
198 float value = (float) valueAddr.getJDoubleAt(0);
199 return new StackValue(Float.floatToIntBits(value) & 0xFFFFFFFF); // 64-bit high half is stack junk
200 } else if (loc.holdsInt()) { // Holds an int in a long register?
201 // The callee has no clue whether the register holds an int,
202 // long or is unused. He always saves a long. Here we know
203 // a long was saved, but we only want an int back. Narrow the
204 // saved long to the int that the JVM wants.
205 if (Assert.ASSERTS_ENABLED) {
206 Assert.that( loc.isRegister(), "ints always saved to stack in 1 word" );
207 }
208 return new StackValue(valueAddr.getJLongAt(0) & 0xFFFFFFFF);
209 } else if (loc.holdsNarrowOop()) { // Holds an narrow oop?
210 if (loc.isRegister() && VM.getVM().isBigEndian()) {
211 // The callee has no clue whether the register holds an narrow oop,
212 // long or is unused. He always saves a long. Here we know
213 // a long was saved, but we only want an narrow oop back. Narrow the
214 // saved long to the narrow oop that the JVM wants.
215 return new StackValue(valueAddr.getCompOopHandleAt(VM.getVM().getIntSize()));
216 } else {
217 return new StackValue(valueAddr.getCompOopHandleAt(0));
218 }
219 } else if( loc.holdsOop() ) { // Holds an oop?
220 return new StackValue(valueAddr.getOopHandleAt(0));
221 } else if( loc.holdsDouble() ) {
222 // Double value in a single stack slot
223 return new StackValue(valueAddr.getJIntAt(0) & 0xFFFFFFFF);
224 } else if(loc.holdsAddr()) {
225 if (Assert.ASSERTS_ENABLED) {
226 Assert.that(!VM.getVM().isServerCompiler(), "No address type for locations with C2 (jsr-s are inlined)");
227 }
228 // FIXME: not yet implemented (no access to safepoint state yet)
229 return new StackValue(0);
230 // intptr_t return_addr_tmp = *(intptr_t *)value_addr;
231 // int bci = -1;
232 // // Get the bci of the jsr that generated this returnAddress value.
233 // // If the destination of a jsr is a block that ends with a return or throw, then
234 // // the GraphBuilder converts the jsr into a direct goto. This has the side effect that
235 // // the return address for the jsr gets emitted as a bci instead of as a real pc
236 // if (code()->contains((address)return_addr_tmp)) {
237 // ScopeDesc* scope = code()->scope_desc_at((address)(return_addr_tmp - jsr_call_offset), false);
238 // bci = scope->bci();
|