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