stackValue.cpp revision 0
0N/A * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A#
include "incls/_precompiled.incl" 0N/A // Stack or register value 0N/A // %%%%% Callee-save floats will NOT be working on a Sparc until we 0N/A // handle the case of a 2 floats in a single double register. 0N/A // First find address of value 0N/A // Value was in a callee-save register 0N/A // Else value was directly saved on the stack. The frame's original stack pointer, 0N/A // before any extension by its callee (due to Compiler1 linkage on SPARC), must be used. 0N/A // Then package it right depending on type 0N/A // Note: the transfer of the data is thru a union that contains 0N/A // an intptr_t. This is because an interpreter stack slot is 0N/A // really an intptr_t. The use of a union containing an intptr_t 0N/A // ensures that on a 64 bit platform we have proper alignment 0N/A // and that we store the value where the interpreter will expect 0N/A // to find it (i.e. proper endian). Similarly on a 32bit platform 0N/A // using the intptr_t ensures that when a value is larger than 0N/A // of the value for the stack slot in question. 0N/A // The callee has no clue whether the register holds a float, 0N/A // double or is unused. He always saves a double. Here we know 0N/A // a double was saved, but we only want a float back. Narrow the 0N/A // saved double to the float that the JVM wants. 0N/A // The callee has no clue whether the register holds an int, 0N/A // long or is unused. He always saves a long. Here we know 0N/A // a long was saved, but we only want an int back. Narrow the 0N/A // saved long to the int that the JVM wants. 0N/A // Double value in an aligned adjacent pair 0N/A // Long value in an aligned adjacent pair 0N/A // Just copy all other bits straight through 0N/A // Constant int: treat same as register int. 0N/A // Constant double in a single stack slot 0N/A // Constant long in a single stack slot 0N/A // Unknown ScopeValue type 0N/A // high: [ ] word_offset + 1 0N/A // low [ ] word_offset 0N/A // the word_offset is the distance from the stack pointer to the lowest address 0N/A // The frame's original stack pointer, before any extension by its callee 0N/A // (due to Compiler1 linkage on SPARC), must be used. 0N/A st->
print(
"%d (int) %f (float) %x (hex)", *(
int *)&
_i, *(
float *)&
_i, *(
int *)&
_i);