3126 |
3126 |
3127 #endif /* PRODUCT */ |
3127 #endif /* PRODUCT */ |
3128 |
3128 |
3129 JRT_LEAF(void, SharedRuntime::enable_stack_reserved_zone(JavaThread* thread)) |
3129 JRT_LEAF(void, SharedRuntime::enable_stack_reserved_zone(JavaThread* thread)) |
3130 assert(thread->is_Java_thread(), "Only Java threads have a stack reserved zone"); |
3130 assert(thread->is_Java_thread(), "Only Java threads have a stack reserved zone"); |
|
3131 if (thread->stack_reserved_zone_disabled()) { |
3131 thread->enable_stack_reserved_zone(); |
3132 thread->enable_stack_reserved_zone(); |
|
3133 } |
3132 thread->set_reserved_stack_activation(thread->stack_base()); |
3134 thread->set_reserved_stack_activation(thread->stack_base()); |
3133 JRT_END |
3135 JRT_END |
3134 |
3136 |
3135 frame SharedRuntime::look_for_reserved_stack_annotated_method(JavaThread* thread, frame fr) { |
3137 frame SharedRuntime::look_for_reserved_stack_annotated_method(JavaThread* thread, frame fr) { |
|
3138 ResourceMark rm(thread); |
3136 frame activation; |
3139 frame activation; |
3137 CompiledMethod* nm = NULL; |
3140 CompiledMethod* nm = NULL; |
3138 int count = 1; |
3141 int count = 1; |
3139 |
3142 |
3140 assert(fr.is_java_frame(), "Must start on Java frame"); |
3143 assert(fr.is_java_frame(), "Must start on Java frame"); |
3141 |
3144 |
3142 while (true) { |
3145 while (true) { |
3143 Method* method = NULL; |
3146 Method* method = NULL; |
|
3147 bool found = false; |
3144 if (fr.is_interpreted_frame()) { |
3148 if (fr.is_interpreted_frame()) { |
3145 method = fr.interpreter_frame_method(); |
3149 method = fr.interpreter_frame_method(); |
|
3150 if (method != NULL && method->has_reserved_stack_access()) { |
|
3151 found = true; |
|
3152 } |
3146 } else { |
3153 } else { |
3147 CodeBlob* cb = fr.cb(); |
3154 CodeBlob* cb = fr.cb(); |
3148 if (cb != NULL && cb->is_compiled()) { |
3155 if (cb != NULL && cb->is_compiled()) { |
3149 nm = cb->as_compiled_method(); |
3156 nm = cb->as_compiled_method(); |
3150 method = nm->method(); |
3157 method = nm->method(); |
3151 } |
3158 // scope_desc_near() must be used, instead of scope_desc_at() because on |
3152 } |
3159 // SPARC, the pcDesc can be on the delay slot after the call instruction. |
3153 if ((method != NULL) && method->has_reserved_stack_access()) { |
3160 for (ScopeDesc *sd = nm->scope_desc_near(fr.pc()); sd != NULL; sd = sd->sender()) { |
3154 ResourceMark rm(thread); |
3161 method = sd->method(); |
|
3162 if (method != NULL && method->has_reserved_stack_access()) { |
|
3163 found = true; |
|
3164 } |
|
3165 } |
|
3166 } |
|
3167 } |
|
3168 if (found) { |
3155 activation = fr; |
3169 activation = fr; |
3156 warning("Potentially dangerous stack overflow in " |
3170 warning("Potentially dangerous stack overflow in " |
3157 "ReservedStackAccess annotated method %s [%d]", |
3171 "ReservedStackAccess annotated method %s [%d]", |
3158 method->name_and_sig_as_C_string(), count++); |
3172 method->name_and_sig_as_C_string(), count++); |
3159 EventReservedStackActivation event; |
3173 EventReservedStackActivation event; |