Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/vm/code/codeBlob.hpp
          +++ new/src/share/vm/code/codeBlob.hpp
↓ open down ↓ 46 lines elided ↑ open up ↑
  47   47    const char* _name;
  48   48    int        _size;                              // total size of CodeBlob in bytes
  49   49    int        _header_size;                       // size of header (depends on subclass)
  50   50    int        _relocation_size;                   // size of relocation
  51   51    int        _instructions_offset;               // offset to where instructions region begins
  52   52    int        _frame_complete_offset;             // instruction offsets in [0.._frame_complete_offset) have
  53   53                                                   // not finished setting up their frame. Beware of pc's in
  54   54                                                   // that range. There is a similar range(s) on returns
  55   55                                                   // which we don't detect.
  56   56    int        _data_offset;                       // offset to where data region begins
  57      -  int        _oops_offset;                       // offset to where embedded oop table begins (inside data)
  58      -  int        _oops_length;                       // number of embedded oops
  59   57    int        _frame_size;                        // size of stack frame
  60   58    OopMapSet* _oop_maps;                          // OopMap for this CodeBlob
  61   59    CodeComments _comments;
  62   60  
  63   61    friend class OopRecorder;
  64   62  
  65      -  void fix_oop_relocations(address begin, address end, bool initialize_immediates);
  66      -  inline void initialize_immediate_oop(oop* dest, jobject handle);
  67      -
  68   63   public:
  69   64    // Returns the space needed for CodeBlob
  70   65    static unsigned int allocation_size(CodeBuffer* cb, int header_size);
  71   66  
  72   67    // Creation
  73   68    // a) simple CodeBlob
  74   69    // frame_complete is the offset from the beginning of the instructions
  75   70    // to where the frame setup (from stackwalk viewpoint) is complete.
  76   71    CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size);
  77   72  
↓ open down ↓ 30 lines elided ↑ open up ↑
 108  103  
 109  104    // Boundaries
 110  105    address    header_begin() const                { return (address)    this; }
 111  106    address    header_end() const                  { return ((address)   this) + _header_size; };
 112  107    relocInfo* relocation_begin() const            { return (relocInfo*) header_end(); };
 113  108    relocInfo* relocation_end() const              { return (relocInfo*)(header_end()   + _relocation_size); }
 114  109    address    instructions_begin() const          { return (address)    header_begin() + _instructions_offset;  }
 115  110    address    instructions_end() const            { return (address)    header_begin() + _data_offset; }
 116  111    address    data_begin() const                  { return (address)    header_begin() + _data_offset; }
 117  112    address    data_end() const                    { return (address)    header_begin() + _size; }
 118      -  oop*       oops_begin() const                  { return (oop*)      (header_begin() + _oops_offset); }
 119      -  oop*       oops_end() const                    { return                oops_begin() + _oops_length; }
 120  113  
 121  114    // Offsets
 122  115    int relocation_offset() const                  { return _header_size; }
 123  116    int instructions_offset() const                { return _instructions_offset; }
 124  117    int data_offset() const                        { return _data_offset; }
 125      -  int oops_offset() const                        { return _oops_offset; }
 126  118  
 127  119    // Sizes
 128  120    int size() const                               { return _size; }
 129  121    int header_size() const                        { return _header_size; }
 130  122    int relocation_size() const                    { return (address) relocation_end() - (address) relocation_begin(); }
 131  123    int instructions_size() const                  { return instructions_end() - instructions_begin();  }
 132  124    int data_size() const                          { return data_end() - data_begin(); }
 133      -  int oops_size() const                          { return (address) oops_end() - (address) oops_begin(); }
 134  125  
 135  126    // Containment
 136  127    bool blob_contains(address addr) const         { return header_begin()       <= addr && addr < data_end(); }
 137  128    bool relocation_contains(relocInfo* addr) const{ return relocation_begin()   <= addr && addr < relocation_end(); }
 138  129    bool instructions_contains(address addr) const { return instructions_begin() <= addr && addr < instructions_end(); }
 139  130    bool data_contains(address addr) const         { return data_begin()         <= addr && addr < data_end(); }
 140      -  bool oops_contains(oop* addr) const            { return oops_begin()         <= addr && addr < oops_end(); }
 141  131    bool contains(address addr) const              { return instructions_contains(addr); }
 142  132    bool is_frame_complete_at(address addr) const  { return instructions_contains(addr) &&
 143  133                                                            addr >= instructions_begin() + _frame_complete_offset; }
 144  134  
 145      -  // Relocation support
 146      -  void fix_oop_relocations(address begin, address end) {
 147      -    fix_oop_relocations(begin, end, false);
 148      -  }
 149      -  void fix_oop_relocations() {
 150      -    fix_oop_relocations(NULL, NULL, false);
 151      -  }
 152      -  relocInfo::relocType reloc_type_for_address(address pc);
 153      -  bool is_at_poll_return(address pc);
 154      -  bool is_at_poll_or_poll_return(address pc);
 155      -
 156      -  // Support for oops in scopes and relocs:
 157      -  // Note: index 0 is reserved for null.
 158      -  oop  oop_at(int index) const                   { return index == 0? (oop)NULL: *oop_addr_at(index); }
 159      -  oop* oop_addr_at(int index) const{             // for GC
 160      -    // relocation indexes are biased by 1 (because 0 is reserved)
 161      -    assert(index > 0 && index <= _oops_length, "must be a valid non-zero index");
 162      -    return &oops_begin()[index-1];
 163      -  }
 164      -
 165      -  void copy_oops(GrowableArray<jobject>* oops);
 166      -
 167  135    // CodeCache support: really only used by the nmethods, but in order to get
 168  136    // asserts and certain bookkeeping to work in the CodeCache they are defined
 169  137    // virtual here.
 170  138    virtual bool is_zombie() const                 { return false; }
 171  139    virtual bool is_locked_by_vm() const           { return false; }
 172  140  
 173  141    virtual bool is_unloaded() const               { return false; }
 174  142    virtual bool is_not_entrant() const            { return false; }
 175  143  
 176  144    // GC support
 177  145    virtual bool is_alive() const                  = 0;
 178      -  virtual void do_unloading(BoolObjectClosure* is_alive,
 179      -                            OopClosure* keep_alive,
 180      -                            bool unloading_occurred);
 181      -  virtual void oops_do(OopClosure* f) = 0;
 182      -  // (All CodeBlob subtypes other than NMethod currently have
 183      -  // an empty oops_do() method.
 184  146  
 185  147    // OopMap for frame
 186  148    OopMapSet* oop_maps() const                    { return _oop_maps; }
 187  149    void set_oop_maps(OopMapSet* p);
 188  150    OopMap* oop_map_for_return_address(address return_address);
 189  151    virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { ShouldNotReachHere(); }
 190  152  
 191  153    // Frame support
 192  154    int  frame_size() const                        { return _frame_size; }
 193  155    void set_frame_size(int size)                  { _frame_size = size; }
