499 } |
499 } |
500 assert(fields->length() == flen, "sanity"); |
500 assert(fields->length() == flen, "sanity"); |
501 return fields; |
501 return fields; |
502 } |
502 } |
503 |
503 |
504 void ciInstanceKlass::compute_injected_fields_helper() { |
504 bool ciInstanceKlass::compute_injected_fields_helper() { |
505 ASSERT_IN_VM; |
505 ASSERT_IN_VM; |
506 InstanceKlass* k = get_instanceKlass(); |
506 InstanceKlass* k = get_instanceKlass(); |
507 |
507 |
508 for (InternalFieldStream fs(k); !fs.done(); fs.next()) { |
508 for (InternalFieldStream fs(k); !fs.done(); fs.next()) { |
509 if (fs.access_flags().is_static()) continue; |
509 if (fs.access_flags().is_static()) continue; |
510 _has_injected_fields++; |
510 return true; |
511 break; |
511 } |
512 } |
512 return false; |
513 } |
513 } |
514 |
514 |
515 bool ciInstanceKlass::compute_injected_fields() { |
515 void ciInstanceKlass::compute_injected_fields() { |
516 assert(_has_injected_fields == -1, "shouldn't be initialized yet"); |
|
517 assert(is_loaded(), "must be loaded"); |
516 assert(is_loaded(), "must be loaded"); |
518 |
517 |
|
518 int has_injected_fields = 0; |
519 if (super() != NULL && super()->has_injected_fields()) { |
519 if (super() != NULL && super()->has_injected_fields()) { |
520 _has_injected_fields = 1; |
520 has_injected_fields = 1; |
521 return true; |
521 } else { |
522 } |
522 GUARDED_VM_ENTRY({ |
523 |
523 has_injected_fields = compute_injected_fields_helper() ? 1 : 0; |
524 _has_injected_fields = 0; |
524 }); |
525 GUARDED_VM_ENTRY({ |
525 } |
526 compute_injected_fields_helper(); |
526 // may be concurrently initialized for shared ciInstanceKlass objects |
527 }); |
527 assert(_has_injected_fields == -1 || _has_injected_fields == has_injected_fields, "broken concurrent initialization"); |
528 |
528 _has_injected_fields = has_injected_fields; |
529 return _has_injected_fields > 0 ? true : false; |
|
530 } |
529 } |
531 |
530 |
532 // ------------------------------------------------------------------ |
531 // ------------------------------------------------------------------ |
533 // ciInstanceKlass::find_method |
532 // ciInstanceKlass::find_method |
534 // |
533 // |