src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hsx-gc Sdiff src/os_cpu/bsd_x86/vm

src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp

Print this page
rev 3849 : imported patch thread.inline.hpp


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"

  26 #include "runtime/threadLocalStorage.hpp"
  27 #include "thread_bsd.inline.hpp"
  28 
  29 // Map stack pointer (%esp) to thread pointer for faster TLS access
  30 //
  31 // Here we use a flat table for better performance. Getting current thread
  32 // is down to one memory access (read _sp_map[%esp>>12]) in generated code
  33 // and two in runtime code (-fPIC code needs an extra load for _sp_map).
  34 //
  35 // This code assumes stack page is not shared by different threads. It works
  36 // in 32-bit VM when page size is 4K (or a multiple of 4K, if that matters).
  37 //
  38 // Notice that _sp_map is allocated in the bss segment, which is ZFOD
  39 // (zero-fill-on-demand). While it reserves 4M address space upfront,
  40 // actual memory pages are committed on demand.
  41 //
  42 // If an application creates and destroys a lot of threads, usually the
  43 // stack space freed by a thread will soon get reused by new thread
  44 // (this is especially true in NPTL or BsdThreads in fixed-stack mode).
  45 // No memory page in _sp_map is wasted.
  46 //
  47 // However, it's still possible that we might end up populating &




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "runtime/thread.inline.hpp"
  27 #include "runtime/threadLocalStorage.hpp"

  28 
  29 // Map stack pointer (%esp) to thread pointer for faster TLS access
  30 //
  31 // Here we use a flat table for better performance. Getting current thread
  32 // is down to one memory access (read _sp_map[%esp>>12]) in generated code
  33 // and two in runtime code (-fPIC code needs an extra load for _sp_map).
  34 //
  35 // This code assumes stack page is not shared by different threads. It works
  36 // in 32-bit VM when page size is 4K (or a multiple of 4K, if that matters).
  37 //
  38 // Notice that _sp_map is allocated in the bss segment, which is ZFOD
  39 // (zero-fill-on-demand). While it reserves 4M address space upfront,
  40 // actual memory pages are committed on demand.
  41 //
  42 // If an application creates and destroys a lot of threads, usually the
  43 // stack space freed by a thread will soon get reused by new thread
  44 // (this is especially true in NPTL or BsdThreads in fixed-stack mode).
  45 // No memory page in _sp_map is wasted.
  46 //
  47 // However, it's still possible that we might end up populating &


src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File