< prev index next >

src/hotspot/share/code/codeBlob.hpp

Print this page

  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_CODE_CODEBLOB_HPP
 26 #define SHARE_CODE_CODEBLOB_HPP
 27 
 28 #include "asm/codeBuffer.hpp"

 29 #include "compiler/compilerDefinitions.hpp"
 30 #include "compiler/oopMap.hpp"
 31 #include "runtime/javaFrameAnchor.hpp"
 32 #include "runtime/frame.hpp"
 33 #include "runtime/handles.hpp"
 34 #include "utilities/align.hpp"
 35 #include "utilities/macros.hpp"
 36 
 37 class ImmutableOopMap;
 38 class ImmutableOopMapSet;
 39 class JNIHandleBlock;
 40 class OopMapSet;
 41 
 42 // CodeBlob Types
 43 // Used in the CodeCache to assign CodeBlobs to different CodeHeaps
 44 enum class CodeBlobType {
 45   MethodNonProfiled   = 0,    // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
 46   MethodProfiled      = 1,    // Execution level 2 and 3 (profiled) nmethods
 47   NonNMethod          = 2,    // Non-nmethods like Buffers, Adapters and Runtime Stubs
 48   All                 = 3,    // All types (No code cache segmentation)

158 
159   static const Vptr* vptr(CodeBlobKind kind);
160   const Vptr* vptr() const;
161 
162   CodeBlob(const char* name, CodeBlobKind kind, CodeBuffer* cb, int size, uint16_t header_size,
163            int16_t frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments,
164            int mutable_data_size);
165 
166   // Simple CodeBlob used for simple BufferBlob.
167   CodeBlob(const char* name, CodeBlobKind kind, int size, uint16_t header_size);
168 
169 
170   void operator delete(void* p) { }
171 
172   void prepare_for_archiving_impl();
173   void post_restore_impl();
174 
175 public:
176 
177   ~CodeBlob() {
178     assert(_oop_maps == nullptr, "Not flushed");
179   }
180 
181   // Returns the space needed for CodeBlob
182   static unsigned int allocation_size(CodeBuffer* cb, int header_size);
183   static unsigned int align_code_offset(int offset);
184 
185   // Deletion
186   void purge();
187 
188   // Typing
189   bool is_nmethod() const                     { return _kind == CodeBlobKind::Nmethod; }
190   bool is_buffer_blob() const                 { return _kind == CodeBlobKind::Buffer; }
191   bool is_runtime_stub() const                { return _kind == CodeBlobKind::RuntimeStub; }
192   bool is_deoptimization_stub() const         { return _kind == CodeBlobKind::Deoptimization; }
193 #ifdef COMPILER2
194   bool is_uncommon_trap_stub() const          { return _kind == CodeBlobKind::UncommonTrap; }
195   bool is_exception_stub() const              { return _kind == CodeBlobKind::Exception; }
196 #else
197   bool is_uncommon_trap_stub() const          { return false; }
198   bool is_exception_stub() const              { return false; }

  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_CODE_CODEBLOB_HPP
 26 #define SHARE_CODE_CODEBLOB_HPP
 27 
 28 #include "asm/codeBuffer.hpp"
 29 #include "code/aotCodeCache.hpp"
 30 #include "compiler/compilerDefinitions.hpp"
 31 #include "compiler/oopMap.hpp"
 32 #include "runtime/javaFrameAnchor.hpp"
 33 #include "runtime/frame.hpp"
 34 #include "runtime/handles.hpp"
 35 #include "utilities/align.hpp"
 36 #include "utilities/macros.hpp"
 37 
 38 class ImmutableOopMap;
 39 class ImmutableOopMapSet;
 40 class JNIHandleBlock;
 41 class OopMapSet;
 42 
 43 // CodeBlob Types
 44 // Used in the CodeCache to assign CodeBlobs to different CodeHeaps
 45 enum class CodeBlobType {
 46   MethodNonProfiled   = 0,    // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
 47   MethodProfiled      = 1,    // Execution level 2 and 3 (profiled) nmethods
 48   NonNMethod          = 2,    // Non-nmethods like Buffers, Adapters and Runtime Stubs
 49   All                 = 3,    // All types (No code cache segmentation)

159 
160   static const Vptr* vptr(CodeBlobKind kind);
161   const Vptr* vptr() const;
162 
163   CodeBlob(const char* name, CodeBlobKind kind, CodeBuffer* cb, int size, uint16_t header_size,
164            int16_t frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments,
165            int mutable_data_size);
166 
167   // Simple CodeBlob used for simple BufferBlob.
168   CodeBlob(const char* name, CodeBlobKind kind, int size, uint16_t header_size);
169 
170 
171   void operator delete(void* p) { }
172 
173   void prepare_for_archiving_impl();
174   void post_restore_impl();
175 
176 public:
177 
178   ~CodeBlob() {
179     assert(_oop_maps == nullptr || AOTCodeCache::is_address_in_aot_cache((address)_oop_maps), "Not flushed");
180   }
181 
182   // Returns the space needed for CodeBlob
183   static unsigned int allocation_size(CodeBuffer* cb, int header_size);
184   static unsigned int align_code_offset(int offset);
185 
186   // Deletion
187   void purge();
188 
189   // Typing
190   bool is_nmethod() const                     { return _kind == CodeBlobKind::Nmethod; }
191   bool is_buffer_blob() const                 { return _kind == CodeBlobKind::Buffer; }
192   bool is_runtime_stub() const                { return _kind == CodeBlobKind::RuntimeStub; }
193   bool is_deoptimization_stub() const         { return _kind == CodeBlobKind::Deoptimization; }
194 #ifdef COMPILER2
195   bool is_uncommon_trap_stub() const          { return _kind == CodeBlobKind::UncommonTrap; }
196   bool is_exception_stub() const              { return _kind == CodeBlobKind::Exception; }
197 #else
198   bool is_uncommon_trap_stub() const          { return false; }
199   bool is_exception_stub() const              { return false; }
< prev index next >