132 133 134 class IRScope; 135 define_array(IRScopeArray, IRScope*) 136 define_stack(IRScopeList, IRScopeArray) 137 138 class Compilation; 139 class IRScope: public CompilationResourceObj { 140 private: 141 // hierarchy 142 Compilation* _compilation; // the current compilation 143 IRScope* _caller; // the caller scope, or NULL 144 int _level; // the inlining level 145 ciMethod* _method; // the corresponding method 146 IRScopeList _callees; // the inlined method scopes 147 148 // graph 149 XHandlers* _xhandlers; // the exception handlers 150 int _number_of_locks; // the number of monitor lock slots needed 151 bool _monitor_pairing_ok; // the monitor pairing info 152 BlockBegin* _start; // the start block, successsors are method entries 153 154 BitMap _requires_phi_function; // bit is set if phi functions at loop headers are necessary for a local variable 155 156 // helper functions 157 BlockBegin* build_graph(Compilation* compilation, int osr_bci); 158 159 public: 160 // creation 161 IRScope(Compilation* compilation, IRScope* caller, int caller_bci, ciMethod* method, int osr_bci, bool create_graph = false); 162 163 // accessors 164 Compilation* compilation() const { return _compilation; } 165 IRScope* caller() const { return _caller; } 166 int level() const { return _level; } 167 ciMethod* method() const { return _method; } 168 int max_stack() const; // NOTE: expensive 169 BitMap& requires_phi_function() { return _requires_phi_function; } 170 171 // hierarchy 172 bool is_top_scope() const { return _caller == NULL; } 173 void add_callee(IRScope* callee) { _callees.append(callee); } 174 int number_of_callees() const { return _callees.length(); } 175 IRScope* callee_no(int i) const { return _callees.at(i); } 176 177 // accessors, graph 178 bool is_valid() const { return start() != NULL; } 179 XHandlers* xhandlers() const { return _xhandlers; } 180 int number_of_locks() const { return _number_of_locks; } 181 void set_min_number_of_locks(int n) { if (n > _number_of_locks) _number_of_locks = n; } 182 bool monitor_pairing_ok() const { return _monitor_pairing_ok; } 183 BlockBegin* start() const { return _start; } 184 }; 185 186 187 // 188 // IRScopeDebugInfo records the debug information for a particular IRScope 189 // in a particular CodeEmitInfo. This allows the information to be computed 190 // once early enough for the OopMap to be available to the LIR and also to be 191 // reemited for different pcs using the same CodeEmitInfo without recomputing 192 // everything. 193 // 194 195 class IRScopeDebugInfo: public CompilationResourceObj { 196 private: 197 IRScope* _scope; 198 int _bci; 199 GrowableArray<ScopeValue*>* _locals; 200 GrowableArray<ScopeValue*>* _expressions; 201 GrowableArray<MonitorValue*>* _monitors; 202 IRScopeDebugInfo* _caller; 203 | 132 133 134 class IRScope; 135 define_array(IRScopeArray, IRScope*) 136 define_stack(IRScopeList, IRScopeArray) 137 138 class Compilation; 139 class IRScope: public CompilationResourceObj { 140 private: 141 // hierarchy 142 Compilation* _compilation; // the current compilation 143 IRScope* _caller; // the caller scope, or NULL 144 int _level; // the inlining level 145 ciMethod* _method; // the corresponding method 146 IRScopeList _callees; // the inlined method scopes 147 148 // graph 149 XHandlers* _xhandlers; // the exception handlers 150 int _number_of_locks; // the number of monitor lock slots needed 151 bool _monitor_pairing_ok; // the monitor pairing info 152 bool _wrote_final; // has written final field 153 BlockBegin* _start; // the start block, successsors are method entries 154 155 BitMap _requires_phi_function; // bit is set if phi functions at loop headers are necessary for a local variable 156 157 // helper functions 158 BlockBegin* build_graph(Compilation* compilation, int osr_bci); 159 160 public: 161 // creation 162 IRScope(Compilation* compilation, IRScope* caller, int caller_bci, ciMethod* method, int osr_bci, bool create_graph = false); 163 164 // accessors 165 Compilation* compilation() const { return _compilation; } 166 IRScope* caller() const { return _caller; } 167 int level() const { return _level; } 168 ciMethod* method() const { return _method; } 169 int max_stack() const; // NOTE: expensive 170 BitMap& requires_phi_function() { return _requires_phi_function; } 171 172 // hierarchy 173 bool is_top_scope() const { return _caller == NULL; } 174 void add_callee(IRScope* callee) { _callees.append(callee); } 175 int number_of_callees() const { return _callees.length(); } 176 IRScope* callee_no(int i) const { return _callees.at(i); } 177 178 // accessors, graph 179 bool is_valid() const { return start() != NULL; } 180 XHandlers* xhandlers() const { return _xhandlers; } 181 int number_of_locks() const { return _number_of_locks; } 182 void set_min_number_of_locks(int n) { if (n > _number_of_locks) _number_of_locks = n; } 183 bool monitor_pairing_ok() const { return _monitor_pairing_ok; } 184 BlockBegin* start() const { return _start; } 185 void set_wrote_final() { _wrote_final = true; } 186 bool wrote_final () const { return _wrote_final; } 187 }; 188 189 190 // 191 // IRScopeDebugInfo records the debug information for a particular IRScope 192 // in a particular CodeEmitInfo. This allows the information to be computed 193 // once early enough for the OopMap to be available to the LIR and also to be 194 // reemited for different pcs using the same CodeEmitInfo without recomputing 195 // everything. 196 // 197 198 class IRScopeDebugInfo: public CompilationResourceObj { 199 private: 200 IRScope* _scope; 201 int _bci; 202 GrowableArray<ScopeValue*>* _locals; 203 GrowableArray<ScopeValue*>* _expressions; 204 GrowableArray<MonitorValue*>* _monitors; 205 IRScopeDebugInfo* _caller; 206 |