↓ open down ↓ 44 lines elided ↑ open up ↑
 238  200    static BufferBlob* create(const char* name, CodeBuffer* cb);
 239  201  
 240  202    static void free(BufferBlob* buf);
 241  203  
 242  204    // Typing
 243  205    virtual bool is_buffer_blob() const            { return true; }
 244  206  
 245  207    // GC/Verification support
 246  208    void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { /* nothing to do */ }
 247  209    bool is_alive() const                          { return true; }
 248      -  void do_unloading(BoolObjectClosure* is_alive,
 249      -                    OopClosure* keep_alive,
 250      -                    bool unloading_occurred)     { /* do nothing */ }
 251      -
 252      -  void oops_do(OopClosure* f)                    { /* do nothing*/ }
 253  210  
 254  211    void verify();
 255  212    void print() const                             PRODUCT_RETURN;
 256  213    void print_value_on(outputStream* st) const    PRODUCT_RETURN;
 257  214  };
 258  215  
 259  216  
 260  217  //----------------------------------------------------------------------------------------------------
 261  218  // AdapterBlob: used to hold C2I/I2C adapters
 262  219  
↓ open down ↓ 64 lines elided ↑ open up ↑
 327  284    bool is_runtime_stub() const                   { return true; }
 328  285  
 329  286    // GC support
 330  287    bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; }
 331  288  
 332  289    address entry_point()                          { return instructions_begin(); }
 333  290  
 334  291    // GC/Verification support
 335  292    void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f)  { /* nothing to do */ }
 336  293    bool is_alive() const                          { return true; }
 337      -  void do_unloading(BoolObjectClosure* is_alive,
 338      -                    OopClosure* keep_alive,
 339      -                    bool unloading_occurred)     { /* do nothing */ }
 340      -  void oops_do(OopClosure* f) { /* do-nothing*/ }
 341  294  
 342  295    void verify();
 343  296    void print() const                             PRODUCT_RETURN;
 344  297    void print_value_on(outputStream* st) const    PRODUCT_RETURN;
 345  298  };
 346  299  
 347  300  
 348  301  //----------------------------------------------------------------------------------------------------
 349  302  // Super-class for all blobs that exist in only one instance. Implements default behaviour.
 350  303  
