2931 // written
2932 GrowableArray<jvmtiDeferredLocalVariableSet*>* list = deferred_locals();
2933 if (list != NULL) {
2934 for (int i = 0; i < list->length(); i++) {
2935 list->at(i)->oops_do(f);
2936 }
2937 }
2938
2939 // Traverse instance variables at the end since the GC may be moving things
2940 // around using this function
2941 f->do_oop((oop*) &_threadObj);
2942 f->do_oop((oop*) &_vm_result);
2943 f->do_oop((oop*) &_exception_oop);
2944 f->do_oop((oop*) &_pending_async_exception);
2945
2946 if (jvmti_thread_state() != NULL) {
2947 jvmti_thread_state()->oops_do(f);
2948 }
2949 }
2950
2951 void JavaThread::nmethods_do(CodeBlobClosure* cf) {
2952 assert((!has_last_Java_frame() && java_call_counter() == 0) ||
2953 (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!");
2954
2955 if (has_last_Java_frame()) {
2956 // Traverse the execution stack
2957 for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
2958 fst.current()->nmethods_do(cf);
2959 }
2960 }
2961 }
2962
2963 void JavaThread::metadata_do(MetadataClosure* f) {
2964 if (has_last_Java_frame()) {
2965 // Traverse the execution stack to call f() on the methods in the stack
2966 for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
2967 fst.current()->metadata_do(f);
2968 }
2969 } else if (is_Compiler_thread()) {
2970 // need to walk ciMetadata in current compile tasks to keep alive.
2971 CompilerThread* ct = (CompilerThread*)this;
2972 if (ct->env() != NULL) {
2973 ct->env()->metadata_do(f);
|
2931 // written
2932 GrowableArray<jvmtiDeferredLocalVariableSet*>* list = deferred_locals();
2933 if (list != NULL) {
2934 for (int i = 0; i < list->length(); i++) {
2935 list->at(i)->oops_do(f);
2936 }
2937 }
2938
2939 // Traverse instance variables at the end since the GC may be moving things
2940 // around using this function
2941 f->do_oop((oop*) &_threadObj);
2942 f->do_oop((oop*) &_vm_result);
2943 f->do_oop((oop*) &_exception_oop);
2944 f->do_oop((oop*) &_pending_async_exception);
2945
2946 if (jvmti_thread_state() != NULL) {
2947 jvmti_thread_state()->oops_do(f);
2948 }
2949 }
2950
2951 #ifdef ASSERT
2952 void JavaThread::verify_states_for_handshake() {
2953 // This checks that the thread has a correct frame state during a handshake.
2954 assert((!has_last_Java_frame() && java_call_counter() == 0) ||
2955 (has_last_Java_frame() && java_call_counter() > 0),
2956 "unexpected frame info: has_last_frame=%d, java_call_counter=%d",
2957 has_last_Java_frame(), java_call_counter());
2958 }
2959 #endif
2960
2961 void JavaThread::nmethods_do(CodeBlobClosure* cf) {
2962 assert((!has_last_Java_frame() && java_call_counter() == 0) ||
2963 (has_last_Java_frame() && java_call_counter() > 0),
2964 "unexpected frame info: has_last_frame=%d, java_call_counter=%d",
2965 has_last_Java_frame(), java_call_counter());
2966
2967 if (has_last_Java_frame()) {
2968 // Traverse the execution stack
2969 for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
2970 fst.current()->nmethods_do(cf);
2971 }
2972 }
2973 }
2974
2975 void JavaThread::metadata_do(MetadataClosure* f) {
2976 if (has_last_Java_frame()) {
2977 // Traverse the execution stack to call f() on the methods in the stack
2978 for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
2979 fst.current()->metadata_do(f);
2980 }
2981 } else if (is_Compiler_thread()) {
2982 // need to walk ciMetadata in current compile tasks to keep alive.
2983 CompilerThread* ct = (CompilerThread*)this;
2984 if (ct->env() != NULL) {
2985 ct->env()->metadata_do(f);
|