1 /*
   2  * Copyright (c) 1998, 2016, 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_CODE_CODEBLOB_HPP
  26 #define SHARE_VM_CODE_CODEBLOB_HPP
  27 
  28 #include "asm/codeBuffer.hpp"
  29 #include "compiler/compilerDefinitions.hpp"
  30 #include "compiler/oopMap.hpp"
  31 #include "runtime/frame.hpp"
  32 #include "runtime/handles.hpp"
  33 #include "utilities/align.hpp"
  34 #include "utilities/macros.hpp"
  35 
  36 // CodeBlob Types
  37 // Used in the CodeCache to assign CodeBlobs to different CodeHeaps
  38 struct CodeBlobType {
  39   enum {
  40     MethodNonProfiled   = 0,    // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
  41     MethodProfiled      = 1,    // Execution level 2 and 3 (profiled) nmethods
  42     NonNMethod          = 2,    // Non-nmethods like Buffers, Adapters and Runtime Stubs
  43     All                 = 3,    // All types (No code cache segmentation)
  44     AOT                 = 4,    // AOT methods
  45     NumTypes            = 5     // Number of CodeBlobTypes
  46   };
  47 };
  48 
  49 // CodeBlob - superclass for all entries in the CodeCache.
  50 //
  51 // Subtypes are:
  52 //   CompiledMethod       : Compiled Java methods (include method that calls to native code)
  53 //     nmethod            : JIT Compiled Java methods
  54 //   RuntimeBlob          : Non-compiled method code; generated glue code
  55 //     RuntimeStub        : Call to VM runtime methods
  56 //     DeoptimizationBlob : Used for deoptimization
  57 //     ExceptionBlob      : Used for stack unrolling
  58 //     SafepointBlob      : Used to handle illegal instruction exceptions
  59 //
  60 //
  61 // Layout:
  62 //   - header
  63 //   - relocation
  64 //   - content space
  65 //     - instruction space
  66 //   - data space
  67 
  68 
  69 class CodeBlobLayout;
  70 
  71 class CodeBlob VALUE_OBJ_CLASS_SPEC {
  72   friend class VMStructs;
  73   friend class JVMCIVMStructs;
  74   friend class CodeCacheDumper;
  75   friend class CodeCache;
  76 
  77 protected:
  78 
  79   const CompilerType _type;                      // CompilerType
  80   int        _size;                              // total size of CodeBlob in bytes
  81   int        _header_size;                       // size of header (depends on subclass)
  82   int        _frame_complete_offset;             // instruction offsets in [0.._frame_complete_offset) have
  83                                                  // not finished setting up their frame. Beware of pc's in
  84                                                  // that range. There is a similar range(s) on returns
  85                                                  // which we don't detect.
  86   int        _data_offset;                       // offset to where data region begins
  87   int        _frame_size;                        // size of stack frame
  88 
  89   address    _code_begin;
  90   address    _code_end;
  91   address    _content_begin;                     // address to where content region begins (this includes consts, insts, stubs)
  92                                                  // address    _content_end - not required, for all CodeBlobs _code_end == _content_end for now
  93   address    _data_end;
  94   address    _relocation_begin;
  95   address    _relocation_end;
  96 
  97   ImmutableOopMapSet* _oop_maps;                 // OopMap for this CodeBlob
  98   bool                _caller_must_gc_arguments;
  99   CodeStrings         _strings;
 100   const char*         _name;
 101   S390_ONLY(int       _ctable_offset;)
 102 
 103   CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments);
 104   CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments);
 105 public:
 106   // Returns the space needed for CodeBlob
 107   static unsigned int allocation_size(CodeBuffer* cb, int header_size);
 108   static unsigned int align_code_offset(int offset);
 109 
 110   // Deletion
 111   virtual void flush();
 112 
 113   // Typing
 114   virtual bool is_buffer_blob() const                 { return false; }
 115   virtual bool is_nmethod() const                     { return false; }
 116   virtual bool is_runtime_stub() const                { return false; }
 117   virtual bool is_deoptimization_stub() const         { return false; }
 118   virtual bool is_uncommon_trap_stub() const          { return false; }
 119   virtual bool is_exception_stub() const              { return false; }
 120   virtual bool is_safepoint_stub() const              { return false; }
 121   virtual bool is_adapter_blob() const                { return false; }
 122   virtual bool is_method_handles_adapter_blob() const { return false; }
 123   virtual bool is_aot() const                         { return false; }
 124   virtual bool is_compiled() const                    { return false; }
 125 
 126   inline bool is_compiled_by_c1() const    { return _type == compiler_c1; };
 127   inline bool is_compiled_by_c2() const    { return _type == compiler_c2; };
 128   inline bool is_compiled_by_jvmci() const { return _type == compiler_jvmci; };
 129   inline bool is_compiled_by_shark() const { return _type == compiler_shark; };
 130   const char* compiler_name() const;
 131 
 132   // Casting
 133   nmethod* as_nmethod_or_null()                { return is_nmethod() ? (nmethod*) this : NULL; }
 134   nmethod* as_nmethod()                        { assert(is_nmethod(), "must be nmethod"); return (nmethod*) this; }
 135   CompiledMethod* as_compiled_method_or_null() { return is_compiled() ? (CompiledMethod*) this : NULL; }
 136   CompiledMethod* as_compiled_method()         { assert(is_compiled(), "must be compiled"); return (CompiledMethod*) this; }
 137   CodeBlob* as_codeblob_or_null() const        { return (CodeBlob*) this; }
 138 
 139   // Boundaries
 140   address header_begin() const        { return (address) this; }
 141   relocInfo* relocation_begin() const { return (relocInfo*) _relocation_begin; };
 142   relocInfo* relocation_end() const   { return (relocInfo*) _relocation_end; }
 143   address content_begin() const       { return _content_begin; }
 144   address content_end() const         { return _code_end; } // _code_end == _content_end is true for all types of blobs for now, it is also checked in the constructor
 145   address code_begin() const          { return _code_begin;    }
 146   address code_end() const            { return _code_end; }
 147   address data_end() const            { return _data_end;      }
 148 
 149   // This field holds the beginning of the const section in the old code buffer.
 150   // It is needed to fix relocations of pc-relative loads when resizing the
 151   // the constant pool or moving it.
 152   S390_ONLY(address ctable_begin() const { return header_begin() + _ctable_offset; })
 153   void set_ctable_begin(address ctable) { S390_ONLY(_ctable_offset = ctable - header_begin();) }
 154 
 155   // Sizes
 156   int size() const                               { return _size; }
 157   int header_size() const                        { return _header_size; }
 158   int relocation_size() const                    { return (address) relocation_end() - (address) relocation_begin(); }
 159   int content_size() const                       { return           content_end()    -           content_begin();    }
 160   int code_size() const                          { return           code_end()       -           code_begin();       }
 161 
 162   // Containment
 163   bool blob_contains(address addr) const         { return header_begin()       <= addr && addr < data_end();       }
 164   bool code_contains(address addr) const         { return code_begin()         <= addr && addr < code_end();       }
 165   bool contains(address addr) const              { return content_begin()      <= addr && addr < content_end();    }
 166   bool is_frame_complete_at(address addr) const  { return _frame_complete_offset != CodeOffsets::frame_never_safe &&
 167                                                           code_contains(addr) && addr >= code_begin() + _frame_complete_offset; }
 168 
 169   // CodeCache support: really only used by the nmethods, but in order to get
 170   // asserts and certain bookkeeping to work in the CodeCache they are defined
 171   // virtual here.
 172   virtual bool is_zombie() const                 { return false; }
 173   virtual bool is_locked_by_vm() const           { return false; }
 174 
 175   virtual bool is_unloaded() const               { return false; }
 176   virtual bool is_not_entrant() const            { return false; }
 177 
 178   // GC support
 179   virtual bool is_alive() const                  = 0;
 180 
 181   // OopMap for frame
 182   ImmutableOopMapSet* oop_maps() const           { return _oop_maps; }
 183   void set_oop_maps(OopMapSet* p);
 184   const ImmutableOopMap* oop_map_for_return_address(address return_address);
 185   virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) = 0;
 186 
 187   // Frame support
 188   int  frame_size() const                        { return _frame_size; }
 189   void set_frame_size(int size)                  { _frame_size = size; }
 190 
 191   // Returns true, if the next frame is responsible for GC'ing oops passed as arguments
 192   bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; }
 193 
 194   // Naming
 195   const char* name() const                       { return _name; }
 196   void set_name(const char* name)                { _name = name; }
 197 
 198   // Debugging
 199   virtual void verify() = 0;
 200   virtual void print() const                     { print_on(tty); };
 201   virtual void print_on(outputStream* st) const;
 202   virtual void print_value_on(outputStream* st) const;
 203   void print_code();
 204 
 205   // Print the comment associated with offset on stream, if there is one
 206   virtual void print_block_comment(outputStream* stream, address block_begin) const {
 207     intptr_t offset = (intptr_t)(block_begin - code_begin());
 208     _strings.print_block_comment(stream, offset);
 209   }
 210 
 211   // Transfer ownership of comments to this CodeBlob
 212   void set_strings(CodeStrings& strings) {
 213     assert(!is_aot(), "invalid on aot");
 214     _strings.assign(strings);
 215   }
 216 
 217   static ByteSize name_field_offset() {
 218     return byte_offset_of(CodeBlob, _name);
 219   }
 220 
 221   static ByteSize oop_maps_field_offset() {
 222     return byte_offset_of(CodeBlob, _oop_maps);
 223   }
 224 };
 225 
 226 class CodeBlobLayout : public StackObj {
 227 private:
 228   int _size;
 229   int _header_size;
 230   int _relocation_size;
 231   int _content_offset;
 232   int _code_offset;
 233   int _data_offset;
 234   address _code_begin;
 235   address _code_end;
 236   address _content_begin;
 237   address _content_end;
 238   address _data_end;
 239   address _relocation_begin;
 240   address _relocation_end;
 241 
 242 public:
 243   CodeBlobLayout(address code_begin, address code_end, address content_begin, address content_end, address data_end, address relocation_begin, address relocation_end) :
 244     _size(0),
 245     _header_size(0),
 246     _relocation_size(0),
 247     _content_offset(0),
 248     _code_offset(0),
 249     _data_offset(0),
 250     _content_begin(content_begin),
 251     _content_end(content_end),
 252     _code_begin(code_begin),
 253     _code_end(code_end),
 254     _data_end(data_end),
 255     _relocation_begin(relocation_begin),
 256     _relocation_end(relocation_end)
 257   {
 258   }
 259 
 260   CodeBlobLayout(const address start, int size, int header_size, int relocation_size, int data_offset) :
 261     _size(size),
 262     _header_size(header_size),
 263     _relocation_size(relocation_size),
 264     _content_offset(CodeBlob::align_code_offset(_header_size + _relocation_size)),
 265     _code_offset(_content_offset),
 266     _data_offset(data_offset)
 267   {
 268     assert(is_aligned(_relocation_size, oopSize), "unaligned size");
 269 
 270     _code_begin = (address) start + _code_offset;
 271     _code_end = (address) start + _data_offset;
 272 
 273     _content_begin = (address) start + _content_offset;
 274     _content_end = (address) start + _data_offset;
 275 
 276     _data_end = (address) start + _size;
 277     _relocation_begin = (address) start + _header_size;
 278     _relocation_end = _relocation_begin + _relocation_size;
 279   }
 280 
 281   CodeBlobLayout(const address start, int size, int header_size, const CodeBuffer* cb) :
 282     _size(size),
 283     _header_size(header_size),
 284     _relocation_size(align_up(cb->total_relocation_size(), oopSize)),
 285     _content_offset(CodeBlob::align_code_offset(_header_size + _relocation_size)),
 286     _code_offset(_content_offset + cb->total_offset_of(cb->insts())),
 287     _data_offset(_content_offset + align_up(cb->total_content_size(), oopSize))
 288   {
 289     assert(is_aligned(_relocation_size, oopSize), "unaligned size");
 290 
 291     _code_begin = (address) start + _code_offset;
 292     _code_end = (address) start + _data_offset;
 293 
 294     _content_begin = (address) start + _content_offset;
 295     _content_end = (address) start + _data_offset;
 296 
 297     _data_end = (address) start + _size;
 298     _relocation_begin = (address) start + _header_size;
 299     _relocation_end = _relocation_begin + _relocation_size;
 300   }
 301 
 302   int size() const { return _size; }
 303   int header_size() const { return _header_size; }
 304   int relocation_size() const { return _relocation_size; }
 305   int content_offset() const { return _content_offset; }
 306   int code_offset() const { return _code_offset; }
 307   int data_offset() const { return _data_offset; }
 308   address code_begin() const { return _code_begin; }
 309   address code_end() const { return _code_end; }
 310   address data_end() const { return _data_end; }
 311   address relocation_begin() const { return _relocation_begin; }
 312   address relocation_end() const { return _relocation_end; }
 313   address content_begin() const { return _content_begin; }
 314   address content_end() const { return _content_end; }
 315 };
 316 
 317 
 318 class RuntimeBlob : public CodeBlob {
 319   friend class VMStructs;
 320  public:
 321 
 322   // Creation
 323   // a) simple CodeBlob
 324   // frame_complete is the offset from the beginning of the instructions
 325   // to where the frame setup (from stackwalk viewpoint) is complete.
 326   RuntimeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size);
 327 
 328   // b) full CodeBlob
 329   RuntimeBlob(
 330     const char* name,
 331     CodeBuffer* cb,
 332     int         header_size,
 333     int         size,
 334     int         frame_complete,
 335     int         frame_size,
 336     OopMapSet*  oop_maps,
 337     bool        caller_must_gc_arguments = false
 338   );
 339 
 340   // GC support
 341   virtual bool is_alive() const                  = 0;
 342 
 343   void verify();
 344 
 345   // OopMap for frame
 346   virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { ShouldNotReachHere(); }
 347 
 348   // Debugging
 349   void print() const                             { print_on(tty); }
 350   virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
 351   virtual void print_value_on(outputStream* st) const { CodeBlob::print_value_on(st); }
 352 
 353   // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
 354   static void trace_new_stub(RuntimeBlob* blob, const char* name1, const char* name2 = "");
 355 };
 356 
 357 class WhiteBox;
 358 //----------------------------------------------------------------------------------------------------
 359 // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
 360 
 361 class BufferBlob: public RuntimeBlob {
 362   friend class VMStructs;
 363   friend class AdapterBlob;
 364   friend class MethodHandlesAdapterBlob;
 365   friend class WhiteBox;
 366 
 367  private:
 368   // Creation support
 369   BufferBlob(const char* name, int size);
 370   BufferBlob(const char* name, int size, CodeBuffer* cb);
 371 
 372   void* operator new(size_t s, unsigned size) throw();
 373 
 374  public:
 375   // Creation
 376   static BufferBlob* create(const char* name, int buffer_size);
 377   static BufferBlob* create(const char* name, CodeBuffer* cb);
 378 
 379   static void free(BufferBlob* buf);
 380 
 381   // Typing
 382   virtual bool is_buffer_blob() const            { return true; }
 383 
 384   // GC/Verification support
 385   void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { /* nothing to do */ }
 386   bool is_alive() const                          { return true; }
 387 
 388   void verify();
 389   void print_on(outputStream* st) const;
 390   void print_value_on(outputStream* st) const;
 391 };
 392 
 393 
 394 //----------------------------------------------------------------------------------------------------
 395 // AdapterBlob: used to hold C2I/I2C adapters
 396 
 397 class AdapterBlob: public BufferBlob {
 398 private:
 399   AdapterBlob(int size, CodeBuffer* cb);
 400 
 401 public:
 402   // Creation
 403   static AdapterBlob* create(CodeBuffer* cb);
 404 
 405   // Typing
 406   virtual bool is_adapter_blob() const { return true; }
 407 };
 408 
 409 
 410 //----------------------------------------------------------------------------------------------------
 411 // MethodHandlesAdapterBlob: used to hold MethodHandles adapters
 412 
 413 class MethodHandlesAdapterBlob: public BufferBlob {
 414 private:
 415   MethodHandlesAdapterBlob(int size)                 : BufferBlob("MethodHandles adapters", size) {}
 416 
 417 public:
 418   // Creation
 419   static MethodHandlesAdapterBlob* create(int buffer_size);
 420 
 421   // Typing
 422   virtual bool is_method_handles_adapter_blob() const { return true; }
 423 };
 424 
 425 
 426 //----------------------------------------------------------------------------------------------------
 427 // RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine
 428 
 429 class RuntimeStub: public RuntimeBlob {
 430   friend class VMStructs;
 431  private:
 432   // Creation support
 433   RuntimeStub(
 434     const char* name,
 435     CodeBuffer* cb,
 436     int         size,
 437     int         frame_complete,
 438     int         frame_size,
 439     OopMapSet*  oop_maps,
 440     bool        caller_must_gc_arguments
 441   );
 442 
 443   void* operator new(size_t s, unsigned size) throw();
 444 
 445  public:
 446   // Creation
 447   static RuntimeStub* new_runtime_stub(
 448     const char* stub_name,
 449     CodeBuffer* cb,
 450     int         frame_complete,
 451     int         frame_size,
 452     OopMapSet*  oop_maps,
 453     bool        caller_must_gc_arguments
 454   );
 455 
 456   // Typing
 457   bool is_runtime_stub() const                   { return true; }
 458 
 459   address entry_point() const                    { return code_begin(); }
 460 
 461   // GC/Verification support
 462   void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f)  { /* nothing to do */ }
 463   bool is_alive() const                          { return true; }
 464 
 465   void verify();
 466   void print_on(outputStream* st) const;
 467   void print_value_on(outputStream* st) const;
 468 };
 469 
 470 
 471 //----------------------------------------------------------------------------------------------------
 472 // Super-class for all blobs that exist in only one instance. Implements default behaviour.
 473 
 474 class SingletonBlob: public RuntimeBlob {
 475   friend class VMStructs;
 476 
 477  protected:
 478   void* operator new(size_t s, unsigned size) throw();
 479 
 480  public:
 481    SingletonBlob(
 482      const char* name,
 483      CodeBuffer* cb,
 484      int         header_size,
 485      int         size,
 486      int         frame_size,
 487      OopMapSet*  oop_maps
 488    )
 489    : RuntimeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps)
 490   {};
 491 
 492   address entry_point()                          { return code_begin(); }
 493 
 494   bool is_alive() const                          { return true; }
 495 
 496   // GC/Verification support
 497   void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f)  { /* nothing to do */ }
 498   void verify(); // does nothing
 499   void print_on(outputStream* st) const;
 500   void print_value_on(outputStream* st) const;
 501 };
 502 
 503 
 504 //----------------------------------------------------------------------------------------------------
 505 // DeoptimizationBlob
 506 
 507 class DeoptimizationBlob: public SingletonBlob {
 508   friend class VMStructs;
 509   friend class JVMCIVMStructs;
 510  private:
 511   int _unpack_offset;
 512   int _unpack_with_exception;
 513   int _unpack_with_reexecution;
 514 
 515   int _unpack_with_exception_in_tls;
 516 
 517 #if INCLUDE_JVMCI
 518   // Offsets when JVMCI calls uncommon_trap.
 519   int _uncommon_trap_offset;
 520   int _implicit_exception_uncommon_trap_offset;
 521 #endif
 522 
 523   // Creation support
 524   DeoptimizationBlob(
 525     CodeBuffer* cb,
 526     int         size,
 527     OopMapSet*  oop_maps,
 528     int         unpack_offset,
 529     int         unpack_with_exception_offset,
 530     int         unpack_with_reexecution_offset,
 531     int         frame_size
 532   );
 533 
 534  public:
 535   // Creation
 536   static DeoptimizationBlob* create(
 537     CodeBuffer* cb,
 538     OopMapSet*  oop_maps,
 539     int         unpack_offset,
 540     int         unpack_with_exception_offset,
 541     int         unpack_with_reexecution_offset,
 542     int         frame_size
 543   );
 544 
 545   // Typing
 546   bool is_deoptimization_stub() const { return true; }
 547   bool exception_address_is_unpack_entry(address pc) const {
 548     address unpack_pc = unpack();
 549     return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc);
 550   }
 551 
 552   // GC for args
 553   void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ }
 554 
 555   // Printing
 556   void print_value_on(outputStream* st) const;
 557 
 558   address unpack() const                         { return code_begin() + _unpack_offset;           }
 559   address unpack_with_exception() const          { return code_begin() + _unpack_with_exception;   }
 560   address unpack_with_reexecution() const        { return code_begin() + _unpack_with_reexecution; }
 561 
 562   // Alternate entry point for C1 where the exception and issuing pc
 563   // are in JavaThread::_exception_oop and JavaThread::_exception_pc
 564   // instead of being in registers.  This is needed because C1 doesn't
 565   // model exception paths in a way that keeps these registers free so
 566   // there may be live values in those registers during deopt.
 567   void set_unpack_with_exception_in_tls_offset(int offset) {
 568     _unpack_with_exception_in_tls = offset;
 569     assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob");
 570   }
 571   address unpack_with_exception_in_tls() const   { return code_begin() + _unpack_with_exception_in_tls; }
 572 
 573 #if INCLUDE_JVMCI
 574   // Offsets when JVMCI calls uncommon_trap.
 575   void set_uncommon_trap_offset(int offset) {
 576     _uncommon_trap_offset = offset;
 577     assert(contains(code_begin() + _uncommon_trap_offset), "must be PC inside codeblob");
 578   }
 579   address uncommon_trap() const                  { return code_begin() + _uncommon_trap_offset; }
 580 
 581   void set_implicit_exception_uncommon_trap_offset(int offset) {
 582     _implicit_exception_uncommon_trap_offset = offset;
 583     assert(contains(code_begin() + _implicit_exception_uncommon_trap_offset), "must be PC inside codeblob");
 584   }
 585   address implicit_exception_uncommon_trap() const { return code_begin() + _implicit_exception_uncommon_trap_offset; }
 586 #endif // INCLUDE_JVMCI
 587 };
 588 
 589 
 590 //----------------------------------------------------------------------------------------------------
 591 // UncommonTrapBlob (currently only used by Compiler 2)
 592 
 593 #ifdef COMPILER2
 594 
 595 class UncommonTrapBlob: public SingletonBlob {
 596   friend class VMStructs;
 597  private:
 598   // Creation support
 599   UncommonTrapBlob(
 600     CodeBuffer* cb,
 601     int         size,
 602     OopMapSet*  oop_maps,
 603     int         frame_size
 604   );
 605 
 606  public:
 607   // Creation
 608   static UncommonTrapBlob* create(
 609     CodeBuffer* cb,
 610     OopMapSet*  oop_maps,
 611     int         frame_size
 612   );
 613 
 614   // GC for args
 615   void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f)  { /* nothing to do */ }
 616 
 617   // Typing
 618   bool is_uncommon_trap_stub() const             { return true; }
 619 };
 620 
 621 
 622 //----------------------------------------------------------------------------------------------------
 623 // ExceptionBlob: used for exception unwinding in compiled code (currently only used by Compiler 2)
 624 
 625 class ExceptionBlob: public SingletonBlob {
 626   friend class VMStructs;
 627  private:
 628   // Creation support
 629   ExceptionBlob(
 630     CodeBuffer* cb,
 631     int         size,
 632     OopMapSet*  oop_maps,
 633     int         frame_size
 634   );
 635 
 636  public:
 637   // Creation
 638   static ExceptionBlob* create(
 639     CodeBuffer* cb,
 640     OopMapSet*  oop_maps,
 641     int         frame_size
 642   );
 643 
 644   // GC for args
 645   void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { /* nothing to do */ }
 646 
 647   // Typing
 648   bool is_exception_stub() const                 { return true; }
 649 };
 650 #endif // COMPILER2
 651 
 652 
 653 //----------------------------------------------------------------------------------------------------
 654 // SafepointBlob: handles illegal_instruction exceptions during a safepoint
 655 
 656 class SafepointBlob: public SingletonBlob {
 657   friend class VMStructs;
 658  private:
 659   // Creation support
 660   SafepointBlob(
 661     CodeBuffer* cb,
 662     int         size,
 663     OopMapSet*  oop_maps,
 664     int         frame_size
 665   );
 666 
 667  public:
 668   // Creation
 669   static SafepointBlob* create(
 670     CodeBuffer* cb,
 671     OopMapSet*  oop_maps,
 672     int         frame_size
 673   );
 674 
 675   // GC for args
 676   void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { /* nothing to do */ }
 677 
 678   // Typing
 679   bool is_safepoint_stub() const                 { return true; }
 680 };
 681 
 682 #endif // SHARE_VM_CODE_CODEBLOB_HPP