Print this page
rev 1838 : 6961690: load oops from constant table on SPARC
Summary: oops should be loaded from the constant table of an nmethod instead of materializing them with a long code sequence.
Reviewed-by:

Split Close
Expand all
Collapse all
          --- old/src/share/vm/opto/compile.hpp
          +++ new/src/share/vm/opto/compile.hpp
↓ open down ↓ 22 lines elided ↑ open up ↑
  23   23   */
  24   24  
  25   25  class Block;
  26   26  class Bundle;
  27   27  class C2Compiler;
  28   28  class CallGenerator;
  29   29  class ConnectionGraph;
  30   30  class InlineTree;
  31   31  class Int_Array;
  32   32  class Matcher;
       33 +class MachConstantBaseNode;
  33   34  class MachNode;
  34   35  class MachSafePointNode;
  35   36  class Node;
  36   37  class Node_Array;
  37   38  class Node_Notes;
  38   39  class OptoReg;
  39   40  class PhaseCFG;
  40   41  class PhaseGVN;
  41   42  class PhaseIterGVN;
  42   43  class PhaseRegAlloc;
↓ open down ↓ 144 lines elided ↑ open up ↑
 187  188    Arena                 _node_arena;            // Arena for new-space Nodes
 188  189    Arena                 _old_arena;             // Arena for old-space Nodes, lifetime during xform
 189  190    RootNode*             _root;                  // Unique root of compilation, or NULL after bail-out.
 190  191    Node*                 _top;                   // Unique top node.  (Reset by various phases.)
 191  192  
 192  193    Node*                 _immutable_memory;      // Initial memory state
 193  194  
 194  195    Node*                 _recent_alloc_obj;
 195  196    Node*                 _recent_alloc_ctl;
 196  197  
      198 +  MachConstantBaseNode* _mach_constant_base_node;  // Constant table base node singleton.
      199 +
      200 +
 197  201    // Blocked array of debugging and profiling information,
 198  202    // tracked per node.
 199  203    enum { _log2_node_notes_block_size = 8,
 200  204           _node_notes_block_size = (1<<_log2_node_notes_block_size)
 201  205    };
 202  206    GrowableArray<Node_Notes*>* _node_note_array;
 203  207    Node_Notes*           _default_node_notes;  // default notes for new nodes
 204  208  
 205  209    // After parsing and every bulk phase we hang onto the Root instruction.
 206  210    // The RootNode instruction is where the whole program begins.  It produces
↓ open down ↓ 40 lines elided ↑ open up ↑
 247  251    // Instruction bits passed off to the VM
 248  252    int                   _method_size;           // Size of nmethod code segment in bytes
 249  253    CodeBuffer            _code_buffer;           // Where the code is assembled
 250  254    int                   _first_block_size;      // Size of unvalidated entry point code / OSR poison code
 251  255    ExceptionHandlerTable _handler_table;         // Table of native-code exception handlers
 252  256    ImplicitExceptionTable _inc_table;            // Table of implicit null checks in native code
 253  257    OopMapSet*            _oop_map_set;           // Table of oop maps (one for each safepoint location)
 254  258    static int            _CompiledZap_count;     // counter compared against CompileZap[First/Last]
 255  259    BufferBlob*           _scratch_buffer_blob;   // For temporary code buffers.
 256  260    relocInfo*            _scratch_locs_memory;   // For temporary code buffers.
      261 +  int                   _scratch_const_size;    // For temporary code buffers.
      262 +  bool                  _in_scratch_emit_size;  // true when in scratch_emit_size.
 257  263  
 258  264   public:
 259  265    // Accessors
 260  266  
 261  267    // The Compile instance currently active in this (compiler) thread.
 262  268    static Compile* current() {
 263  269      return (Compile*) ciEnv::current()->compiler_data();
 264  270    }
 265  271  
 266  272    // ID for this compilation.  Useful for setting breakpoints in the debugger.
