annotate src/share/vm/utilities/array.hpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 870c03421152
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
14333
26c3b944dc35 8033528: assert(0 <= i && i < length()) failed: index out of bounds
coleenp
parents: 12319
diff changeset
2 * Copyright (c) 2000, 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: 470
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 470
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: 470
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 #ifndef SHARE_VM_UTILITIES_ARRAY_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_UTILITIES_ARRAY_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "memory/allocation.inline.hpp"
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
30 #include "memory/metaspace.hpp"
20197
ce8f6bb717c9 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents: 17937
diff changeset
31 #include "runtime/orderAccess.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32
0
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // correct linkage required to compile w/o warnings
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // (must be on file level - cannot be local)
a61af66fc99e Initial load
duke
parents:
diff changeset
35 extern "C" { typedef int (*ftype)(const void*, const void*); }
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 class ResourceArray: public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
40 int _length; // the number of array elements
a61af66fc99e Initial load
duke
parents:
diff changeset
41 void* _data; // the array memory
a61af66fc99e Initial load
duke
parents:
diff changeset
42 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
43 int _nesting; // the resource area nesting level
a61af66fc99e Initial load
duke
parents:
diff changeset
44 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
47 ResourceArray() {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 _length = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 _data = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 DEBUG_ONLY(init_nesting();)
432
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
51 // client may call initialize, at most once
0
a61af66fc99e Initial load
duke
parents:
diff changeset
52 }
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 ResourceArray(size_t esize, int length) {
432
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
56 DEBUG_ONLY(_data = NULL);
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
57 initialize(esize, length);
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
58 }
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
59
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
60 void initialize(size_t esize, int length) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
61 assert(length >= 0, "illegal length");
14333
26c3b944dc35 8033528: assert(0 <= i && i < length()) failed: index out of bounds
coleenp
parents: 12319
diff changeset
62 assert(StressRewriter || _data == NULL, "must be new object");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
63 _length = length;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 _data = resource_allocate_bytes(esize * length);
a61af66fc99e Initial load
duke
parents:
diff changeset
65 DEBUG_ONLY(init_nesting();)
a61af66fc99e Initial load
duke
parents:
diff changeset
66 }
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
69 void init_nesting();
a61af66fc99e Initial load
duke
parents:
diff changeset
70 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // helper functions
a61af66fc99e Initial load
duke
parents:
diff changeset
73 void sort (size_t esize, ftype f); // sort the array
a61af66fc99e Initial load
duke
parents:
diff changeset
74 void expand (size_t esize, int i, int& size);// expand the array to include slot i
a61af66fc99e Initial load
duke
parents:
diff changeset
75 void remove_at(size_t esize, int i); // remove the element in slot i
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // standard operations
a61af66fc99e Initial load
duke
parents:
diff changeset
79 int length() const { return _length; }
a61af66fc99e Initial load
duke
parents:
diff changeset
80 bool is_empty() const { return length() == 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
81 };
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 1972
diff changeset
84 template <MEMFLAGS F>class CHeapArray: public CHeapObj<F> {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
85 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
86 int _length; // the number of array elements
a61af66fc99e Initial load
duke
parents:
diff changeset
87 void* _data; // the array memory
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
90 CHeapArray() {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 _length = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
92 _data = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 CHeapArray(size_t esize, int length) {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 assert(length >= 0, "illegal length");
a61af66fc99e Initial load
duke
parents:
diff changeset
98 _length = length;
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 1972
diff changeset
99 _data = (void*) NEW_C_HEAP_ARRAY(char *, esize * length, F);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
102 void initialize(size_t esize, int length) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
103 // In debug set array to 0?
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
104 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
105
0
a61af66fc99e Initial load
duke
parents:
diff changeset
106 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
107 void init_nesting();
a61af66fc99e Initial load
duke
parents:
diff changeset
108 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // helper functions
a61af66fc99e Initial load
duke
parents:
diff changeset
111 void sort (size_t esize, ftype f); // sort the array
a61af66fc99e Initial load
duke
parents:
diff changeset
112 void expand (size_t esize, int i, int& size);// expand the array to include slot i
a61af66fc99e Initial load
duke
parents:
diff changeset
113 void remove_at(size_t esize, int i); // remove the element in slot i
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // standard operations
a61af66fc99e Initial load
duke
parents:
diff changeset
117 int length() const { return _length; }
a61af66fc99e Initial load
duke
parents:
diff changeset
118 bool is_empty() const { return length() == 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
119 };
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 #define define_generic_array(array_name,element_type, base_class) \
a61af66fc99e Initial load
duke
parents:
diff changeset
122 class array_name: public base_class { \
a61af66fc99e Initial load
duke
parents:
diff changeset
123 protected: \
a61af66fc99e Initial load
duke
parents:
diff changeset
124 typedef element_type etype; \
a61af66fc99e Initial load
duke
parents:
diff changeset
125 enum { esize = sizeof(etype) }; \
a61af66fc99e Initial load
duke
parents:
diff changeset
126 \
a61af66fc99e Initial load
duke
parents:
diff changeset
127 void base_remove_at(size_t size, int i) { base_class::remove_at(size, i); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
128 \
a61af66fc99e Initial load
duke
parents:
diff changeset
129 public: \
a61af66fc99e Initial load
duke
parents:
diff changeset
130 /* creation */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
131 array_name() : base_class() {} \
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
132 explicit array_name(const int length) : base_class(esize, length) {} \
432
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
133 array_name(const int length, const etype fx) { initialize(length, fx); } \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
134 void initialize(const int length) { base_class::initialize(esize, length); } \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
135 void initialize(const int length, const etype fx) { \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
136 initialize(length); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
137 for (int i = 0; i < length; i++) ((etype*)_data)[i] = fx; \
a61af66fc99e Initial load
duke
parents:
diff changeset
138 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
139 \
a61af66fc99e Initial load
duke
parents:
diff changeset
140 /* standard operations */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
141 etype& operator [] (const int i) const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
142 assert(0 <= i && i < length(), "index out of bounds"); \
a61af66fc99e Initial load
duke
parents:
diff changeset
143 return ((etype*)_data)[i]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
144 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
145 \
a61af66fc99e Initial load
duke
parents:
diff changeset
146 int index_of(const etype x) const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
147 int i = length(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
148 while (i-- > 0 && ((etype*)_data)[i] != x) ; \
a61af66fc99e Initial load
duke
parents:
diff changeset
149 /* i < 0 || ((etype*)_data)_data[i] == x */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
150 return i; \
a61af66fc99e Initial load
duke
parents:
diff changeset
151 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
152 \
a61af66fc99e Initial load
duke
parents:
diff changeset
153 void sort(int f(etype*, etype*)) { base_class::sort(esize, (ftype)f); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
154 bool contains(const etype x) const { return index_of(x) >= 0; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
155 \
a61af66fc99e Initial load
duke
parents:
diff changeset
156 /* deprecated operations - for compatibility with GrowableArray only */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
157 etype at(const int i) const { return (*this)[i]; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
158 void at_put(const int i, const etype x) { (*this)[i] = x; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
159 etype* adr_at(const int i) { return &(*this)[i]; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
160 int find(const etype x) { return index_of(x); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
161 }; \
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163
a61af66fc99e Initial load
duke
parents:
diff changeset
164 #define define_array(array_name,element_type) \
a61af66fc99e Initial load
duke
parents:
diff changeset
165 define_generic_array(array_name, element_type, ResourceArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167
a61af66fc99e Initial load
duke
parents:
diff changeset
168 #define define_stack(stack_name,array_name) \
a61af66fc99e Initial load
duke
parents:
diff changeset
169 class stack_name: public array_name { \
a61af66fc99e Initial load
duke
parents:
diff changeset
170 protected: \
a61af66fc99e Initial load
duke
parents:
diff changeset
171 int _size; \
a61af66fc99e Initial load
duke
parents:
diff changeset
172 \
a61af66fc99e Initial load
duke
parents:
diff changeset
173 void grow(const int i, const etype fx) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
174 assert(i >= length(), "index too small"); \
a61af66fc99e Initial load
duke
parents:
diff changeset
175 if (i >= size()) expand(esize, i, _size); \
a61af66fc99e Initial load
duke
parents:
diff changeset
176 for (int j = length(); j <= i; j++) ((etype*)_data)[j] = fx; \
a61af66fc99e Initial load
duke
parents:
diff changeset
177 _length = i+1; \
a61af66fc99e Initial load
duke
parents:
diff changeset
178 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
179 \
a61af66fc99e Initial load
duke
parents:
diff changeset
180 public: \
a61af66fc99e Initial load
duke
parents:
diff changeset
181 /* creation */ \
432
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
182 stack_name() : array_name() { _size = 0; } \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
183 stack_name(const int size) { initialize(size); } \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
184 stack_name(const int size, const etype fx) { initialize(size, fx); } \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
185 void initialize(const int size, const etype fx) { \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
186 _size = size; \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
187 array_name::initialize(size, fx); \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
188 /* _length == size, allocation and size are the same */ \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
189 } \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
190 void initialize(const int size) { \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
191 _size = size; \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
192 array_name::initialize(size); \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
193 _length = 0; /* reset length to zero; _size records the allocation */ \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
194 } \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
195 \
a61af66fc99e Initial load
duke
parents:
diff changeset
196 /* standard operations */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
197 int size() const { return _size; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
198 \
432
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
199 int push(const etype x) { \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
200 int len = length(); \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
201 if (len >= size()) expand(esize, len, _size); \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
202 ((etype*)_data)[len] = x; \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
203 _length = len+1; \
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
204 return len; \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
205 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
206 \
a61af66fc99e Initial load
duke
parents:
diff changeset
207 etype pop() { \
a61af66fc99e Initial load
duke
parents:
diff changeset
208 assert(!is_empty(), "stack is empty"); \
a61af66fc99e Initial load
duke
parents:
diff changeset
209 return ((etype*)_data)[--_length]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
210 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
211 \
a61af66fc99e Initial load
duke
parents:
diff changeset
212 etype top() const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
213 assert(!is_empty(), "stack is empty"); \
a61af66fc99e Initial load
duke
parents:
diff changeset
214 return ((etype*)_data)[length() - 1]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
215 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
216 \
a61af66fc99e Initial load
duke
parents:
diff changeset
217 void push_all(const stack_name* stack) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
218 const int l = stack->length(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
219 for (int i = 0; i < l; i++) push(((etype*)(stack->_data))[i]); \
a61af66fc99e Initial load
duke
parents:
diff changeset
220 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
221 \
a61af66fc99e Initial load
duke
parents:
diff changeset
222 etype at_grow(const int i, const etype fx) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
223 if (i >= length()) grow(i, fx); \
a61af66fc99e Initial load
duke
parents:
diff changeset
224 return ((etype*)_data)[i]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
225 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
226 \
a61af66fc99e Initial load
duke
parents:
diff changeset
227 void at_put_grow(const int i, const etype x, const etype fx) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
228 if (i >= length()) grow(i, fx); \
a61af66fc99e Initial load
duke
parents:
diff changeset
229 ((etype*)_data)[i] = x; \
a61af66fc99e Initial load
duke
parents:
diff changeset
230 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
231 \
a61af66fc99e Initial load
duke
parents:
diff changeset
232 void truncate(const int length) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
233 assert(0 <= length && length <= this->length(), "illegal length"); \
a61af66fc99e Initial load
duke
parents:
diff changeset
234 _length = length; \
a61af66fc99e Initial load
duke
parents:
diff changeset
235 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
236 \
a61af66fc99e Initial load
duke
parents:
diff changeset
237 void remove_at(int i) { base_remove_at(esize, i); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
238 void remove(etype x) { remove_at(index_of(x)); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
239 \
a61af66fc99e Initial load
duke
parents:
diff changeset
240 /* inserts the given element before the element at index i */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
241 void insert_before(const int i, const etype el) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
242 int len = length(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
243 int new_length = len + 1; \
a61af66fc99e Initial load
duke
parents:
diff changeset
244 if (new_length >= size()) expand(esize, new_length, _size); \
a61af66fc99e Initial load
duke
parents:
diff changeset
245 for (int j = len - 1; j >= i; j--) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
246 ((etype*)_data)[j + 1] = ((etype*)_data)[j]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
247 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
248 _length = new_length; \
a61af66fc99e Initial load
duke
parents:
diff changeset
249 at_put(i, el); \
a61af66fc99e Initial load
duke
parents:
diff changeset
250 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
251 \
a61af66fc99e Initial load
duke
parents:
diff changeset
252 /* inserts contents of the given stack before the element at index i */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
253 void insert_before(const int i, const stack_name *st) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
254 if (st->length() == 0) return; \
a61af66fc99e Initial load
duke
parents:
diff changeset
255 int len = length(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
256 int st_len = st->length(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
257 int new_length = len + st_len; \
a61af66fc99e Initial load
duke
parents:
diff changeset
258 if (new_length >= size()) expand(esize, new_length, _size); \
a61af66fc99e Initial load
duke
parents:
diff changeset
259 int j; \
a61af66fc99e Initial load
duke
parents:
diff changeset
260 for (j = len - 1; j >= i; j--) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
261 ((etype*)_data)[j + st_len] = ((etype*)_data)[j]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
262 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
263 for (j = 0; j < st_len; j++) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
264 ((etype*)_data)[i + j] = ((etype*)st->_data)[j]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
265 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
266 _length = new_length; \
a61af66fc99e Initial load
duke
parents:
diff changeset
267 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
268 \
a61af66fc99e Initial load
duke
parents:
diff changeset
269 /* deprecated operations - for compatibility with GrowableArray only */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
270 int capacity() const { return size(); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
271 void clear() { truncate(0); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
272 void trunc_to(const int length) { truncate(length); } \
432
275a3b7ff0d6 6770949: minor tweaks before 6655638
jrose
parents: 0
diff changeset
273 int append(const etype x) { return push(x); } \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
274 void appendAll(const stack_name* stack) { push_all(stack); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
275 etype last() const { return top(); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
276 }; \
a61af66fc99e Initial load
duke
parents:
diff changeset
277
a61af66fc99e Initial load
duke
parents:
diff changeset
278
a61af66fc99e Initial load
duke
parents:
diff changeset
279 #define define_resource_list(element_type) \
a61af66fc99e Initial load
duke
parents:
diff changeset
280 define_generic_array(element_type##Array, element_type, ResourceArray) \
a61af66fc99e Initial load
duke
parents:
diff changeset
281 define_stack(element_type##List, element_type##Array)
a61af66fc99e Initial load
duke
parents:
diff changeset
282
a61af66fc99e Initial load
duke
parents:
diff changeset
283 #define define_resource_pointer_list(element_type) \
a61af66fc99e Initial load
duke
parents:
diff changeset
284 define_generic_array(element_type##Array, element_type *, ResourceArray) \
a61af66fc99e Initial load
duke
parents:
diff changeset
285 define_stack(element_type##List, element_type##Array)
a61af66fc99e Initial load
duke
parents:
diff changeset
286
a61af66fc99e Initial load
duke
parents:
diff changeset
287 #define define_c_heap_list(element_type) \
a61af66fc99e Initial load
duke
parents:
diff changeset
288 define_generic_array(element_type##Array, element_type, CHeapArray) \
a61af66fc99e Initial load
duke
parents:
diff changeset
289 define_stack(element_type##List, element_type##Array)
a61af66fc99e Initial load
duke
parents:
diff changeset
290
a61af66fc99e Initial load
duke
parents:
diff changeset
291 #define define_c_heap_pointer_list(element_type) \
a61af66fc99e Initial load
duke
parents:
diff changeset
292 define_generic_array(element_type##Array, element_type *, CHeapArray) \
a61af66fc99e Initial load
duke
parents:
diff changeset
293 define_stack(element_type##List, element_type##Array)
a61af66fc99e Initial load
duke
parents:
diff changeset
294
a61af66fc99e Initial load
duke
parents:
diff changeset
295
a61af66fc99e Initial load
duke
parents:
diff changeset
296 // Arrays for basic types
a61af66fc99e Initial load
duke
parents:
diff changeset
297
a61af66fc99e Initial load
duke
parents:
diff changeset
298 define_array(boolArray, bool) define_stack(boolStack, boolArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
299 define_array(intArray , int ) define_stack(intStack , intArray )
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
300
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
301 // Array for metadata allocation
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
302
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
303 template <typename T>
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
304 class Array: public MetaspaceObj {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
305 friend class MetadataFactory;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
306 friend class VMStructs;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
307 friend class MethodHandleCompiler; // special case
20278
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
308 friend class WhiteBox;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
309 protected:
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
310 int _length; // the number of array elements
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
311 T _data[1]; // the array memory
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
312
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
313 void initialize(int length) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
314 _length = length;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
315 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
316
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
317 private:
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
318 // Turn off copy constructor and assignment operator.
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
319 Array(const Array<T>&);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
320 void operator=(const Array<T>&);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
321
12146
9758d9f36299 8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents: 10376
diff changeset
322 void* operator new(size_t size, ClassLoaderData* loader_data, int length, bool read_only, TRAPS) throw() {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
323 size_t word_size = Array::size(length);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
324 return (void*) Metaspace::allocate(loader_data, word_size, read_only,
10376
a1ebd310d5c1 8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents: 6972
diff changeset
325 MetaspaceObj::array_type(sizeof(T)), CHECK_NULL);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
326 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
327
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
328 static size_t byte_sizeof(int length) { return sizeof(Array<T>) + MAX2(length - 1, 0) * sizeof(T); }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
329
20278
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
330 // WhiteBox API helper.
20279
870c03421152 8049426: Minor cleanups after G1 class unloading
ehelin
parents: 20278
diff changeset
331 // Can't distinguish between array of length 0 and length 1,
870c03421152 8049426: Minor cleanups after G1 class unloading
ehelin
parents: 20278
diff changeset
332 // will always return 0 in those cases.
20278
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
333 static int bytes_to_length(size_t bytes) {
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
334 assert(is_size_aligned(bytes, BytesPerWord), "Must be, for now");
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
335
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
336 if (sizeof(Array<T>) >= bytes) {
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
337 return 0;
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
338 }
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
339
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
340 size_t left = bytes - sizeof(Array<T>);
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
341 assert(is_size_aligned(left, sizeof(T)), "Must be");
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
342
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
343 size_t elements = left / sizeof(T);
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
344 assert(elements <= (size_t)INT_MAX, err_msg("number of elements " SIZE_FORMAT "doesn't fit into an int.", elements));
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
345
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
346 int length = (int)elements;
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
347
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
348 assert((size_t)size(length) * BytesPerWord == bytes,
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
349 err_msg("Expected: " SIZE_FORMAT " got: " SIZE_FORMAT,
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
350 bytes, (size_t)size(length) * BytesPerWord));
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
351
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
352 return length;
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
353 }
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20197
diff changeset
354
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
355 explicit Array(int length) : _length(length) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
356 assert(length >= 0, "illegal length");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
357 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
358
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
359 Array(int length, T init) : _length(length) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
360 assert(length >= 0, "illegal length");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
361 for (int i = 0; i < length; i++) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
362 _data[i] = init;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
363 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
364 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
365
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
366 public:
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
367
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
368 // standard operations
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
369 int length() const { return _length; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
370 T* data() { return _data; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
371 bool is_empty() const { return length() == 0; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
372
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
373 int index_of(const T& x) const {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
374 int i = length();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
375 while (i-- > 0 && _data[i] != x) ;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
376
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
377 return i;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
378 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
379
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
380 // sort the array.
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
381 bool contains(const T& x) const { return index_of(x) >= 0; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
382
12319
de059a14e159 8022187: Missing ResourceMark crash when assertion using FormatBufferResource fails
zgu
parents: 12146
diff changeset
383 T at(int i) const { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); return _data[i]; }
de059a14e159 8022187: Missing ResourceMark crash when assertion using FormatBufferResource fails
zgu
parents: 12146
diff changeset
384 void at_put(const int i, const T& x) { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); _data[i] = x; }
de059a14e159 8022187: Missing ResourceMark crash when assertion using FormatBufferResource fails
zgu
parents: 12146
diff changeset
385 T* adr_at(const int i) { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); return &_data[i]; }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
386 int find(const T& x) { return index_of(x); }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
387
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
388 T at_acquire(const int which) { return OrderAccess::load_acquire(adr_at(which)); }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
389 void release_at_put(int which, T contents) { OrderAccess::release_store(adr_at(which), contents); }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
390
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
391 static int size(int length) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
392 return align_size_up(byte_sizeof(length), BytesPerWord) / BytesPerWord;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
393 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
394
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
395 int size() {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
396 return size(_length);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
397 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
398
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
399 static int length_offset_in_bytes() { return (int) (offset_of(Array<T>, _length)); }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
400 // Note, this offset don't have to be wordSize aligned.
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
401 static int base_offset_in_bytes() { return (int) (offset_of(Array<T>, _data)); };
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
402
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
403 // FIXME: How to handle this?
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
404 void print_value_on(outputStream* st) const {
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 14333
diff changeset
405 st->print("Array<T>(" INTPTR_FORMAT ")", p2i(this));
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
406 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
407
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
408 #ifndef PRODUCT
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
409 void print(outputStream* st) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
410 for (int i = 0; i< _length; i++) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
411 st->print_cr("%d: " INTPTR_FORMAT, i, (intptr_t)at(i));
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
412 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
413 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
414 void print() { print(tty); }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
415 #endif // PRODUCT
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
416 };
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
417
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
418
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
419 #endif // SHARE_VM_UTILITIES_ARRAY_HPP