src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/runtime

src/share/vm/runtime/sharedRuntime.cpp

Print this page




3067 
3068 #endif // INCLUDE_CDS
3069 
3070 
3071 #ifndef PRODUCT
3072 
3073 void AdapterHandlerLibrary::print_statistics() {
3074   _adapters->print_statistics();
3075 }
3076 
3077 #endif /* PRODUCT */
3078 
3079 JRT_LEAF(void, SharedRuntime::enable_stack_reserved_zone(JavaThread* thread))
3080   assert(thread->is_Java_thread(), "Only Java threads have a stack reserved zone");
3081   thread->enable_stack_reserved_zone();
3082   thread->set_reserved_stack_activation(thread->stack_base());
3083 JRT_END
3084 
3085 frame SharedRuntime::look_for_reserved_stack_annotated_method(JavaThread* thread, frame fr) {
3086   frame activation;
3087   int decode_offset = 0;
3088   nmethod* nm = NULL;
3089   frame prv_fr = fr;
3090   int count = 1;
3091 
3092   assert(fr.is_java_frame(), "Must start on Java frame");
3093 
3094   while (!fr.is_first_frame()) {
3095     Method* method = NULL;
3096     // Compiled java method case.
3097     if (decode_offset != 0) {
3098       DebugInfoReadStream stream(nm, decode_offset);
3099       decode_offset = stream.read_int();
3100       method = (Method*)nm->metadata_at(stream.read_int());
3101     } else {
3102       if (fr.is_first_java_frame()) break;
3103       address pc = fr.pc();
3104       prv_fr = fr;
3105       if (fr.is_interpreted_frame()) {
3106         method = fr.interpreter_frame_method();
3107         fr = fr.java_sender();
3108       } else {
3109         CodeBlob* cb = fr.cb();
3110         fr = fr.java_sender();
3111         if (cb == NULL || !cb->is_nmethod()) {
3112           continue;
3113         }
3114         nm = (nmethod*)cb;
3115         if (nm->method()->is_native()) {
3116           method = nm->method();
3117         } else {
3118           PcDesc* pd = nm->pc_desc_at(pc);
3119           assert(pd != NULL, "PcDesc must not be NULL");
3120           decode_offset = pd->scope_decode_offset();
3121           // if decode_offset is not equal to 0, it will execute the
3122           // "compiled java method case" at the beginning of the loop.
3123           continue;
3124         }
3125       }
3126     }
3127     if (method->has_reserved_stack_access()) {
3128       ResourceMark rm(thread);
3129       activation = prv_fr;
3130       warning("Potentially dangerous stack overflow in "
3131               "ReservedStackAccess annotated method %s [%d]",
3132               method->name_and_sig_as_C_string(), count++);
3133       EventReservedStackActivation event;
3134       if (event.should_commit()) {
3135         event.set_method(method);
3136         event.commit();
3137       }
3138     }





3139   }
3140   return activation;
3141 }
3142 


3067 
3068 #endif // INCLUDE_CDS
3069 
3070 
3071 #ifndef PRODUCT
3072 
3073 void AdapterHandlerLibrary::print_statistics() {
3074   _adapters->print_statistics();
3075 }
3076 
3077 #endif /* PRODUCT */
3078 
3079 JRT_LEAF(void, SharedRuntime::enable_stack_reserved_zone(JavaThread* thread))
3080   assert(thread->is_Java_thread(), "Only Java threads have a stack reserved zone");
3081   thread->enable_stack_reserved_zone();
3082   thread->set_reserved_stack_activation(thread->stack_base());
3083 JRT_END
3084 
3085 frame SharedRuntime::look_for_reserved_stack_annotated_method(JavaThread* thread, frame fr) {
3086   frame activation;
3087   CompiledMethod* nm = NULL;


3088   int count = 1;
3089 
3090   assert(fr.is_java_frame(), "Must start on Java frame");
3091 
3092   while (true) {
3093     Method* method = NULL;









3094     if (fr.is_interpreted_frame()) {
3095       method = fr.interpreter_frame_method();

3096     } else {
3097       CodeBlob* cb = fr.cb();
3098       if (cb != NULL && cb->is_compiled()) {
3099         nm = cb->as_compiled_method();




3100         method = nm->method();







3101       }
3102     }
3103     if ((method != NULL) && method->has_reserved_stack_access()) {

3104       ResourceMark rm(thread);
3105       activation = fr;
3106       warning("Potentially dangerous stack overflow in "
3107               "ReservedStackAccess annotated method %s [%d]",
3108               method->name_and_sig_as_C_string(), count++);
3109       EventReservedStackActivation event;
3110       if (event.should_commit()) {
3111         event.set_method(method);
3112         event.commit();
3113       }
3114     }
3115     if (fr.is_first_java_frame()) { 
3116       break;
3117     } else {
3118       fr = fr.java_sender();
3119     }
3120   } 
3121   return activation;
3122 }
3123 
src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File