< prev index next >
src/hotspot/share/runtime/thread.hpp
Print this page
rev 58073 : [mq]: v3
*** 682,702 ****
uintx threads_do_token() const { return _threads_do_token; }
// jvmtiRedefineClasses support
void metadata_handles_do(void f(Metadata*));
// Used by fast lock support
virtual bool is_lock_owned(address adr) const;
! // Check if address is in the live stack of this thread (not just for locks).
! // Warning: can only be called by the current thread on itself.
! bool is_in_stack(address adr) const;
! // Check if address in the stack mapped to this thread. Used mainly in
// error reporting (so has to include guard zone) and frame printing.
! bool on_local_stack(address adr) const {
! return (_stack_base > adr && adr >= stack_end());
}
// Sets this thread as starting thread. Returns failure if thread
// creation fails due to lack of memory, too many threads etc.
bool set_as_starting_thread();
--- 682,728 ----
uintx threads_do_token() const { return _threads_do_token; }
// jvmtiRedefineClasses support
void metadata_handles_do(void f(Metadata*));
+ private:
+
+ // Check if address is within the given range of this thread's
+ // stack: stack_base() > adr >/>= limit
+ // The check is inclusive of limit if passed true, else exclusive.
+ bool is_in_stack_range(address adr, address limit, bool inclusive) const {
+ assert(stack_base() > limit && limit >= stack_end(), "limit is outside of stack");
+ return stack_base() > adr && (inclusive ? adr >= limit : adr > limit);
+ }
+
+ public:
// Used by fast lock support
virtual bool is_lock_owned(address adr) const;
! // Check if address is within the given range of this thread's
! // stack: stack_base() > adr >= limit
! bool is_in_stack_range_incl(address adr, address limit) const {
! return is_in_stack_range(adr, limit, true);
! }
! // Check if address is within the given range of this thread's
! // stack: stack_base() > adr > limit
! bool is_in_stack_range_excl(address adr, address limit) const {
! return is_in_stack_range(adr, limit, false);
! }
!
! // Check if address is in the stack mapped to this thread. Used mainly in
// error reporting (so has to include guard zone) and frame printing.
! bool is_in_full_stack(address adr) const {
! return is_in_stack_range_incl(adr, stack_end());
! }
!
! // Check if address is in the live stack of this thread (not just for locks).
! // Warning: can only be called by the current thread on itself.
! bool is_in_live_stack(address adr) const {
! assert(Thread::current() == this, "is_in_live_stack can only be called from current thread");
! return is_in_stack_range_incl(adr, os::current_stack_pointer());
}
// Sets this thread as starting thread. Returns failure if thread
// creation fails due to lack of memory, too many threads etc.
bool set_as_starting_thread();
*** 1647,1657 ****
assert(is_aligned(s, os::vm_page_size()),
"We can not protect if the reserved zone size is not page aligned.");
assert(_stack_reserved_zone_size == 0, "This should be called only once.");
_stack_reserved_zone_size = s;
}
! address stack_reserved_zone_base() {
return (address)(stack_end() +
(stack_red_zone_size() + stack_yellow_zone_size() + stack_reserved_zone_size()));
}
bool in_stack_reserved_zone(address a) {
return (a <= stack_reserved_zone_base()) &&
--- 1673,1683 ----
assert(is_aligned(s, os::vm_page_size()),
"We can not protect if the reserved zone size is not page aligned.");
assert(_stack_reserved_zone_size == 0, "This should be called only once.");
_stack_reserved_zone_size = s;
}
! address stack_reserved_zone_base() const {
return (address)(stack_end() +
(stack_red_zone_size() + stack_yellow_zone_size() + stack_reserved_zone_size()));
}
bool in_stack_reserved_zone(address a) {
return (a <= stack_reserved_zone_base()) &&
*** 1730,1741 ****
stack_end() + MAX2(JavaThread::stack_guard_zone_size(), JavaThread::stack_shadow_zone_size());
}
// Check if address is in the usable part of the stack (excludes protected
// guard pages). Can be applied to any thread and is an approximation for
! // using is_in_stack when the query has to happen from another thread.
! bool is_in_usable_stack(address adr) const;
// Misc. accessors/mutators
void set_do_not_unlock(void) { _do_not_unlock_if_synchronized = true; }
void clr_do_not_unlock(void) { _do_not_unlock_if_synchronized = false; }
bool do_not_unlock(void) { return _do_not_unlock_if_synchronized; }
--- 1756,1769 ----
stack_end() + MAX2(JavaThread::stack_guard_zone_size(), JavaThread::stack_shadow_zone_size());
}
// Check if address is in the usable part of the stack (excludes protected
// guard pages). Can be applied to any thread and is an approximation for
! // using is_in_live_stack when the query has to happen from another thread.
! bool is_in_usable_stack(address adr) const {
! return is_in_stack_range_incl(adr, stack_reserved_zone_base());
! }
// Misc. accessors/mutators
void set_do_not_unlock(void) { _do_not_unlock_if_synchronized = true; }
void clr_do_not_unlock(void) { _do_not_unlock_if_synchronized = false; }
bool do_not_unlock(void) { return _do_not_unlock_if_synchronized; }
< prev index next >