@@ -75,30 +75,24 @@ volatile bool ciObjectFactory::_initialized = false;
7575// ------------------------------------------------------------------
7676// ciObjectFactory::ciObjectFactory
7777ciObjectFactory::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 ) {
8088 for (int i = 0 ; i < NON_PERM_BUCKETS; i++) {
8189 _non_perm_bucket[i] = NULL ;
8290 }
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 );
8891
8992 // If the shared ci objects exist append them to this factory's objects
90-
9193 if (_shared_ci_metadata != NULL ) {
92- _ci_metadata-> appendAll (_shared_ci_metadata);
94+ _ci_metadata. appendAll (_shared_ci_metadata);
9395 }
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 );
10296}
10397
10498// ------------------------------------------------------------------
@@ -145,8 +139,6 @@ void ciObjectFactory::init_shared_objects() {
145139#endif
146140 }
147141
148- _ci_metadata = new (_arena) GrowableArray<ciMetadata*>(_arena, 64 , 0 , NULL );
149-
150142 for (int i = T_BOOLEAN; i <= T_CONFLICT; i++) {
151143 BasicType t = (BasicType)i;
152144 if (type2name (t) != NULL && !is_reference_type (t) &&
@@ -166,10 +158,10 @@ void ciObjectFactory::init_shared_objects() {
166158 WK_KLASSES_DO (WK_KLASS_DEFN)
167159#undef WK_KLASS_DEFN
168160
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 ();
171163 for (int i2 = 0 ; i2 < len; i2++) {
172- ciMetadata* obj = _ci_metadata-> at (i2);
164+ ciMetadata* obj = _ci_metadata. at (i2);
173165 assert (obj->is_metadata (), " what else would it be?" );
174166 if (obj->is_loaded () && obj->is_instance_klass ()) {
175167 obj->as_instance_klass ()->compute_nonstatic_fields ();
@@ -194,8 +186,6 @@ void ciObjectFactory::init_shared_objects() {
194186 get_metadata (Universe::intArrayKlassObj ());
195187 get_metadata (Universe::longArrayKlassObj ());
196188
197-
198-
199189 assert (_non_perm_count == 0 , " no shared non-perm objects" );
200190
201191 // The shared_ident_limit is the first ident number that will
@@ -204,7 +194,7 @@ void ciObjectFactory::init_shared_objects() {
204194 // while the higher numbers are recycled afresh by each new ciEnv.
205195
206196 _shared_ident_limit = _next_ident;
207- _shared_ci_metadata = _ci_metadata;
197+ _shared_ci_metadata = & _ci_metadata;
208198}
209199
210200
@@ -217,14 +207,14 @@ ciSymbol* ciObjectFactory::get_symbol(Symbol* key) {
217207
218208 assert (vmSymbols::find_sid (key) == vmSymbolID::NO_SID, " " );
219209 ciSymbol* s = new (arena ()) ciSymbol (key, vmSymbolID::NO_SID);
220- _symbols-> push (s);
210+ _symbols. push (s);
221211 return s;
222212}
223213
224214// Decrement the refcount when done on symbols referenced by this compilation.
225215void 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);
228218 s->get_symbol ()->decrement_refcount ();
229219 }
230220 // Since _symbols is resource allocated we're not allowed to delete it
@@ -276,12 +266,12 @@ ciMetadata* ciObjectFactory::cached_metadata(Metadata* key) {
276266 ASSERT_IN_VM;
277267
278268 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);
280270
281271 if (!found) {
282272 return NULL ;
283273 }
284- return _ci_metadata-> at (index)->as_metadata ();
274+ return _ci_metadata. at (index)->as_metadata ();
285275}
286276
287277
@@ -297,20 +287,20 @@ ciMetadata* ciObjectFactory::get_metadata(Metadata* key) {
297287#ifdef ASSERT
298288 if (CIObjectFactoryVerify) {
299289 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 ();
302292 assert (last < o, " out of order" );
303293 last = o;
304294 }
305295 }
306296#endif // ASSERT
307- int len = _ci_metadata-> length ();
297+ int len = _ci_metadata. length ();
308298 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);
310300#ifdef ASSERT
311301 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) {
314304 assert (index == i, " bad lookup" );
315305 }
316306 }
@@ -324,16 +314,16 @@ ciMetadata* ciObjectFactory::get_metadata(Metadata* key) {
324314 init_ident_of (new_object);
325315 assert (new_object->is_metadata (), " must be" );
326316
327- if (len != _ci_metadata-> length ()) {
317+ if (len != _ci_metadata. length ()) {
328318 // creating the new object has recursively entered new objects
329319 // 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);
331321 }
332322 assert (!found, " no double insert" );
333- _ci_metadata-> insert_before (index, new_object);
323+ _ci_metadata. insert_before (index, new_object);
334324 return new_object;
335325 }
336- return _ci_metadata-> at (index)->as_metadata ();
326+ return _ci_metadata. at (index)->as_metadata ();
337327}
338328
339329// ------------------------------------------------------------------
@@ -420,8 +410,8 @@ ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder,
420410 ciInstanceKlass* accessor) {
421411 assert (accessor != NULL , " need origin of access" );
422412 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);
425415 if (entry->holder ()->equals (holder) &&
426416 entry->name ()->equals (name) &&
427417 entry->signature ()->as_symbol ()->equals (signature)) {
@@ -445,7 +435,7 @@ ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder,
445435 ciMethod* new_method = new (arena ()) ciMethod (holder, name, signature, accessor);
446436
447437 init_ident_of (new_method);
448- _unloaded_methods-> append (new_method);
438+ _unloaded_methods. append (new_method);
449439
450440 return new_method;
451441}
@@ -468,8 +458,8 @@ ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass,
468458 loader = accessing_klass->loader ();
469459 domain = accessing_klass->protection_domain ();
470460 }
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);
473463 if (entry->name ()->equals (name) &&
474464 entry->loader () == loader &&
475465 entry->protection_domain () == domain) {
@@ -519,7 +509,7 @@ ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass,
519509 new_klass = new (arena ()) ciInstanceKlass (name, loader_handle, domain_handle);
520510 }
521511 init_ident_of (new_klass);
522- _unloaded_klasses-> append (new_klass);
512+ _unloaded_klasses. append (new_klass);
523513
524514 return new_klass;
525515}
@@ -531,8 +521,8 @@ ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass,
531521// Get a ciInstance representing an as-yet undetermined instance of a given class.
532522//
533523ciInstance* 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);
536526 if (entry->klass ()->equals (instance_klass)) {
537527 // We've found a match.
538528 return entry;
@@ -544,7 +534,7 @@ ciInstance* ciObjectFactory::get_unloaded_instance(ciInstanceKlass* instance_kla
544534 ciInstance* new_instance = new (arena ()) ciInstance (instance_klass);
545535
546536 init_ident_of (new_instance);
547- _unloaded_instances-> append (new_instance);
537+ _unloaded_instances. append (new_instance);
548538
549539 // make sure it looks the way we want:
550540 assert (!new_instance->is_loaded (), " " );
@@ -611,8 +601,8 @@ ciMethodData* ciObjectFactory::get_empty_methodData() {
611601//
612602// Get a ciReturnAddress for a specified bci.
613603ciReturnAddress* 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);
616606 if (entry->bci () == bci) {
617607 // We've found a match.
618608 return entry;
@@ -621,7 +611,7 @@ ciReturnAddress* ciObjectFactory::get_return_address(int bci) {
621611
622612 ciReturnAddress* new_ret_addr = new (arena ()) ciReturnAddress (bci);
623613 init_ident_of (new_ret_addr);
624- _return_addresses-> append (new_ret_addr);
614+ _return_addresses. append (new_ret_addr);
625615 return new_ret_addr;
626616}
627617
@@ -687,20 +677,19 @@ ciSymbol* ciObjectFactory::vm_symbol_at(vmSymbolID sid) {
687677// ------------------------------------------------------------------
688678// ciObjectFactory::metadata_do
689679void 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 ();
693682 f->do_metadata (o);
694683 }
695684}
696685
697686// ------------------------------------------------------------------
698687// ciObjectFactory::print_contents_impl
699688void ciObjectFactory::print_contents_impl () {
700- int len = _ci_metadata-> length ();
689+ int len = _ci_metadata. length ();
701690 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 ();
704693 tty->cr ();
705694 }
706695}
@@ -719,7 +708,7 @@ void ciObjectFactory::print_contents() {
719708// Print debugging information about the object factory
720709void ciObjectFactory::print () {
721710 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 ());
725714}
0 commit comments