annotate src/share/vm/runtime/stackValueCollection.cpp @ 18096:ca6d25be853b jdk8u25-b13

8044269: Analysis of archive files. Summary: Add checksum verification. Reviewed-by: iklam, dholmes, mschoene
author jiangli
date Tue, 12 Aug 2014 17:46:16 -0400
parents 78bbf4d43a14
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "runtime/stackValueCollection.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #ifdef TARGET_ARCH_x86
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 # include "jniTypes_x86.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #ifdef TARGET_ARCH_sparc
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 # include "jniTypes_sparc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #ifdef TARGET_ARCH_zero
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 # include "jniTypes_zero.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
45 jint StackValueCollection::int_at(int slot) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
46 intptr_t val = at(slot)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
47 jint ival = *((jint*) (&val));
a61af66fc99e Initial load
duke
parents:
diff changeset
48 return ival;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 }
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 jlong StackValueCollection::long_at(int slot) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
52 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
53 return at(slot+1)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
54 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
55 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
56 jlong jl;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 jint array[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
58 } value;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // Interpreter stack is reversed in memory:
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // low memory location is in higher java local slot.
a61af66fc99e Initial load
duke
parents:
diff changeset
61 value.array[0] = at(slot+1)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
62 value.array[1] = at(slot )->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
63 return value.jl;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
65 }
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 Handle StackValueCollection::obj_at(int slot) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 return at(slot)->get_obj();
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 jfloat StackValueCollection::float_at(int slot) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 intptr_t res = at(slot)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
73 return *((jfloat*) (&res));
a61af66fc99e Initial load
duke
parents:
diff changeset
74 }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 jdouble StackValueCollection::double_at(int slot) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
78 intptr_t res = at(slot+1)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
79 return *((jdouble*) (&res));
a61af66fc99e Initial load
duke
parents:
diff changeset
80 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
81 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 jdouble jd;
a61af66fc99e Initial load
duke
parents:
diff changeset
83 jint array[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
84 } value;
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // Interpreter stack is reversed in memory:
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // low memory location is in higher java local slot.
a61af66fc99e Initial load
duke
parents:
diff changeset
87 value.array[0] = at(slot+1)->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
88 value.array[1] = at(slot )->get_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
89 return value.jd;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
91 }
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 void StackValueCollection::set_int_at(int slot, jint value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 intptr_t val;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 *((jint*) (&val)) = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 at(slot)->set_int(val);
a61af66fc99e Initial load
duke
parents:
diff changeset
97 }
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 void StackValueCollection::set_long_at(int slot, jlong value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
101 at(slot+1)->set_int(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
103 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 jlong jl;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 jint array[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
106 } x;
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // Interpreter stack is reversed in memory:
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // low memory location is in higher java local slot.
a61af66fc99e Initial load
duke
parents:
diff changeset
109 x.jl = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
110 at(slot+1)->set_int(x.array[0]);
a61af66fc99e Initial load
duke
parents:
diff changeset
111 at(slot+0)->set_int(x.array[1]);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 void StackValueCollection::set_obj_at(int slot, Handle value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 at(slot)->set_obj(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
117 }
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 void StackValueCollection::set_float_at(int slot, jfloat value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
120 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
121 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
122 intptr_t jd;
a61af66fc99e Initial load
duke
parents:
diff changeset
123 jint array[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
124 } val;
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // Interpreter stores 32 bit floats in first half of 64 bit word.
a61af66fc99e Initial load
duke
parents:
diff changeset
126 val.array[0] = *(jint*)(&value);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 val.array[1] = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
128 at(slot)->set_int(val.jd);
a61af66fc99e Initial load
duke
parents:
diff changeset
129 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
130 at(slot)->set_int(*(jint*)(&value));
a61af66fc99e Initial load
duke
parents:
diff changeset
131 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
132 }
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 void StackValueCollection::set_double_at(int slot, jdouble value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
136 at(slot+1)->set_int(*(intptr_t*)(&value));
a61af66fc99e Initial load
duke
parents:
diff changeset
137 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
138 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
139 jdouble jd;
a61af66fc99e Initial load
duke
parents:
diff changeset
140 jint array[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
141 } x;
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // Interpreter stack is reversed in memory:
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // low memory location is in higher java local slot.
a61af66fc99e Initial load
duke
parents:
diff changeset
144 x.jd = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
145 at(slot+1)->set_int(x.array[0]);
a61af66fc99e Initial load
duke
parents:
diff changeset
146 at(slot+0)->set_int(x.array[1]);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
148 }
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
151 void StackValueCollection::print() {
a61af66fc99e Initial load
duke
parents:
diff changeset
152 for(int index = 0; index < size(); index++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
153 tty->print("\t %2d ", index);
a61af66fc99e Initial load
duke
parents:
diff changeset
154 at(index)->print_on(tty);
a61af66fc99e Initial load
duke
parents:
diff changeset
155 if( at(index )->type() == T_INT &&
a61af66fc99e Initial load
duke
parents:
diff changeset
156 index+1 < size() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
157 at(index+1)->type() == T_INT ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
158 tty->print(" " INT64_FORMAT " (long)", long_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
159 tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
160 tty->print("\t %.15e (double)", double_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
161 tty->print(" " PTR64_FORMAT " (longhex)", long_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
162 }
a61af66fc99e Initial load
duke
parents:
diff changeset
163 tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
164 }
a61af66fc99e Initial load
duke
parents:
diff changeset
165 }
a61af66fc99e Initial load
duke
parents:
diff changeset
166 #endif