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