view ppc_patches/0006_C_interpreter-adapt_stack_handling.patch @ 4881:edf2bb42e70f

Recent changes to patch queue
author goetz
date Fri, 28 Jun 2013 16:31:09 +0200
parents df79d76c17ab
children
line wrap: on
line source
# HG changeset patch
# Parent 304ac424842e6acd4ffa7d12d290a5a59927d3f4
C-interpreter: Stack handling improvements.

Some shared functions supporting stack handling by the C-interpreter.

diff -r 304ac424842e src/share/vm/runtime/thread.cpp
--- a/src/share/vm/runtime/thread.cpp	Wed Jun 26 10:58:46 2013 +0200
+++ b/src/share/vm/runtime/thread.cpp	Wed Jun 26 15:38:36 2013 +0200
@@ -312,6 +312,8 @@
 void Thread::record_stack_base_and_size() {
   set_stack_base(os::current_stack_base());
   set_stack_size(os::current_stack_size());
+  if (is_Java_thread())
+    ((JavaThread*) this)->set_stack_overflow_limit();
   // CR 7190089: on Solaris, primordial thread's stack is adjusted
   // in initialize_thread(). Without the adjustment, stack size is
   // incorrect if stack is set to unlimited (ulimit -s unlimited).
diff -r 304ac424842e src/share/vm/runtime/thread.hpp
--- a/src/share/vm/runtime/thread.hpp	Wed Jun 26 10:58:46 2013 +0200
+++ b/src/share/vm/runtime/thread.hpp	Wed Jun 26 15:38:36 2013 +0200
@@ -893,7 +893,11 @@
 
  private:
 
-  StackGuardState        _stack_guard_state;
+  StackGuardState  _stack_guard_state;
+
+  // Precompute the limit of the stack as used in stack overflow checks.
+  // We load it from here to simplify the stack overflow check in assembly.
+  address          _stack_overflow_limit;
 
   // Compiler exception handling (NOTE: The _exception_oop is *NOT* the same as _pending_exception. It is
   // used to temp. parsing values into and out of the runtime system during exception handling for compiled
@@ -1301,6 +1305,12 @@
   // and reguard if possible.
   bool reguard_stack(void);
 
+  address stack_overflow_limit() { return _stack_overflow_limit; }
+  void set_stack_overflow_limit() {
+    _stack_overflow_limit = _stack_base - _stack_size +
+      ((StackShadowPages + StackYellowPages + StackRedPages) * os::vm_page_size());
+  }
+
   // 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; }
@@ -1335,6 +1345,7 @@
   static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop       ); }
   static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc        ); }
   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
+  static ByteSize stack_overflow_limit_offset()  { return byte_offset_of(JavaThread, _stack_overflow_limit); }
   static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); }
   static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state   ); }
   static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags       ); }