↓ open down ↓ 162 lines elided ↑ open up ↑
 429  435    void         init_start(StartNode* s);
 430  436    Node*             immutable_memory();
 431  437  
 432  438    Node*             recent_alloc_ctl() const    { return _recent_alloc_ctl; }
 433  439    Node*             recent_alloc_obj() const    { return _recent_alloc_obj; }
 434  440    void          set_recent_alloc(Node* ctl, Node* obj) {
 435  441                                                    _recent_alloc_ctl = ctl;
 436  442                                                    _recent_alloc_obj = obj;
 437  443                                                  }
 438  444  
      445 +  MachConstantBaseNode*     mach_constant_base_node();
      446 +  bool                  has_mach_constant_base_node() const { return _mach_constant_base_node != NULL; }
      447 +
 439  448    // Handy undefined Node
 440  449    Node*             top() const                 { return _top; }
 441  450  
 442  451    // these are used by guys who need to know about creation and transformation of top:
 443  452    Node*             cached_top_node()           { return _top; }
 444  453    void          set_cached_top_node(Node* tn);
 445  454  
 446  455    GrowableArray<Node_Notes*>* node_note_array() const { return _node_note_array; }
 447  456    void set_node_note_array(GrowableArray<Node_Notes*>* arr) { _node_note_array = arr; }
 448  457    Node_Notes* default_node_notes() const        { return _default_node_notes; }
↓ open down ↓ 131 lines elided ↑ open up ↑
 580  589    CodeBuffer*       code_buffer()               { return &_code_buffer; }
 581  590    int               first_block_size()          { return _first_block_size; }
 582  591    void              set_frame_complete(int off) { _code_offsets.set_value(CodeOffsets::Frame_Complete, off); }
 583  592    ExceptionHandlerTable*  handler_table()       { return &_handler_table; }
 584  593    ImplicitExceptionTable* inc_table()           { return &_inc_table; }
 585  594    OopMapSet*        oop_map_set()               { return _oop_map_set; }
 586  595    DebugInformationRecorder* debug_info()        { return env()->debug_info(); }
 587  596    Dependencies*     dependencies()              { return env()->dependencies(); }
 588  597    static int        CompiledZap_count()         { return _CompiledZap_count; }
 589  598    BufferBlob*       scratch_buffer_blob()       { return _scratch_buffer_blob; }
 590      -  void         init_scratch_buffer_blob();
      599 +  void         init_scratch_buffer_blob(int const_size);
      600 +  void        clear_scratch_buffer_blob();
 591  601    void          set_scratch_buffer_blob(BufferBlob* b) { _scratch_buffer_blob = b; }
 592  602    relocInfo*        scratch_locs_memory()       { return _scratch_locs_memory; }
 593  603    void          set_scratch_locs_memory(relocInfo* b)  { _scratch_locs_memory = b; }
 594  604  
 595  605    // emit to scratch blob, report resulting size
 596  606    uint              scratch_emit_size(const Node* n);
      607 +  void       set_in_scratch_emit_size(bool x)   {        _in_scratch_emit_size = x; }
      608 +  bool           in_scratch_emit_size() const   { return _in_scratch_emit_size;     }
 597  609  
 598  610    enum ScratchBufferBlob {
 599  611      MAX_inst_size       = 1024,
 600  612      MAX_locs_size       = 128, // number of relocInfo elements
 601  613      MAX_const_size      = 128,
 602  614      MAX_stubs_size      = 128
 603  615    };
 604  616  
 605  617    // Major entry point.  Given a Scope, compile the associated method.
 606  618    // For normal compilations, entry_bci is InvocationEntryBci.  For on stack
↓ open down ↓ 60 lines elided ↑ open up ↑
 667  679    static void set_sv_for_object_node(GrowableArray<ScopeValue*> *objs,
 668  680                                       ObjectValue* sv );
 669  681  
 670  682    // Process an OopMap Element while emitting nodes
 671  683    void Process_OopMap_Node(MachNode *mach, int code_offset);
 672  684  
 673  685    // Write out basic block data to code buffer
 674  686    void Fill_buffer();
 675  687  
 676  688    // Determine which variable sized branches can be shortened
 677      -  void Shorten_branches(Label *labels, int& code_size, int& reloc_size, int& stub_size, int& const_size);
      689 +  void Shorten_branches(Label *labels, int& code_size, int& reloc_size, int& stub_size);
 678  690  
 679  691    // Compute the size of first NumberOfLoopInstrToAlign instructions
 680  692    // at the head of a loop.
 681  693    void compute_loop_first_inst_sizes();
 682  694  
 683  695    // Compute the information for the exception tables
 684  696    void FillExceptionTables(uint cnt, uint *call_returns, uint *inct_starts, Label *blk_labels);
 685  697  
 686  698    // Stack slots that may be unused by the calling convention but must
 687  699    // otherwise be preserved.  On Intel this includes the return address.
↓ open down ↓ 92 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX