< prev index next >

src/hotspot/share/opto/compile.hpp

Print this page




  38 #include "oops/methodData.hpp"
  39 #include "opto/idealGraphPrinter.hpp"
  40 #include "opto/phasetype.hpp"
  41 #include "opto/phase.hpp"
  42 #include "opto/regmask.hpp"
  43 #include "runtime/deoptimization.hpp"
  44 #include "runtime/timerTrace.hpp"
  45 #include "runtime/vmThread.hpp"
  46 #include "utilities/ticks.hpp"
  47 
  48 class AddPNode;
  49 class Block;
  50 class Bundle;
  51 class C2Compiler;
  52 class CallGenerator;
  53 class CloneMap;
  54 class ConnectionGraph;
  55 class IdealGraphPrinter;
  56 class InlineTree;
  57 class Int_Array;
  58 class LoadBarrierNode;
  59 class Matcher;
  60 class MachConstantNode;
  61 class MachConstantBaseNode;
  62 class MachNode;
  63 class MachOper;
  64 class MachSafePointNode;
  65 class Node;
  66 class Node_Array;
  67 class Node_Notes;
  68 class NodeCloneInfo;
  69 class OptoReg;
  70 class PhaseCFG;
  71 class PhaseGVN;
  72 class PhaseIterGVN;
  73 class PhaseRegAlloc;
  74 class PhaseCCP;
  75 class PhaseCCP_DCE;
  76 class RootNode;
  77 class relocInfo;
  78 class Scope;
  79 class StartNode;
  80 class SafePointNode;
  81 class JVMState;
  82 class Type;
  83 class TypeData;
  84 class TypeInt;
  85 class TypePtr;
  86 class TypeOopPtr;
  87 class TypeFunc;
  88 class Unique_Node_List;
  89 class nmethod;
  90 class WarmCallInfo;
  91 class Node_Stack;
  92 struct Final_Reshape_Counts;
  93 
  94 enum LoopOptsMode {
  95   LoopOptsDefault,
  96   LoopOptsNone,
  97   LoopOptsShenandoahExpand,
  98   LoopOptsShenandoahPostExpand,
  99   LoopOptsZBarrierInsertion,
 100   LoopOptsSkipSplitIf,
 101   LoopOptsVerify
 102 };
 103 
 104 typedef unsigned int node_idx_t;
 105 class NodeCloneInfo {
 106  private:
 107   uint64_t _idx_clone_orig;
 108  public:
 109 
 110   void set_idx(node_idx_t idx) {
 111     _idx_clone_orig = (_idx_clone_orig & CONST64(0xFFFFFFFF00000000)) | idx;
 112   }
 113   node_idx_t idx() const { return (node_idx_t)(_idx_clone_orig & 0xFFFFFFFF); }
 114 
 115   void set_gen(int generation) {
 116     uint64_t g = (uint64_t)generation << 32;
 117     _idx_clone_orig = (_idx_clone_orig & 0xFFFFFFFF) | g;
 118   }
 119   int gen() const { return (int)(_idx_clone_orig >> 32); }


1169   void              set_frame_complete(int off) { if (!in_scratch_emit_size()) { _code_offsets.set_value(CodeOffsets::Frame_Complete, off); } }
1170   ExceptionHandlerTable*  handler_table()       { return &_handler_table; }
1171   ImplicitExceptionTable* inc_table()           { return &_inc_table; }
1172   OopMapSet*        oop_map_set()               { return _oop_map_set; }
1173   DebugInformationRecorder* debug_info()        { return env()->debug_info(); }
1174   Dependencies*     dependencies()              { return env()->dependencies(); }
1175   static int        CompiledZap_count()         { return _CompiledZap_count; }
1176   BufferBlob*       scratch_buffer_blob()       { return _scratch_buffer_blob; }
1177   void         init_scratch_buffer_blob(int const_size);
1178   void        clear_scratch_buffer_blob();
1179   void          set_scratch_buffer_blob(BufferBlob* b) { _scratch_buffer_blob = b; }
1180   relocInfo*        scratch_locs_memory()       { return _scratch_locs_memory; }
1181   void          set_scratch_locs_memory(relocInfo* b)  { _scratch_locs_memory = b; }
1182 
1183   // emit to scratch blob, report resulting size
1184   uint              scratch_emit_size(const Node* n);
1185   void       set_in_scratch_emit_size(bool x)   {        _in_scratch_emit_size = x; }
1186   bool           in_scratch_emit_size() const   { return _in_scratch_emit_size;     }
1187 
1188   enum ScratchBufferBlob {
1189 #if defined(PPC64)
1190     MAX_inst_size       = 2048,
1191 #else
1192     MAX_inst_size       = 1024,
1193 #endif
1194     MAX_locs_size       = 128, // number of relocInfo elements
1195     MAX_const_size      = 128,
1196     MAX_stubs_size      = 128
1197   };
1198 
1199   // Major entry point.  Given a Scope, compile the associated method.
1200   // For normal compilations, entry_bci is InvocationEntryBci.  For on stack
1201   // replacement, entry_bci indicates the bytecode for which to compile a
1202   // continuation.
1203   Compile(ciEnv* ci_env, C2Compiler* compiler, ciMethod* target,
1204           int entry_bci, bool subsume_loads, bool do_escape_analysis,
1205           bool eliminate_boxing, DirectiveSet* directive);
1206 
1207   // Second major entry point.  From the TypeFunc signature, generate code
1208   // to pass arguments from the Java calling convention to the C calling
1209   // convention.
1210   Compile(ciEnv* ci_env, const TypeFunc *(*gen)(),
1211           address stub_function, const char *stub_name,
1212           int is_fancy_jump, bool pass_tls,
1213           bool save_arg_registers, bool return_pc, DirectiveSet* directive);


1248   // Build OopMaps for each GC point
1249   void BuildOopMaps();
1250 
1251   // Append debug info for the node "local" at safepoint node "sfpt" to the
1252   // "array",   May also consult and add to "objs", which describes the
1253   // scalar-replaced objects.
1254   void FillLocArray( int idx, MachSafePointNode* sfpt,
1255                      Node *local, GrowableArray<ScopeValue*> *array,
1256                      GrowableArray<ScopeValue*> *objs );
1257 
1258   // If "objs" contains an ObjectValue whose id is "id", returns it, else NULL.
1259   static ObjectValue* sv_for_node_id(GrowableArray<ScopeValue*> *objs, int id);
1260   // Requres that "objs" does not contains an ObjectValue whose id matches
1261   // that of "sv.  Appends "sv".
1262   static void set_sv_for_object_node(GrowableArray<ScopeValue*> *objs,
1263                                      ObjectValue* sv );
1264 
1265   // Process an OopMap Element while emitting nodes
1266   void Process_OopMap_Node(MachNode *mach, int code_offset);
1267 















1268   // Initialize code buffer
1269   CodeBuffer* init_buffer(uint* blk_starts);

1270 
1271   // Write out basic block data to code buffer
1272   void fill_buffer(CodeBuffer* cb, uint* blk_starts);
1273 
1274   // Determine which variable sized branches can be shortened
1275   void shorten_branches(uint* blk_starts, int& code_size, int& reloc_size, int& stub_size);
1276 
1277   // Compute the size of first NumberOfLoopInstrToAlign instructions
1278   // at the head of a loop.
1279   void compute_loop_first_inst_sizes();
1280 
1281   // Compute the information for the exception tables
1282   void FillExceptionTables(uint cnt, uint *call_returns, uint *inct_starts, Label *blk_labels);
1283 
1284   // Stack slots that may be unused by the calling convention but must
1285   // otherwise be preserved.  On Intel this includes the return address.
1286   // On PowerPC it includes the 4 words holding the old TOC & LR glue.
1287   uint in_preserve_stack_slots();
1288 
1289   // "Top of Stack" slots that may be unused by the calling convention but must
1290   // otherwise be preserved.
1291   // On Intel these are not necessary and the value can be zero.
1292   // On Sparc this describes the words reserved for storing a register window
1293   // when an interrupt occurs.
1294   static uint out_preserve_stack_slots();
1295 




  38 #include "oops/methodData.hpp"
  39 #include "opto/idealGraphPrinter.hpp"
  40 #include "opto/phasetype.hpp"
  41 #include "opto/phase.hpp"
  42 #include "opto/regmask.hpp"
  43 #include "runtime/deoptimization.hpp"
  44 #include "runtime/timerTrace.hpp"
  45 #include "runtime/vmThread.hpp"
  46 #include "utilities/ticks.hpp"
  47 
  48 class AddPNode;
  49 class Block;
  50 class Bundle;
  51 class C2Compiler;
  52 class CallGenerator;
  53 class CloneMap;
  54 class ConnectionGraph;
  55 class IdealGraphPrinter;
  56 class InlineTree;
  57 class Int_Array;

  58 class Matcher;
  59 class MachConstantNode;
  60 class MachConstantBaseNode;
  61 class MachNode;
  62 class MachOper;
  63 class MachSafePointNode;
  64 class Node;
  65 class Node_Array;
  66 class Node_Notes;
  67 class NodeCloneInfo;
  68 class OptoReg;
  69 class PhaseCFG;
  70 class PhaseGVN;
  71 class PhaseIterGVN;
  72 class PhaseRegAlloc;
  73 class PhaseCCP;
  74 class PhaseCCP_DCE;
  75 class RootNode;
  76 class relocInfo;
  77 class Scope;
  78 class StartNode;
  79 class SafePointNode;
  80 class JVMState;
  81 class Type;
  82 class TypeData;
  83 class TypeInt;
  84 class TypePtr;
  85 class TypeOopPtr;
  86 class TypeFunc;
  87 class Unique_Node_List;
  88 class nmethod;
  89 class WarmCallInfo;
  90 class Node_Stack;
  91 struct Final_Reshape_Counts;
  92 
  93 enum LoopOptsMode {
  94   LoopOptsDefault,
  95   LoopOptsNone,
  96   LoopOptsShenandoahExpand,
  97   LoopOptsShenandoahPostExpand,

  98   LoopOptsSkipSplitIf,
  99   LoopOptsVerify
 100 };
 101 
 102 typedef unsigned int node_idx_t;
 103 class NodeCloneInfo {
 104  private:
 105   uint64_t _idx_clone_orig;
 106  public:
 107 
 108   void set_idx(node_idx_t idx) {
 109     _idx_clone_orig = (_idx_clone_orig & CONST64(0xFFFFFFFF00000000)) | idx;
 110   }
 111   node_idx_t idx() const { return (node_idx_t)(_idx_clone_orig & 0xFFFFFFFF); }
 112 
 113   void set_gen(int generation) {
 114     uint64_t g = (uint64_t)generation << 32;
 115     _idx_clone_orig = (_idx_clone_orig & 0xFFFFFFFF) | g;
 116   }
 117   int gen() const { return (int)(_idx_clone_orig >> 32); }


1167   void              set_frame_complete(int off) { if (!in_scratch_emit_size()) { _code_offsets.set_value(CodeOffsets::Frame_Complete, off); } }
1168   ExceptionHandlerTable*  handler_table()       { return &_handler_table; }
1169   ImplicitExceptionTable* inc_table()           { return &_inc_table; }
1170   OopMapSet*        oop_map_set()               { return _oop_map_set; }
1171   DebugInformationRecorder* debug_info()        { return env()->debug_info(); }
1172   Dependencies*     dependencies()              { return env()->dependencies(); }
1173   static int        CompiledZap_count()         { return _CompiledZap_count; }
1174   BufferBlob*       scratch_buffer_blob()       { return _scratch_buffer_blob; }
1175   void         init_scratch_buffer_blob(int const_size);
1176   void        clear_scratch_buffer_blob();
1177   void          set_scratch_buffer_blob(BufferBlob* b) { _scratch_buffer_blob = b; }
1178   relocInfo*        scratch_locs_memory()       { return _scratch_locs_memory; }
1179   void          set_scratch_locs_memory(relocInfo* b)  { _scratch_locs_memory = b; }
1180 
1181   // emit to scratch blob, report resulting size
1182   uint              scratch_emit_size(const Node* n);
1183   void       set_in_scratch_emit_size(bool x)   {        _in_scratch_emit_size = x; }
1184   bool           in_scratch_emit_size() const   { return _in_scratch_emit_size;     }
1185 
1186   enum ScratchBufferBlob {

1187     MAX_inst_size       = 2048,



1188     MAX_locs_size       = 128, // number of relocInfo elements
1189     MAX_const_size      = 128,
1190     MAX_stubs_size      = 128
1191   };
1192 
1193   // Major entry point.  Given a Scope, compile the associated method.
1194   // For normal compilations, entry_bci is InvocationEntryBci.  For on stack
1195   // replacement, entry_bci indicates the bytecode for which to compile a
1196   // continuation.
1197   Compile(ciEnv* ci_env, C2Compiler* compiler, ciMethod* target,
1198           int entry_bci, bool subsume_loads, bool do_escape_analysis,
1199           bool eliminate_boxing, DirectiveSet* directive);
1200 
1201   // Second major entry point.  From the TypeFunc signature, generate code
1202   // to pass arguments from the Java calling convention to the C calling
1203   // convention.
1204   Compile(ciEnv* ci_env, const TypeFunc *(*gen)(),
1205           address stub_function, const char *stub_name,
1206           int is_fancy_jump, bool pass_tls,
1207           bool save_arg_registers, bool return_pc, DirectiveSet* directive);


1242   // Build OopMaps for each GC point
1243   void BuildOopMaps();
1244 
1245   // Append debug info for the node "local" at safepoint node "sfpt" to the
1246   // "array",   May also consult and add to "objs", which describes the
1247   // scalar-replaced objects.
1248   void FillLocArray( int idx, MachSafePointNode* sfpt,
1249                      Node *local, GrowableArray<ScopeValue*> *array,
1250                      GrowableArray<ScopeValue*> *objs );
1251 
1252   // If "objs" contains an ObjectValue whose id is "id", returns it, else NULL.
1253   static ObjectValue* sv_for_node_id(GrowableArray<ScopeValue*> *objs, int id);
1254   // Requres that "objs" does not contains an ObjectValue whose id matches
1255   // that of "sv.  Appends "sv".
1256   static void set_sv_for_object_node(GrowableArray<ScopeValue*> *objs,
1257                                      ObjectValue* sv );
1258 
1259   // Process an OopMap Element while emitting nodes
1260   void Process_OopMap_Node(MachNode *mach, int code_offset);
1261 
1262   class BufferSizingData {
1263   public:
1264     int _stub;
1265     int _code;
1266     int _const;
1267     int _reloc;
1268 
1269       BufferSizingData() :
1270       _stub(0),
1271       _code(0),
1272       _const(0),
1273       _reloc(0)
1274       { };
1275   };
1276 
1277   // Initialize code buffer
1278   void        init_buffer1(int& const_req);
1279   CodeBuffer* init_buffer2(BufferSizingData& buf_sizes);
1280 
1281   // Write out basic block data to code buffer
1282   void fill_buffer(CodeBuffer* cb, uint* blk_starts);
1283 
1284   // Determine which variable sized branches can be shortened
1285   void shorten_branches(uint* blk_starts, BufferSizingData& buf_sizes);
1286 
1287   // Compute the size of first NumberOfLoopInstrToAlign instructions
1288   // at the head of a loop.
1289   void compute_loop_first_inst_sizes();
1290 
1291   // Compute the information for the exception tables
1292   void FillExceptionTables(uint cnt, uint *call_returns, uint *inct_starts, Label *blk_labels);
1293 
1294   // Stack slots that may be unused by the calling convention but must
1295   // otherwise be preserved.  On Intel this includes the return address.
1296   // On PowerPC it includes the 4 words holding the old TOC & LR glue.
1297   uint in_preserve_stack_slots();
1298 
1299   // "Top of Stack" slots that may be unused by the calling convention but must
1300   // otherwise be preserved.
1301   // On Intel these are not necessary and the value can be zero.
1302   // On Sparc this describes the words reserved for storing a register window
1303   // when an interrupt occurs.
1304   static uint out_preserve_stack_slots();
1305 


< prev index next >