src/cpu/zero/vm/stack_zero.hpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2008, 2009, 2010 Red Hat, Inc.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 





  26 class ZeroStack {
  27  private:
  28   intptr_t *_base; // the last available word
  29   intptr_t *_top;  // the word past the end of the stack
  30   intptr_t *_sp;   // the top word on the stack
  31 
  32  private:
  33   int _shadow_pages_size; // how much ABI stack must we keep free?
  34 
  35  public:
  36   ZeroStack()
  37     : _base(NULL), _top(NULL), _sp(NULL) {
  38     _shadow_pages_size = StackShadowPages * os::vm_page_size();
  39   }
  40 
  41   bool needs_setup() const {
  42     return _base == NULL;
  43   }
  44 
  45   int suggest_size(Thread *thread) const;


 200   FakeStubFrame *as_fake_stub_frame() const {
 201     assert(is_fake_stub_frame(), "should be");
 202     return (FakeStubFrame *) this;
 203   }
 204 
 205  public:
 206   void identify_word(int   frame_index,
 207                      int   offset,
 208                      char* fieldbuf,
 209                      char* valuebuf,
 210                      int   buflen) const;
 211 
 212  protected:
 213   void identify_vp_word(int       frame_index,
 214                         intptr_t* addr,
 215                         intptr_t* monitor_base,
 216                         intptr_t* stack_base,
 217                         char*     fieldbuf,
 218                         int       buflen) const;
 219 };


   1 /*
   2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2008, 2009, 2010 Red Hat, Inc.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #ifndef CPU_ZERO_VM_STACK_ZERO_HPP
  27 #define CPU_ZERO_VM_STACK_ZERO_HPP
  28 
  29 #include "utilities/sizes.hpp"
  30 
  31 class ZeroStack {
  32  private:
  33   intptr_t *_base; // the last available word
  34   intptr_t *_top;  // the word past the end of the stack
  35   intptr_t *_sp;   // the top word on the stack
  36 
  37  private:
  38   int _shadow_pages_size; // how much ABI stack must we keep free?
  39 
  40  public:
  41   ZeroStack()
  42     : _base(NULL), _top(NULL), _sp(NULL) {
  43     _shadow_pages_size = StackShadowPages * os::vm_page_size();
  44   }
  45 
  46   bool needs_setup() const {
  47     return _base == NULL;
  48   }
  49 
  50   int suggest_size(Thread *thread) const;


 205   FakeStubFrame *as_fake_stub_frame() const {
 206     assert(is_fake_stub_frame(), "should be");
 207     return (FakeStubFrame *) this;
 208   }
 209 
 210  public:
 211   void identify_word(int   frame_index,
 212                      int   offset,
 213                      char* fieldbuf,
 214                      char* valuebuf,
 215                      int   buflen) const;
 216 
 217  protected:
 218   void identify_vp_word(int       frame_index,
 219                         intptr_t* addr,
 220                         intptr_t* monitor_base,
 221                         intptr_t* stack_base,
 222                         char*     fieldbuf,
 223                         int       buflen) const;
 224 };
 225 
 226 #endif // CPU_ZERO_VM_STACK_ZERO_HPP