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 | 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 bool _wrote_fields; // has written fields 154 BlockBegin* _start; // the start block, successsors are method entries 155 156 BitMap _requires_phi_function; // bit is set if phi functions at loop headers are necessary for a local variable 157 158 // helper functions 159 BlockBegin* build_graph(Compilation* compilation, int osr_bci); 160 161 public: 162 // creation 163 IRScope(Compilation* compilation, IRScope* caller, int caller_bci, ciMethod* method, int osr_bci, bool create_graph = false); 164 165 // accessors 166 Compilation* compilation() const { return _compilation; } 167 IRScope* caller() const { return _caller; } 168 int level() const { return _level; } 169 ciMethod* method() const { return _method; } 170 int max_stack() const; // NOTE: expensive 171 BitMap& requires_phi_function() { return _requires_phi_function; } 172 173 // hierarchy 174 bool is_top_scope() const { return _caller == NULL; } 175 void add_callee(IRScope* callee) { _callees.append(callee); } 176 int number_of_callees() const { return _callees.length(); } 177 IRScope* callee_no(int i) const { return _callees.at(i); } 178 179 // accessors, graph 180 bool is_valid() const { return start() != NULL; } 181 XHandlers* xhandlers() const { return _xhandlers; } 182 int number_of_locks() const { return _number_of_locks; } 183 void set_min_number_of_locks(int n) { if (n > _number_of_locks) _number_of_locks = n; } 184 bool monitor_pairing_ok() const { return _monitor_pairing_ok; } 185 BlockBegin* start() const { return _start; } 186 void set_wrote_final() { _wrote_final = true; } 187 bool wrote_final () const { return _wrote_final; } 188 void set_wrote_fields() { _wrote_fields = true; } 189 bool wrote_fields () const { return _wrote_fields; } 190 191 }; 192 193 194 // 195 // IRScopeDebugInfo records the debug information for a particular IRScope 196 // in a particular CodeEmitInfo. This allows the information to be computed 197 // once early enough for the OopMap to be available to the LIR and also to be 198 // reemited for different pcs using the same CodeEmitInfo without recomputing 199 // everything. 200 // 201 202 class IRScopeDebugInfo: public CompilationResourceObj { 203 private: 204 IRScope* _scope; 205 int _bci; 206 GrowableArray<ScopeValue*>* _locals; 207 GrowableArray<ScopeValue*>* _expressions; 208 GrowableArray<MonitorValue*>* _monitors; 209 IRScopeDebugInfo* _caller; 210 |