5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 class MemoryBuffer; 26 27 class GraphBuilder VALUE_OBJ_CLASS_SPEC { 28 private: 29 // Per-scope data. These are pushed and popped as we descend into 30 // inlined methods. Currently in order to generate good code in the 31 // inliner we have to attempt to inline methods directly into the 32 // basic block we are parsing; this adds complexity. 33 class ScopeData: public CompilationResourceObj { 34 private: 35 ScopeData* _parent; 36 // bci-to-block mapping 37 BlockList* _bci2block; 38 // Scope 39 IRScope* _scope; 40 // Whether this scope or any parent scope has exception handlers 41 bool _has_handler; 42 // The bytecodes 43 ciBytecodeStream* _stream; 44 361 public: 362 NOT_PRODUCT(void print_stats();) 363 364 // initialization 365 static void initialize(); 366 367 // public 368 static bool can_trap(ciMethod* method, Bytecodes::Code code) { 369 assert(0 <= code && code < Bytecodes::number_of_java_codes, "illegal bytecode"); 370 if (_can_trap[code]) return true; 371 // special handling for finalizer registration 372 return code == Bytecodes::_return && method->intrinsic_id() == vmIntrinsics::_Object_init; 373 } 374 375 // creation 376 GraphBuilder(Compilation* compilation, IRScope* scope); 377 static void sort_top_into_worklist(BlockList* worklist, BlockBegin* top); 378 379 BlockBegin* start() const { return _start; } 380 }; | 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_C1_C1_GRAPHBUILDER_HPP 26 #define SHARE_VM_C1_C1_GRAPHBUILDER_HPP 27 28 #include "c1/c1_IR.hpp" 29 #include "c1/c1_Instruction.hpp" 30 #include "c1/c1_ValueMap.hpp" 31 #include "c1/c1_ValueStack.hpp" 32 #include "ci/ciMethodData.hpp" 33 #include "ci/ciStreams.hpp" 34 35 class MemoryBuffer; 36 37 class GraphBuilder VALUE_OBJ_CLASS_SPEC { 38 private: 39 // Per-scope data. These are pushed and popped as we descend into 40 // inlined methods. Currently in order to generate good code in the 41 // inliner we have to attempt to inline methods directly into the 42 // basic block we are parsing; this adds complexity. 43 class ScopeData: public CompilationResourceObj { 44 private: 45 ScopeData* _parent; 46 // bci-to-block mapping 47 BlockList* _bci2block; 48 // Scope 49 IRScope* _scope; 50 // Whether this scope or any parent scope has exception handlers 51 bool _has_handler; 52 // The bytecodes 53 ciBytecodeStream* _stream; 54 371 public: 372 NOT_PRODUCT(void print_stats();) 373 374 // initialization 375 static void initialize(); 376 377 // public 378 static bool can_trap(ciMethod* method, Bytecodes::Code code) { 379 assert(0 <= code && code < Bytecodes::number_of_java_codes, "illegal bytecode"); 380 if (_can_trap[code]) return true; 381 // special handling for finalizer registration 382 return code == Bytecodes::_return && method->intrinsic_id() == vmIntrinsics::_Object_init; 383 } 384 385 // creation 386 GraphBuilder(Compilation* compilation, IRScope* scope); 387 static void sort_top_into_worklist(BlockList* worklist, BlockBegin* top); 388 389 BlockBegin* start() const { return _start; } 390 }; 391 392 #endif // SHARE_VM_C1_C1_GRAPHBUILDER_HPP |