Mercurial > hg > truffle
annotate src/share/vm/runtime/stackValueCollection.cpp @ 14247:2e96b2d61686
8031530: [TESTBUG] Enable test runtime/LoadClass/LoadClassNegative.java
Summary: Re-enabled the test. The issue that prevents this test from running was fixed by 8020675
Reviewed-by: sla, ccheung
author | zgu |
---|---|
date | Mon, 13 Jan 2014 10:05:37 -0500 |
parents | 1d1603768966 |
children | 78bbf4d43a14 |
rev | line source |
---|---|
0 | 1 /* |
2426
1d1603768966
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents:
2192
diff
changeset
|
2 * Copyright (c) 2001, 2011, 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 |
43 jint StackValueCollection::int_at(int slot) const { | |
44 intptr_t val = at(slot)->get_int(); | |
45 jint ival = *((jint*) (&val)); | |
46 return ival; | |
47 } | |
48 | |
49 jlong StackValueCollection::long_at(int slot) const { | |
50 #ifdef _LP64 | |
51 return at(slot+1)->get_int(); | |
52 #else | |
53 union { | |
54 jlong jl; | |
55 jint array[2]; | |
56 } value; | |
57 // Interpreter stack is reversed in memory: | |
58 // low memory location is in higher java local slot. | |
59 value.array[0] = at(slot+1)->get_int(); | |
60 value.array[1] = at(slot )->get_int(); | |
61 return value.jl; | |
62 #endif | |
63 } | |
64 | |
65 Handle StackValueCollection::obj_at(int slot) const { | |
66 return at(slot)->get_obj(); | |
67 } | |
68 | |
69 jfloat StackValueCollection::float_at(int slot) const { | |
70 intptr_t res = at(slot)->get_int(); | |
71 return *((jfloat*) (&res)); | |
72 } | |
73 | |
74 jdouble StackValueCollection::double_at(int slot) const { | |
75 #ifdef _LP64 | |
76 intptr_t res = at(slot+1)->get_int(); | |
77 return *((jdouble*) (&res)); | |
78 #else | |
79 union { | |
80 jdouble jd; | |
81 jint array[2]; | |
82 } value; | |
83 // Interpreter stack is reversed in memory: | |
84 // low memory location is in higher java local slot. | |
85 value.array[0] = at(slot+1)->get_int(); | |
86 value.array[1] = at(slot )->get_int(); | |
87 return value.jd; | |
88 #endif | |
89 } | |
90 | |
91 void StackValueCollection::set_int_at(int slot, jint value) { | |
92 intptr_t val; | |
93 *((jint*) (&val)) = value; | |
94 at(slot)->set_int(val); | |
95 } | |
96 | |
97 void StackValueCollection::set_long_at(int slot, jlong value) { | |
98 #ifdef _LP64 | |
99 at(slot+1)->set_int(value); | |
100 #else | |
101 union { | |
102 jlong jl; | |
103 jint array[2]; | |
104 } x; | |
105 // Interpreter stack is reversed in memory: | |
106 // low memory location is in higher java local slot. | |
107 x.jl = value; | |
108 at(slot+1)->set_int(x.array[0]); | |
109 at(slot+0)->set_int(x.array[1]); | |
110 #endif | |
111 } | |
112 | |
113 void StackValueCollection::set_obj_at(int slot, Handle value) { | |
114 at(slot)->set_obj(value); | |
115 } | |
116 | |
117 void StackValueCollection::set_float_at(int slot, jfloat value) { | |
118 #ifdef _LP64 | |
119 union { | |
120 intptr_t jd; | |
121 jint array[2]; | |
122 } val; | |
123 // Interpreter stores 32 bit floats in first half of 64 bit word. | |
124 val.array[0] = *(jint*)(&value); | |
125 val.array[1] = 0; | |
126 at(slot)->set_int(val.jd); | |
127 #else | |
128 at(slot)->set_int(*(jint*)(&value)); | |
129 #endif | |
130 } | |
131 | |
132 void StackValueCollection::set_double_at(int slot, jdouble value) { | |
133 #ifdef _LP64 | |
134 at(slot+1)->set_int(*(intptr_t*)(&value)); | |
135 #else | |
136 union { | |
137 jdouble jd; | |
138 jint array[2]; | |
139 } x; | |
140 // Interpreter stack is reversed in memory: | |
141 // low memory location is in higher java local slot. | |
142 x.jd = value; | |
143 at(slot+1)->set_int(x.array[0]); | |
144 at(slot+0)->set_int(x.array[1]); | |
145 #endif | |
146 } | |
147 | |
148 #ifndef PRODUCT | |
149 void StackValueCollection::print() { | |
150 for(int index = 0; index < size(); index++) { | |
151 tty->print("\t %2d ", index); | |
152 at(index)->print_on(tty); | |
153 if( at(index )->type() == T_INT && | |
154 index+1 < size() && | |
155 at(index+1)->type() == T_INT ) { | |
156 tty->print(" " INT64_FORMAT " (long)", long_at(index)); | |
157 tty->cr(); | |
158 tty->print("\t %.15e (double)", double_at(index)); | |
159 tty->print(" " PTR64_FORMAT " (longhex)", long_at(index)); | |
160 } | |
161 tty->cr(); | |
162 } | |
163 } | |
164 #endif |