↓ open down ↓ 5 lines elided ↑ open up ↑
 356  309       CodeBuffer* cb,
 357  310       int         header_size,
 358  311       int         size,
 359  312       int         frame_size,
 360  313       OopMapSet*  oop_maps
 361  314     )
 362  315     : CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps)
 363  316     {};
 364  317  
 365  318     bool is_alive() const                         { return true; }
 366      -   void do_unloading(BoolObjectClosure* is_alive,
 367      -                     OopClosure* keep_alive,
 368      -                     bool unloading_occurred)    { /* do-nothing*/ }
 369  319  
 370  320     void verify(); // does nothing
 371  321     void print() const                            PRODUCT_RETURN;
 372  322     void print_value_on(outputStream* st) const   PRODUCT_RETURN;
 373  323  };
 374  324  
 375  325  
 376  326  //----------------------------------------------------------------------------------------------------
 377  327  // DeoptimizationBlob
 378  328  
↓ open down ↓ 37 lines elided ↑ open up ↑
 416  366      address unpack_pc = unpack();
 417  367      return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc);
 418  368    }
 419  369  
 420  370  
 421  371  
 422  372  
 423  373    // GC for args
 424  374    void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ }
 425  375  
 426      -  // Iteration
 427      -  void oops_do(OopClosure* f) {}
 428      -
 429  376    // Printing
 430  377    void print_value_on(outputStream* st) const PRODUCT_RETURN;
 431  378  
 432  379    address unpack() const                         { return instructions_begin() + _unpack_offset;           }
 433  380    address unpack_with_exception() const          { return instructions_begin() + _unpack_with_exception;   }
 434  381    address unpack_with_reexecution() const        { return instructions_begin() + _unpack_with_reexecution; }
 435  382  
 436  383    // Alternate entry point for C1 where the exception and issuing pc
 437  384    // are in JavaThread::_exception_oop and JavaThread::_exception_pc
 438  385    // instead of being in registers.  This is needed because C1 doesn't
↓ open down ↓ 31 lines elided ↑ open up ↑
 470  417      CodeBuffer* cb,
 471  418      OopMapSet*  oop_maps,
 472  419      int         frame_size
 473  420    );
 474  421  
 475  422    // GC for args
 476  423    void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f)  { /* nothing to do */ }
 477  424  
 478  425    // Typing
 479  426    bool is_uncommon_trap_stub() const             { return true; }
 480      -
 481      -  // Iteration
 482      -  void oops_do(OopClosure* f) {}
 483  427  };
 484  428  
 485  429  
 486  430  //----------------------------------------------------------------------------------------------------
 487  431  // ExceptionBlob: used for exception unwinding in compiled code (currently only used by Compiler 2)
 488  432  
 489  433  class ExceptionBlob: public SingletonBlob {
 490  434    friend class VMStructs;
 491  435   private:
 492  436    // Creation support
↓ open down ↓ 12 lines elided ↑ open up ↑
 505  449      CodeBuffer* cb,
 506  450      OopMapSet*  oop_maps,
 507  451      int         frame_size
 508  452    );
 509  453  
 510  454    // GC for args
 511  455    void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { /* nothing to do */ }
 512  456  
 513  457    // Typing
 514  458    bool is_exception_stub() const                 { return true; }
 515      -
 516      -  // Iteration
 517      -  void oops_do(OopClosure* f) {}
 518  459  };
 519  460  #endif // COMPILER2
 520  461  
 521  462  
 522  463  //----------------------------------------------------------------------------------------------------
 523  464  // SafepointBlob: handles illegal_instruction exceptions during a safepoint
 524  465  
 525  466  class SafepointBlob: public SingletonBlob {
 526  467    friend class VMStructs;
 527  468   private:
↓ open down ↓ 13 lines elided ↑ open up ↑
 541  482      CodeBuffer* cb,
 542  483      OopMapSet*  oop_maps,
 543  484      int         frame_size
 544  485    );
 545  486  
 546  487    // GC for args
 547  488    void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { /* nothing to do */ }
 548  489  
 549  490    // Typing
 550  491    bool is_safepoint_stub() const                 { return true; }
 551      -
 552      -  // Iteration
 553      -  void oops_do(OopClosure* f) {}
 554  492  };
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX