@@ -75,30 +75,24 @@ volatile bool ciObjectFactory::_initialized = false;
75
75
// ------------------------------------------------------------------
76
76
// ciObjectFactory::ciObjectFactory
77
77
ciObjectFactory::ciObjectFactory (Arena* arena,
78
- int expected_size) {
79
-
78
+ int expected_size)
79
+ : _arena(arena),
80
+ _ci_metadata(arena, expected_size, 0 , NULL ),
81
+ _unloaded_methods(arena, 4 , 0 , NULL ),
82
+ _unloaded_klasses(arena, 8 , 0 , NULL ),
83
+ _unloaded_instances(arena, 4 , 0 , NULL ),
84
+ _return_addresses(arena, 8 , 0 , NULL ),
85
+ _symbols(arena, 100 , 0 , NULL ),
86
+ _next_ident(_shared_ident_limit),
87
+ _non_perm_count(0 ) {
80
88
for (int i = 0 ; i < NON_PERM_BUCKETS; i++) {
81
89
_non_perm_bucket[i] = NULL ;
82
90
}
83
- _non_perm_count = 0 ;
84
-
85
- _next_ident = _shared_ident_limit;
86
- _arena = arena;
87
- _ci_metadata = new (arena) GrowableArray<ciMetadata*>(arena, expected_size, 0 , NULL );
88
91
89
92
// If the shared ci objects exist append them to this factory's objects
90
-
91
93
if (_shared_ci_metadata != NULL ) {
92
- _ci_metadata-> appendAll (_shared_ci_metadata);
94
+ _ci_metadata. appendAll (_shared_ci_metadata);
93
95
}
94
-
95
- _unloaded_methods = new (arena) GrowableArray<ciMethod*>(arena, 4 , 0 , NULL );
96
- _unloaded_klasses = new (arena) GrowableArray<ciKlass*>(arena, 8 , 0 , NULL );
97
- _unloaded_instances = new (arena) GrowableArray<ciInstance*>(arena, 4 , 0 , NULL );
98
- _return_addresses =
99
- new (arena) GrowableArray<ciReturnAddress*>(arena, 8 , 0 , NULL );
100
-
101
- _symbols = new (arena) GrowableArray<ciSymbol*>(arena, 100 , 0 , NULL );
102
96
}
103
97
104
98
// ------------------------------------------------------------------
@@ -145,8 +139,6 @@ void ciObjectFactory::init_shared_objects() {
145
139
#endif
146
140
}
147
141
148
- _ci_metadata = new (_arena) GrowableArray<ciMetadata*>(_arena, 64 , 0 , NULL );
149
-
150
142
for (int i = T_BOOLEAN; i <= T_CONFLICT; i++) {
151
143
BasicType t = (BasicType)i;
152
144
if (type2name (t) != NULL && !is_reference_type (t) &&
@@ -166,10 +158,10 @@ void ciObjectFactory::init_shared_objects() {
166
158
WK_KLASSES_DO (WK_KLASS_DEFN)
167
159
#undef WK_KLASS_DEFN
168
160
169
- for (int len = -1 ; len != _ci_metadata-> length (); ) {
170
- len = _ci_metadata-> length ();
161
+ for (int len = -1 ; len != _ci_metadata. length (); ) {
162
+ len = _ci_metadata. length ();
171
163
for (int i2 = 0 ; i2 < len; i2++) {
172
- ciMetadata* obj = _ci_metadata-> at (i2);
164
+ ciMetadata* obj = _ci_metadata. at (i2);
173
165
assert (obj->is_metadata (), " what else would it be?" );
174
166
if (obj->is_loaded () && obj->is_instance_klass ()) {
175
167
obj->as_instance_klass ()->compute_nonstatic_fields ();
@@ -194,8 +186,6 @@ void ciObjectFactory::init_shared_objects() {
194
186
get_metadata (Universe::intArrayKlassObj ());
195
187
get_metadata (Universe::longArrayKlassObj ());
196
188
197
-
198
-
199
189
assert (_non_perm_count == 0 , " no shared non-perm objects" );
200
190
201
191
// The shared_ident_limit is the first ident number that will
@@ -204,7 +194,7 @@ void ciObjectFactory::init_shared_objects() {
204
194
// while the higher numbers are recycled afresh by each new ciEnv.
205
195
206
196
_shared_ident_limit = _next_ident;
207
- _shared_ci_metadata = _ci_metadata;
197
+ _shared_ci_metadata = & _ci_metadata;
208
198
}
209
199
210
200
@@ -217,14 +207,14 @@ ciSymbol* ciObjectFactory::get_symbol(Symbol* key) {
217
207
218
208
assert (vmSymbols::find_sid (key) == vmSymbolID::NO_SID, " " );
219
209
ciSymbol* s = new (arena ()) ciSymbol (key, vmSymbolID::NO_SID);
220
- _symbols-> push (s);
210
+ _symbols. push (s);
221
211
return s;
222
212
}
223
213
224
214
// Decrement the refcount when done on symbols referenced by this compilation.
225
215
void ciObjectFactory::remove_symbols () {
226
- for (int i = 0 ; i < _symbols-> length (); i++) {
227
- ciSymbol* s = _symbols-> at (i);
216
+ for (int i = 0 ; i < _symbols. length (); i++) {
217
+ ciSymbol* s = _symbols. at (i);
228
218
s->get_symbol ()->decrement_refcount ();
229
219
}
230
220
// Since _symbols is resource allocated we're not allowed to delete it
@@ -276,12 +266,12 @@ ciMetadata* ciObjectFactory::cached_metadata(Metadata* key) {
276
266
ASSERT_IN_VM;
277
267
278
268
bool found = false ;
279
- int index = _ci_metadata-> find_sorted <Metadata*, ciObjectFactory::metadata_compare>(key, found);
269
+ int index = _ci_metadata. find_sorted <Metadata*, ciObjectFactory::metadata_compare>(key, found);
280
270
281
271
if (!found) {
282
272
return NULL ;
283
273
}
284
- return _ci_metadata-> at (index)->as_metadata ();
274
+ return _ci_metadata. at (index)->as_metadata ();
285
275
}
286
276
287
277
@@ -297,20 +287,20 @@ ciMetadata* ciObjectFactory::get_metadata(Metadata* key) {
297
287
#ifdef ASSERT
298
288
if (CIObjectFactoryVerify) {
299
289
Metadata* last = NULL ;
300
- for (int j = 0 ; j< _ci_metadata-> length (); j++) {
301
- Metadata* o = _ci_metadata-> at (j)->constant_encoding ();
290
+ for (int j = 0 ; j < _ci_metadata. length (); j++) {
291
+ Metadata* o = _ci_metadata. at (j)->constant_encoding ();
302
292
assert (last < o, " out of order" );
303
293
last = o;
304
294
}
305
295
}
306
296
#endif // ASSERT
307
- int len = _ci_metadata-> length ();
297
+ int len = _ci_metadata. length ();
308
298
bool found = false ;
309
- int index = _ci_metadata-> find_sorted <Metadata*, ciObjectFactory::metadata_compare>(key, found);
299
+ int index = _ci_metadata. find_sorted <Metadata*, ciObjectFactory::metadata_compare>(key, found);
310
300
#ifdef ASSERT
311
301
if (CIObjectFactoryVerify) {
312
- for (int i= 0 ; i< _ci_metadata-> length (); i++) {
313
- if (_ci_metadata-> at (i)->constant_encoding () == key) {
302
+ for (int i = 0 ; i < _ci_metadata. length (); i++) {
303
+ if (_ci_metadata. at (i)->constant_encoding () == key) {
314
304
assert (index == i, " bad lookup" );
315
305
}
316
306
}
@@ -324,16 +314,16 @@ ciMetadata* ciObjectFactory::get_metadata(Metadata* key) {
324
314
init_ident_of (new_object);
325
315
assert (new_object->is_metadata (), " must be" );
326
316
327
- if (len != _ci_metadata-> length ()) {
317
+ if (len != _ci_metadata. length ()) {
328
318
// creating the new object has recursively entered new objects
329
319
// into the table. We need to recompute our index.
330
- index = _ci_metadata-> find_sorted <Metadata*, ciObjectFactory::metadata_compare>(key, found);
320
+ index = _ci_metadata. find_sorted <Metadata*, ciObjectFactory::metadata_compare>(key, found);
331
321
}
332
322
assert (!found, " no double insert" );
333
- _ci_metadata-> insert_before (index, new_object);
323
+ _ci_metadata. insert_before (index, new_object);
334
324
return new_object;
335
325
}
336
- return _ci_metadata-> at (index)->as_metadata ();
326
+ return _ci_metadata. at (index)->as_metadata ();
337
327
}
338
328
339
329
// ------------------------------------------------------------------
@@ -420,8 +410,8 @@ ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder,
420
410
ciInstanceKlass* accessor) {
421
411
assert (accessor != NULL , " need origin of access" );
422
412
ciSignature* that = NULL ;
423
- for (int i = 0 ; i < _unloaded_methods-> length (); i++) {
424
- ciMethod* entry = _unloaded_methods-> at (i);
413
+ for (int i = 0 ; i < _unloaded_methods. length (); i++) {
414
+ ciMethod* entry = _unloaded_methods. at (i);
425
415
if (entry->holder ()->equals (holder) &&
426
416
entry->name ()->equals (name) &&
427
417
entry->signature ()->as_symbol ()->equals (signature)) {
@@ -445,7 +435,7 @@ ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder,
445
435
ciMethod* new_method = new (arena ()) ciMethod (holder, name, signature, accessor);
446
436
447
437
init_ident_of (new_method);
448
- _unloaded_methods-> append (new_method);
438
+ _unloaded_methods. append (new_method);
449
439
450
440
return new_method;
451
441
}
@@ -468,8 +458,8 @@ ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass,
468
458
loader = accessing_klass->loader ();
469
459
domain = accessing_klass->protection_domain ();
470
460
}
471
- for (int i= 0 ; i< _unloaded_klasses-> length (); i++) {
472
- ciKlass* entry = _unloaded_klasses-> at (i);
461
+ for (int i = 0 ; i < _unloaded_klasses. length (); i++) {
462
+ ciKlass* entry = _unloaded_klasses. at (i);
473
463
if (entry->name ()->equals (name) &&
474
464
entry->loader () == loader &&
475
465
entry->protection_domain () == domain) {
@@ -519,7 +509,7 @@ ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass,
519
509
new_klass = new (arena ()) ciInstanceKlass (name, loader_handle, domain_handle);
520
510
}
521
511
init_ident_of (new_klass);
522
- _unloaded_klasses-> append (new_klass);
512
+ _unloaded_klasses. append (new_klass);
523
513
524
514
return new_klass;
525
515
}
@@ -531,8 +521,8 @@ ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass,
531
521
// Get a ciInstance representing an as-yet undetermined instance of a given class.
532
522
//
533
523
ciInstance* ciObjectFactory::get_unloaded_instance (ciInstanceKlass* instance_klass) {
534
- for (int i= 0 ; i< _unloaded_instances-> length (); i++) {
535
- ciInstance* entry = _unloaded_instances-> at (i);
524
+ for (int i = 0 ; i < _unloaded_instances. length (); i++) {
525
+ ciInstance* entry = _unloaded_instances. at (i);
536
526
if (entry->klass ()->equals (instance_klass)) {
537
527
// We've found a match.
538
528
return entry;
@@ -544,7 +534,7 @@ ciInstance* ciObjectFactory::get_unloaded_instance(ciInstanceKlass* instance_kla
544
534
ciInstance* new_instance = new (arena ()) ciInstance (instance_klass);
545
535
546
536
init_ident_of (new_instance);
547
- _unloaded_instances-> append (new_instance);
537
+ _unloaded_instances. append (new_instance);
548
538
549
539
// make sure it looks the way we want:
550
540
assert (!new_instance->is_loaded (), " " );
@@ -611,8 +601,8 @@ ciMethodData* ciObjectFactory::get_empty_methodData() {
611
601
//
612
602
// Get a ciReturnAddress for a specified bci.
613
603
ciReturnAddress* ciObjectFactory::get_return_address (int bci) {
614
- for (int i= 0 ; i< _return_addresses-> length (); i++) {
615
- ciReturnAddress* entry = _return_addresses-> at (i);
604
+ for (int i = 0 ; i < _return_addresses. length (); i++) {
605
+ ciReturnAddress* entry = _return_addresses. at (i);
616
606
if (entry->bci () == bci) {
617
607
// We've found a match.
618
608
return entry;
@@ -621,7 +611,7 @@ ciReturnAddress* ciObjectFactory::get_return_address(int bci) {
621
611
622
612
ciReturnAddress* new_ret_addr = new (arena ()) ciReturnAddress (bci);
623
613
init_ident_of (new_ret_addr);
624
- _return_addresses-> append (new_ret_addr);
614
+ _return_addresses. append (new_ret_addr);
625
615
return new_ret_addr;
626
616
}
627
617
@@ -687,20 +677,19 @@ ciSymbol* ciObjectFactory::vm_symbol_at(vmSymbolID sid) {
687
677
// ------------------------------------------------------------------
688
678
// ciObjectFactory::metadata_do
689
679
void ciObjectFactory::metadata_do (MetadataClosure* f) {
690
- if (_ci_metadata == NULL ) return ;
691
- for (int j = 0 ; j< _ci_metadata->length (); j++) {
692
- Metadata* o = _ci_metadata->at (j)->constant_encoding ();
680
+ for (int j = 0 ; j < _ci_metadata.length (); j++) {
681
+ Metadata* o = _ci_metadata.at (j)->constant_encoding ();
693
682
f->do_metadata (o);
694
683
}
695
684
}
696
685
697
686
// ------------------------------------------------------------------
698
687
// ciObjectFactory::print_contents_impl
699
688
void ciObjectFactory::print_contents_impl () {
700
- int len = _ci_metadata-> length ();
689
+ int len = _ci_metadata. length ();
701
690
tty->print_cr (" ciObjectFactory (%d) meta data contents:" , len);
702
- for (int i= 0 ; i< len; i++) {
703
- _ci_metadata-> at (i)->print ();
691
+ for (int i = 0 ; i < len; i++) {
692
+ _ci_metadata. at (i)->print ();
704
693
tty->cr ();
705
694
}
706
695
}
@@ -719,7 +708,7 @@ void ciObjectFactory::print_contents() {
719
708
// Print debugging information about the object factory
720
709
void ciObjectFactory::print () {
721
710
tty->print (" <ciObjectFactory oops=%d metadata=%d unloaded_methods=%d unloaded_instances=%d unloaded_klasses=%d>" ,
722
- _non_perm_count, _ci_metadata-> length (), _unloaded_methods-> length (),
723
- _unloaded_instances-> length (),
724
- _unloaded_klasses-> length ());
711
+ _non_perm_count, _ci_metadata. length (), _unloaded_methods. length (),
712
+ _unloaded_instances. length (),
713
+ _unloaded_klasses. length ());
725
714
}
0 commit comments