author | dholmes |
Sat, 23 Jun 2018 01:32:41 -0400 | |
changeset 50735 | 2f2af62dfac7 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
33148
diff
changeset
|
2 |
* Copyright (c) 2001, 2017, 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 |
|
28 |
jint StackValueCollection::int_at(int slot) const { |
|
29 |
intptr_t val = at(slot)->get_int(); |
|
30 |
jint ival = *((jint*) (&val)); |
|
31 |
return ival; |
|
32 |
} |
|
33 |
||
34 |
jlong StackValueCollection::long_at(int slot) const { |
|
35 |
#ifdef _LP64 |
|
36 |
return at(slot+1)->get_int(); |
|
37 |
#else |
|
38 |
union { |
|
39 |
jlong jl; |
|
40 |
jint array[2]; |
|
41 |
} value; |
|
42 |
// Interpreter stack is reversed in memory: |
|
43 |
// low memory location is in higher java local slot. |
|
44 |
value.array[0] = at(slot+1)->get_int(); |
|
45 |
value.array[1] = at(slot )->get_int(); |
|
46 |
return value.jl; |
|
47 |
#endif |
|
48 |
} |
|
49 |
||
50 |
Handle StackValueCollection::obj_at(int slot) const { |
|
51 |
return at(slot)->get_obj(); |
|
52 |
} |
|
53 |
||
54 |
jfloat StackValueCollection::float_at(int slot) const { |
|
55 |
intptr_t res = at(slot)->get_int(); |
|
56 |
return *((jfloat*) (&res)); |
|
57 |
} |
|
58 |
||
59 |
jdouble StackValueCollection::double_at(int slot) const { |
|
60 |
#ifdef _LP64 |
|
61 |
intptr_t res = at(slot+1)->get_int(); |
|
62 |
return *((jdouble*) (&res)); |
|
63 |
#else |
|
64 |
union { |
|
65 |
jdouble jd; |
|
66 |
jint array[2]; |
|
67 |
} value; |
|
68 |
// Interpreter stack is reversed in memory: |
|
69 |
// low memory location is in higher java local slot. |
|
70 |
value.array[0] = at(slot+1)->get_int(); |
|
71 |
value.array[1] = at(slot )->get_int(); |
|
72 |
return value.jd; |
|
73 |
#endif |
|
74 |
} |
|
75 |
||
76 |
void StackValueCollection::set_int_at(int slot, jint value) { |
|
77 |
intptr_t val; |
|
78 |
*((jint*) (&val)) = value; |
|
79 |
at(slot)->set_int(val); |
|
80 |
} |
|
81 |
||
82 |
void StackValueCollection::set_long_at(int slot, jlong value) { |
|
83 |
#ifdef _LP64 |
|
84 |
at(slot+1)->set_int(value); |
|
85 |
#else |
|
86 |
union { |
|
87 |
jlong jl; |
|
88 |
jint array[2]; |
|
89 |
} x; |
|
90 |
// Interpreter stack is reversed in memory: |
|
91 |
// low memory location is in higher java local slot. |
|
92 |
x.jl = value; |
|
93 |
at(slot+1)->set_int(x.array[0]); |
|
94 |
at(slot+0)->set_int(x.array[1]); |
|
95 |
#endif |
|
96 |
} |
|
97 |
||
98 |
void StackValueCollection::set_obj_at(int slot, Handle value) { |
|
99 |
at(slot)->set_obj(value); |
|
100 |
} |
|
101 |
||
102 |
void StackValueCollection::set_float_at(int slot, jfloat value) { |
|
103 |
#ifdef _LP64 |
|
104 |
union { |
|
105 |
intptr_t jd; |
|
106 |
jint array[2]; |
|
107 |
} val; |
|
108 |
// Interpreter stores 32 bit floats in first half of 64 bit word. |
|
109 |
val.array[0] = *(jint*)(&value); |
|
110 |
val.array[1] = 0; |
|
111 |
at(slot)->set_int(val.jd); |
|
112 |
#else |
|
113 |
at(slot)->set_int(*(jint*)(&value)); |
|
114 |
#endif |
|
115 |
} |
|
116 |
||
117 |
void StackValueCollection::set_double_at(int slot, jdouble value) { |
|
118 |
#ifdef _LP64 |
|
119 |
at(slot+1)->set_int(*(intptr_t*)(&value)); |
|
120 |
#else |
|
121 |
union { |
|
122 |
jdouble jd; |
|
123 |
jint array[2]; |
|
124 |
} x; |
|
125 |
// Interpreter stack is reversed in memory: |
|
126 |
// low memory location is in higher java local slot. |
|
127 |
x.jd = value; |
|
128 |
at(slot+1)->set_int(x.array[0]); |
|
129 |
at(slot+0)->set_int(x.array[1]); |
|
130 |
#endif |
|
131 |
} |
|
132 |
||
133 |
#ifndef PRODUCT |
|
134 |
void StackValueCollection::print() { |
|
135 |
for(int index = 0; index < size(); index++) { |
|
136 |
tty->print("\t %2d ", index); |
|
137 |
at(index)->print_on(tty); |
|
138 |
if( at(index )->type() == T_INT && |
|
139 |
index+1 < size() && |
|
140 |
at(index+1)->type() == T_INT ) { |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
33148
diff
changeset
|
141 |
tty->print(" " INT64_FORMAT " (long)", (int64_t)long_at(index)); |
1 | 142 |
tty->cr(); |
143 |
tty->print("\t %.15e (double)", double_at(index)); |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
33148
diff
changeset
|
144 |
tty->print(" " PTR64_FORMAT " (longhex)", (int64_t)long_at(index)); |
1 | 145 |
} |
146 |
tty->cr(); |
|
147 |
} |
|
148 |
} |
|
149 |
#endif |