166 }
167 }
168
169 void set_element(int index, Handle value) {
170 if ((_list != NULL) && (index < _count)) {
171 _list[index] = value;
172 } else {
173 assert(false, "bad set_element");
174 }
175 }
176
177 // Other predicates
178 bool available() {
179 return (_list != NULL);
180 }
181
182 #ifdef ASSERT
183 // For debugging.
184 void check(int limit) {
185 for (int i = 0; i < limit; i += 1) {
186 assert(Universe::heap()->is_in(get_element(i)()), "check fails");
187 }
188 }
189 #endif
190
191 // Public methods that get called within the scope of the closure
192 void allocate() {
193 _list = NEW_C_HEAP_ARRAY(Handle, _count, mtInternal);
194 assert(_list != NULL, "Out of memory");
195 if (_list == NULL) {
196 _count = 0;
197 }
198 }
199
200 void extract(JvmtiEnv *env, jclass* result) {
201 for (int index = 0; index < _count; index += 1) {
202 result[index] = (jclass) env->jni_reference(get_element(index));
203 }
204 }
205
206 static void increment_with_loader(Klass* k, ClassLoaderData* loader_data) {
|
166 }
167 }
168
169 void set_element(int index, Handle value) {
170 if ((_list != NULL) && (index < _count)) {
171 _list[index] = value;
172 } else {
173 assert(false, "bad set_element");
174 }
175 }
176
177 // Other predicates
178 bool available() {
179 return (_list != NULL);
180 }
181
182 #ifdef ASSERT
183 // For debugging.
184 void check(int limit) {
185 for (int i = 0; i < limit; i += 1) {
186 assert(GC::gc()->heap()->is_in(get_element(i)()), "check fails");
187 }
188 }
189 #endif
190
191 // Public methods that get called within the scope of the closure
192 void allocate() {
193 _list = NEW_C_HEAP_ARRAY(Handle, _count, mtInternal);
194 assert(_list != NULL, "Out of memory");
195 if (_list == NULL) {
196 _count = 0;
197 }
198 }
199
200 void extract(JvmtiEnv *env, jclass* result) {
201 for (int index = 0; index < _count; index += 1) {
202 result[index] = (jclass) env->jni_reference(get_element(index));
203 }
204 }
205
206 static void increment_with_loader(Klass* k, ClassLoaderData* loader_data) {
|