Mercurial > hg > truffle
comparison src/share/vm/oops/instanceKlass.hpp @ 977:74a5db69c1fe
6419370: 4/4 new jmethodID code has tiny holes in synchronization
Summary: Fix races in jmethodID cache and JNI itable index cache.
Reviewed-by: ikrylov, acorn
author | dcubed |
---|---|
date | Mon, 21 Sep 2009 09:30:24 -0600 |
parents | 83c29a26f67c |
children | 987e948ebbc8 |
comparison
equal
deleted
inserted
replaced
975:83c29a26f67c | 977:74a5db69c1fe |
---|---|
463 } | 463 } |
464 | 464 |
465 // RedefineClasses() support for previous versions: | 465 // RedefineClasses() support for previous versions: |
466 void add_previous_version(instanceKlassHandle ikh, BitMap *emcp_methods, | 466 void add_previous_version(instanceKlassHandle ikh, BitMap *emcp_methods, |
467 int emcp_method_count); | 467 int emcp_method_count); |
468 // If the _previous_versions array is non-NULL, then this klass | |
469 // has been redefined at least once even if we aren't currently | |
470 // tracking a previous version. | |
471 bool has_been_redefined() const { return _previous_versions != NULL; } | |
468 bool has_previous_version() const; | 472 bool has_previous_version() const; |
469 void init_previous_versions() { | 473 void init_previous_versions() { |
470 _previous_versions = NULL; | 474 _previous_versions = NULL; |
471 } | 475 } |
472 GrowableArray<PreviousVersionNode *>* previous_versions() const { | 476 GrowableArray<PreviousVersionNode *>* previous_versions() const { |
504 // JSR 292 support | 508 // JSR 292 support |
505 oop bootstrap_method() const { return _bootstrap_method; } | 509 oop bootstrap_method() const { return _bootstrap_method; } |
506 void set_bootstrap_method(oop mh) { oop_store(&_bootstrap_method, mh); } | 510 void set_bootstrap_method(oop mh) { oop_store(&_bootstrap_method, mh); } |
507 | 511 |
508 // jmethodID support | 512 // jmethodID support |
509 static jmethodID get_jmethod_id(instanceKlassHandle ik_h, size_t idnum, | 513 static jmethodID get_jmethod_id(instanceKlassHandle ik_h, |
510 jmethodID new_id, jmethodID* new_jmeths); | 514 methodHandle method_h); |
511 static jmethodID jmethod_id_for_impl(instanceKlassHandle ik_h, methodHandle method_h); | 515 static jmethodID get_jmethod_id_fetch_or_update(instanceKlassHandle ik_h, |
516 size_t idnum, jmethodID new_id, jmethodID* new_jmeths, | |
517 jmethodID* to_dealloc_id_p, | |
518 jmethodID** to_dealloc_jmeths_p); | |
519 static void get_jmethod_id_length_value(jmethodID* cache, size_t idnum, | |
520 size_t *length_p, jmethodID* id_p); | |
512 jmethodID jmethod_id_or_null(methodOop method); | 521 jmethodID jmethod_id_or_null(methodOop method); |
513 | 522 |
514 // cached itable index support | 523 // cached itable index support |
515 void set_cached_itable_index(size_t idnum, int index); | 524 void set_cached_itable_index(size_t idnum, int index); |
516 int cached_itable_index(size_t idnum); | 525 int cached_itable_index(size_t idnum); |
752 #endif | 761 #endif |
753 void set_rewritten() { _rewritten = true; } | 762 void set_rewritten() { _rewritten = true; } |
754 void set_init_thread(Thread *thread) { _init_thread = thread; } | 763 void set_init_thread(Thread *thread) { _init_thread = thread; } |
755 | 764 |
756 u2 idnum_allocated_count() const { return _idnum_allocated_count; } | 765 u2 idnum_allocated_count() const { return _idnum_allocated_count; } |
766 // The RedefineClasses() API can cause new method idnums to be needed | |
767 // which will cause the caches to grow. Safety requires different | |
768 // cache management logic if the caches can grow instead of just | |
769 // going from NULL to non-NULL. | |
770 bool idnum_can_increment() const { return has_been_redefined(); } | |
757 jmethodID* methods_jmethod_ids_acquire() const | 771 jmethodID* methods_jmethod_ids_acquire() const |
758 { return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids); } | 772 { return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids); } |
759 void release_set_methods_jmethod_ids(jmethodID* jmeths) | 773 void release_set_methods_jmethod_ids(jmethodID* jmeths) |
760 { OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths); } | 774 { OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths); } |
761 | 775 |