2
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
25
#include "precompiled.hpp"
26
#include "runtime/stackValueCollection.hpp"
28
jint StackValueCollection::int_at(int slot) const {
29
return at(slot)->get_jint();
32
jlong StackValueCollection::long_at(int slot) const {
34
return at(slot+1)->get_intptr();
40
// Interpreter stack is reversed in memory:
41
// low memory location is in higher java local slot.
42
value.array[0] = at(slot+1)->get_intptr();
43
value.array[1] = at(slot )->get_intptr();
48
Handle StackValueCollection::obj_at(int slot) const {
49
return at(slot)->get_obj();
52
jfloat StackValueCollection::float_at(int slot) const {
53
intptr_t res = at(slot)->get_intptr();
54
return *((jfloat*) (&res));
57
jdouble StackValueCollection::double_at(int slot) const {
59
intptr_t res = at(slot+1)->get_intptr();
60
return *((jdouble*) (&res));
66
// Interpreter stack is reversed in memory:
67
// low memory location is in higher java local slot.
68
value.array[0] = at(slot+1)->get_intptr();
69
value.array[1] = at(slot )->get_intptr();
74
void StackValueCollection::set_int_at(int slot, jint value) {
75
at(slot)->set_jint(value);
78
void StackValueCollection::set_long_at(int slot, jlong value) {
80
at(slot+1)->set_intptr(value);
86
// Interpreter stack is reversed in memory:
87
// low memory location is in higher java local slot.
89
at(slot+1)->set_intptr(x.array[0]);
90
at(slot+0)->set_intptr(x.array[1]);
94
void StackValueCollection::set_obj_at(int slot, Handle value) {
95
at(slot)->set_obj(value);
98
void StackValueCollection::set_float_at(int slot, jfloat value) {
104
// Interpreter stores 32 bit floats in first half of 64 bit word.
105
val.array[0] = *(jint*)(&value);
107
at(slot)->set_intptr(val.jd);
109
at(slot)->set_intptr(*(jint*)(&value));
113
void StackValueCollection::set_double_at(int slot, jdouble value) {
115
at(slot+1)->set_intptr(*(intptr_t*)(&value));
121
// Interpreter stack is reversed in memory:
122
// low memory location is in higher java local slot.
124
at(slot+1)->set_intptr(x.array[0]);
125
at(slot+0)->set_intptr(x.array[1]);
130
void StackValueCollection::print() {
131
for(int index = 0; index < size(); index++) {
132
tty->print("\t %2d ", index);
133
at(index)->print_on(tty);
134
if( at(index )->type() == T_INT &&
136
at(index+1)->type() == T_INT ) {
137
tty->print(" " INT64_FORMAT " (long)", (int64_t)long_at(index));
139
tty->print("\t %.15e (double)", double_at(index));
140
tty->print(" " INT64_FORMAT_X_0 " (longhex)", (int64_t)long_at(index));