src/share/vm/runtime/stubCodeGenerator.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   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 // All the basic framework for stubcode generation/debugging/printing.
  26 
  27 
  28 // A StubCodeDesc describes a piece of generated code (usually stubs).
  29 // This information is mainly useful for debugging and printing.
  30 // Currently, code descriptors are simply chained in a linked list,
  31 // this may have to change if searching becomes too slow.
  32 
  33 class StubCodeDesc: public CHeapObj {
  34  protected:
  35   static StubCodeDesc* _list;                  // the list of all descriptors
  36   static int           _count;                 // length of list
  37 
  38   StubCodeDesc*        _next;                  // the next element in the linked list
  39   const char*          _group;                 // the group to which the stub code belongs
  40   const char*          _name;                  // the name assigned to the stub code
  41   int                  _index;                 // serial number assigned to the stub
  42   address              _begin;                 // points to the first byte of the stub code    (included)
  43   address              _end;                   // points to the first byte after the stub code (excluded)
  44 


 102   virtual void stub_prolog(StubCodeDesc* cdesc); // called by StubCodeMark constructor
 103   virtual void stub_epilog(StubCodeDesc* cdesc); // called by StubCodeMark destructor
 104 };
 105 
 106 
 107 // Stack-allocated helper class used to assciate a stub code with a name.
 108 // All stub code generating functions that use a StubCodeMark will be registered
 109 // in the global StubCodeDesc list and the generated stub code can be identified
 110 // later via an address pointing into it.
 111 
 112 class StubCodeMark: public StackObj {
 113  protected:
 114   StubCodeGenerator* _cgen;
 115   StubCodeDesc*      _cdesc;
 116 
 117  public:
 118   StubCodeMark(StubCodeGenerator* cgen, const char* group, const char* name);
 119   ~StubCodeMark();
 120 
 121 };


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   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 #ifndef SHARE_VM_RUNTIME_STUBCODEGENERATOR_HPP
  26 #define SHARE_VM_RUNTIME_STUBCODEGENERATOR_HPP
  27 
  28 #include "asm/assembler.hpp"
  29 #include "memory/allocation.hpp"
  30 
  31 // All the basic framework for stubcode generation/debugging/printing.
  32 
  33 
  34 // A StubCodeDesc describes a piece of generated code (usually stubs).
  35 // This information is mainly useful for debugging and printing.
  36 // Currently, code descriptors are simply chained in a linked list,
  37 // this may have to change if searching becomes too slow.
  38 
  39 class StubCodeDesc: public CHeapObj {
  40  protected:
  41   static StubCodeDesc* _list;                  // the list of all descriptors
  42   static int           _count;                 // length of list
  43 
  44   StubCodeDesc*        _next;                  // the next element in the linked list
  45   const char*          _group;                 // the group to which the stub code belongs
  46   const char*          _name;                  // the name assigned to the stub code
  47   int                  _index;                 // serial number assigned to the stub
  48   address              _begin;                 // points to the first byte of the stub code    (included)
  49   address              _end;                   // points to the first byte after the stub code (excluded)
  50 


 108   virtual void stub_prolog(StubCodeDesc* cdesc); // called by StubCodeMark constructor
 109   virtual void stub_epilog(StubCodeDesc* cdesc); // called by StubCodeMark destructor
 110 };
 111 
 112 
 113 // Stack-allocated helper class used to assciate a stub code with a name.
 114 // All stub code generating functions that use a StubCodeMark will be registered
 115 // in the global StubCodeDesc list and the generated stub code can be identified
 116 // later via an address pointing into it.
 117 
 118 class StubCodeMark: public StackObj {
 119  protected:
 120   StubCodeGenerator* _cgen;
 121   StubCodeDesc*      _cdesc;
 122 
 123  public:
 124   StubCodeMark(StubCodeGenerator* cgen, const char* group, const char* name);
 125   ~StubCodeMark();
 126 
 127 };
 128 
 129 #endif // SHARE_VM_RUNTIME_STUBCODEGENERATOR_HPP