775 // GC Support
776 bool Thread::claim_oops_do_par_case(int strong_roots_parity) {
777 jint thread_parity = _oops_do_parity;
778 if (thread_parity != strong_roots_parity) {
779 jint res = Atomic::cmpxchg(strong_roots_parity, &_oops_do_parity, thread_parity);
780 if (res == thread_parity) {
781 return true;
782 } else {
783 guarantee(res == strong_roots_parity, "Or else what?");
784 return false;
785 }
786 }
787 return false;
788 }
789
790 void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
791 active_handles()->oops_do(f);
792 // Do oop for ThreadShadow
793 f->do_oop((oop*)&_pending_exception);
794 handle_area()->oops_do(f);
795 }
796
797 void Thread::metadata_handles_do(void f(Metadata*)) {
798 // Only walk the Handles in Thread.
799 if (metadata_handles() != NULL) {
800 for (int i = 0; i< metadata_handles()->length(); i++) {
801 f(metadata_handles()->at(i));
802 }
803 }
804 }
805
806 void Thread::print_on(outputStream* st) const {
807 // get_priority assumes osthread initialized
808 if (osthread() != NULL) {
809 int os_prio;
810 if (os::get_native_priority(this, &os_prio) == OS_OK) {
811 st->print("os_prio=%d ", os_prio);
812 }
813 st->print("tid=" INTPTR_FORMAT " ", p2i(this));
814 ext().print_on(st);
|
775 // GC Support
776 bool Thread::claim_oops_do_par_case(int strong_roots_parity) {
777 jint thread_parity = _oops_do_parity;
778 if (thread_parity != strong_roots_parity) {
779 jint res = Atomic::cmpxchg(strong_roots_parity, &_oops_do_parity, thread_parity);
780 if (res == thread_parity) {
781 return true;
782 } else {
783 guarantee(res == strong_roots_parity, "Or else what?");
784 return false;
785 }
786 }
787 return false;
788 }
789
790 void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
791 active_handles()->oops_do(f);
792 // Do oop for ThreadShadow
793 f->do_oop((oop*)&_pending_exception);
794 handle_area()->oops_do(f);
795
796 if (MonitorInUseLists) {
797 ObjectSynchronizer::thread_local_used_oops_do(this, f);
798 }
799 }
800
801 void Thread::metadata_handles_do(void f(Metadata*)) {
802 // Only walk the Handles in Thread.
803 if (metadata_handles() != NULL) {
804 for (int i = 0; i< metadata_handles()->length(); i++) {
805 f(metadata_handles()->at(i));
806 }
807 }
808 }
809
810 void Thread::print_on(outputStream* st) const {
811 // get_priority assumes osthread initialized
812 if (osthread() != NULL) {
813 int os_prio;
814 if (os::get_native_priority(this, &os_prio) == OS_OK) {
815 st->print("os_prio=%d ", os_prio);
816 }
817 st->print("tid=" INTPTR_FORMAT " ", p2i(this));
818 ext().print_on(st);
|