author | jwilhelm |
Thu, 05 Mar 2015 17:27:16 +0100 | |
changeset 29332 | c2364e06aa8d |
parent 25715 | d5a8dbdc5150 |
child 33148 | 68fa8b6c4340 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
8921
diff
changeset
|
2 |
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "runtime/stackValueCollection.hpp" |
|
1 | 27 |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
8921
diff
changeset
|
28 |
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC |
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
8921
diff
changeset
|
29 |
|
1 | 30 |
jint StackValueCollection::int_at(int slot) const { |
31 |
intptr_t val = at(slot)->get_int(); |
|
32 |
jint ival = *((jint*) (&val)); |
|
33 |
return ival; |
|
34 |
} |
|
35 |
||
36 |
jlong StackValueCollection::long_at(int slot) const { |
|
37 |
#ifdef _LP64 |
|
38 |
return at(slot+1)->get_int(); |
|
39 |
#else |
|
40 |
union { |
|
41 |
jlong jl; |
|
42 |
jint array[2]; |
|
43 |
} value; |
|
44 |
// Interpreter stack is reversed in memory: |
|
45 |
// low memory location is in higher java local slot. |
|
46 |
value.array[0] = at(slot+1)->get_int(); |
|
47 |
value.array[1] = at(slot )->get_int(); |
|
48 |
return value.jl; |
|
49 |
#endif |
|
50 |
} |
|
51 |
||
52 |
Handle StackValueCollection::obj_at(int slot) const { |
|
53 |
return at(slot)->get_obj(); |
|
54 |
} |
|
55 |
||
56 |
jfloat StackValueCollection::float_at(int slot) const { |
|
57 |
intptr_t res = at(slot)->get_int(); |
|
58 |
return *((jfloat*) (&res)); |
|
59 |
} |
|
60 |
||
61 |
jdouble StackValueCollection::double_at(int slot) const { |
|
62 |
#ifdef _LP64 |
|
63 |
intptr_t res = at(slot+1)->get_int(); |
|
64 |
return *((jdouble*) (&res)); |
|
65 |
#else |
|
66 |
union { |
|
67 |
jdouble jd; |
|
68 |
jint array[2]; |
|
69 |
} value; |
|
70 |
// Interpreter stack is reversed in memory: |
|
71 |
// low memory location is in higher java local slot. |
|
72 |
value.array[0] = at(slot+1)->get_int(); |
|
73 |
value.array[1] = at(slot )->get_int(); |
|
74 |
return value.jd; |
|
75 |
#endif |
|
76 |
} |
|
77 |
||
78 |
void StackValueCollection::set_int_at(int slot, jint value) { |
|
79 |
intptr_t val; |
|
80 |
*((jint*) (&val)) = value; |
|
81 |
at(slot)->set_int(val); |
|
82 |
} |
|
83 |
||
84 |
void StackValueCollection::set_long_at(int slot, jlong value) { |
|
85 |
#ifdef _LP64 |
|
86 |
at(slot+1)->set_int(value); |
|
87 |
#else |
|
88 |
union { |
|
89 |
jlong jl; |
|
90 |
jint array[2]; |
|
91 |
} x; |
|
92 |
// Interpreter stack is reversed in memory: |
|
93 |
// low memory location is in higher java local slot. |
|
94 |
x.jl = value; |
|
95 |
at(slot+1)->set_int(x.array[0]); |
|
96 |
at(slot+0)->set_int(x.array[1]); |
|
97 |
#endif |
|
98 |
} |
|
99 |
||
100 |
void StackValueCollection::set_obj_at(int slot, Handle value) { |
|
101 |
at(slot)->set_obj(value); |
|
102 |
} |
|
103 |
||
104 |
void StackValueCollection::set_float_at(int slot, jfloat value) { |
|
105 |
#ifdef _LP64 |
|
106 |
union { |
|
107 |
intptr_t jd; |
|
108 |
jint array[2]; |
|
109 |
} val; |
|
110 |
// Interpreter stores 32 bit floats in first half of 64 bit word. |
|
111 |
val.array[0] = *(jint*)(&value); |
|
112 |
val.array[1] = 0; |
|
113 |
at(slot)->set_int(val.jd); |
|
114 |
#else |
|
115 |
at(slot)->set_int(*(jint*)(&value)); |
|
116 |
#endif |
|
117 |
} |
|
118 |
||
119 |
void StackValueCollection::set_double_at(int slot, jdouble value) { |
|
120 |
#ifdef _LP64 |
|
121 |
at(slot+1)->set_int(*(intptr_t*)(&value)); |
|
122 |
#else |
|
123 |
union { |
|
124 |
jdouble jd; |
|
125 |
jint array[2]; |
|
126 |
} x; |
|
127 |
// Interpreter stack is reversed in memory: |
|
128 |
// low memory location is in higher java local slot. |
|
129 |
x.jd = value; |
|
130 |
at(slot+1)->set_int(x.array[0]); |
|
131 |
at(slot+0)->set_int(x.array[1]); |
|
132 |
#endif |
|
133 |
} |
|
134 |
||
135 |
#ifndef PRODUCT |
|
136 |
void StackValueCollection::print() { |
|
137 |
for(int index = 0; index < size(); index++) { |
|
138 |
tty->print("\t %2d ", index); |
|
139 |
at(index)->print_on(tty); |
|
140 |
if( at(index )->type() == T_INT && |
|
141 |
index+1 < size() && |
|
142 |
at(index+1)->type() == T_INT ) { |
|
143 |
tty->print(" " INT64_FORMAT " (long)", long_at(index)); |
|
144 |
tty->cr(); |
|
145 |
tty->print("\t %.15e (double)", double_at(index)); |
|
146 |
tty->print(" " PTR64_FORMAT " (longhex)", long_at(index)); |
|
147 |
} |
|
148 |
tty->cr(); |
|
149 |
} |
|
150 |
} |
|
151 |
#endif |