Mercurial > hg > truffle
annotate src/share/vm/runtime/stackValueCollection.cpp @ 21211:6b11405f0279
Fix typo
author | Stefan Anzinger <stefan.anzinger@oracle.com> |
---|---|
date | Mon, 04 May 2015 08:49:06 +0200 |
parents | 78bbf4d43a14 |
children |
rev | line source |
---|---|
0 | 1 /* |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
2426
diff
changeset
|
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "runtime/stackValueCollection.hpp" | |
27 #ifdef TARGET_ARCH_x86 | |
28 # include "jniTypes_x86.hpp" | |
29 #endif | |
30 #ifdef TARGET_ARCH_sparc | |
31 # include "jniTypes_sparc.hpp" | |
32 #endif | |
33 #ifdef TARGET_ARCH_zero | |
34 # include "jniTypes_zero.hpp" | |
35 #endif | |
2192
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
36 #ifdef TARGET_ARCH_arm |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
37 # include "jniTypes_arm.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
38 #endif |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
39 #ifdef TARGET_ARCH_ppc |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
40 # include "jniTypes_ppc.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
41 #endif |
0 | 42 |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
2426
diff
changeset
|
43 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC |
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
2426
diff
changeset
|
44 |
0 | 45 jint StackValueCollection::int_at(int slot) const { |
46 intptr_t val = at(slot)->get_int(); | |
47 jint ival = *((jint*) (&val)); | |
48 return ival; | |
49 } | |
50 | |
51 jlong StackValueCollection::long_at(int slot) const { | |
52 #ifdef _LP64 | |
53 return at(slot+1)->get_int(); | |
54 #else | |
55 union { | |
56 jlong jl; | |
57 jint array[2]; | |
58 } value; | |
59 // Interpreter stack is reversed in memory: | |
60 // low memory location is in higher java local slot. | |
61 value.array[0] = at(slot+1)->get_int(); | |
62 value.array[1] = at(slot )->get_int(); | |
63 return value.jl; | |
64 #endif | |
65 } | |
66 | |
67 Handle StackValueCollection::obj_at(int slot) const { | |
68 return at(slot)->get_obj(); | |
69 } | |
70 | |
71 jfloat StackValueCollection::float_at(int slot) const { | |
72 intptr_t res = at(slot)->get_int(); | |
73 return *((jfloat*) (&res)); | |
74 } | |
75 | |
76 jdouble StackValueCollection::double_at(int slot) const { | |
77 #ifdef _LP64 | |
78 intptr_t res = at(slot+1)->get_int(); | |
79 return *((jdouble*) (&res)); | |
80 #else | |
81 union { | |
82 jdouble jd; | |
83 jint array[2]; | |
84 } value; | |
85 // Interpreter stack is reversed in memory: | |
86 // low memory location is in higher java local slot. | |
87 value.array[0] = at(slot+1)->get_int(); | |
88 value.array[1] = at(slot )->get_int(); | |
89 return value.jd; | |
90 #endif | |
91 } | |
92 | |
93 void StackValueCollection::set_int_at(int slot, jint value) { | |
94 intptr_t val; | |
95 *((jint*) (&val)) = value; | |
96 at(slot)->set_int(val); | |
97 } | |
98 | |
99 void StackValueCollection::set_long_at(int slot, jlong value) { | |
100 #ifdef _LP64 | |
101 at(slot+1)->set_int(value); | |
102 #else | |
103 union { | |
104 jlong jl; | |
105 jint array[2]; | |
106 } x; | |
107 // Interpreter stack is reversed in memory: | |
108 // low memory location is in higher java local slot. | |
109 x.jl = value; | |
110 at(slot+1)->set_int(x.array[0]); | |
111 at(slot+0)->set_int(x.array[1]); | |
112 #endif | |
113 } | |
114 | |
115 void StackValueCollection::set_obj_at(int slot, Handle value) { | |
116 at(slot)->set_obj(value); | |
117 } | |
118 | |
119 void StackValueCollection::set_float_at(int slot, jfloat value) { | |
120 #ifdef _LP64 | |
121 union { | |
122 intptr_t jd; | |
123 jint array[2]; | |
124 } val; | |
125 // Interpreter stores 32 bit floats in first half of 64 bit word. | |
126 val.array[0] = *(jint*)(&value); | |
127 val.array[1] = 0; | |
128 at(slot)->set_int(val.jd); | |
129 #else | |
130 at(slot)->set_int(*(jint*)(&value)); | |
131 #endif | |
132 } | |
133 | |
134 void StackValueCollection::set_double_at(int slot, jdouble value) { | |
135 #ifdef _LP64 | |
136 at(slot+1)->set_int(*(intptr_t*)(&value)); | |
137 #else | |
138 union { | |
139 jdouble jd; | |
140 jint array[2]; | |
141 } x; | |
142 // Interpreter stack is reversed in memory: | |
143 // low memory location is in higher java local slot. | |
144 x.jd = value; | |
145 at(slot+1)->set_int(x.array[0]); | |
146 at(slot+0)->set_int(x.array[1]); | |
147 #endif | |
148 } | |
149 | |
150 #ifndef PRODUCT | |
151 void StackValueCollection::print() { | |
152 for(int index = 0; index < size(); index++) { | |
153 tty->print("\t %2d ", index); | |
154 at(index)->print_on(tty); | |
155 if( at(index )->type() == T_INT && | |
156 index+1 < size() && | |
157 at(index+1)->type() == T_INT ) { | |
158 tty->print(" " INT64_FORMAT " (long)", long_at(index)); | |
159 tty->cr(); | |
160 tty->print("\t %.15e (double)", double_at(index)); | |
161 tty->print(" " PTR64_FORMAT " (longhex)", long_at(index)); | |
162 } | |
163 tty->cr(); | |
164 } | |
165 } | |
166 #endif |