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 // ciBytecodeStream 26 // 27 // The class is used to iterate over the bytecodes of a method. 28 // It hides the details of constant pool structure/access by 29 // providing accessors for constant pool items. It returns only pure 30 // Java bytecodes; VM-internal _fast bytecodes are translated back to 31 // their original form during iteration. 32 class ciBytecodeStream : StackObj { 33 private: 34 // Handling for the weird bytecodes 35 Bytecodes::Code next_wide_or_table(Bytecodes::Code); // Handle _wide & complicated inline table 36 37 static Bytecodes::Code check_java(Bytecodes::Code c) { 38 assert(Bytecodes::is_java_code(c), "should not return _fast bytecodes"); 39 return c; 40 } 41 42 static Bytecodes::Code check_defined(Bytecodes::Code c) { 43 assert(Bytecodes::is_defined(c), ""); 44 return c; 380 } else if (!_is_exact && 381 handler->catch_klass()->is_subtype_of(_exception_klass)) { 382 // This catch block may be reachable. 383 return; 384 } 385 } 386 387 // The catch block was not pertinent. Go on. 388 _pos++; 389 } 390 } else { 391 // This is an iteration over all handlers. 392 return; 393 } 394 } 395 396 ciExceptionHandler* handler() { 397 return _method->_exception_handlers[_pos]; 398 } 399 }; | 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_CI_CISTREAMS_HPP 26 #define SHARE_VM_CI_CISTREAMS_HPP 27 28 #include "ci/ciClassList.hpp" 29 #include "ci/ciExceptionHandler.hpp" 30 #include "ci/ciInstanceKlass.hpp" 31 #include "ci/ciMethod.hpp" 32 #include "interpreter/bytecode.hpp" 33 34 // ciBytecodeStream 35 // 36 // The class is used to iterate over the bytecodes of a method. 37 // It hides the details of constant pool structure/access by 38 // providing accessors for constant pool items. It returns only pure 39 // Java bytecodes; VM-internal _fast bytecodes are translated back to 40 // their original form during iteration. 41 class ciBytecodeStream : StackObj { 42 private: 43 // Handling for the weird bytecodes 44 Bytecodes::Code next_wide_or_table(Bytecodes::Code); // Handle _wide & complicated inline table 45 46 static Bytecodes::Code check_java(Bytecodes::Code c) { 47 assert(Bytecodes::is_java_code(c), "should not return _fast bytecodes"); 48 return c; 49 } 50 51 static Bytecodes::Code check_defined(Bytecodes::Code c) { 52 assert(Bytecodes::is_defined(c), ""); 53 return c; 389 } else if (!_is_exact && 390 handler->catch_klass()->is_subtype_of(_exception_klass)) { 391 // This catch block may be reachable. 392 return; 393 } 394 } 395 396 // The catch block was not pertinent. Go on. 397 _pos++; 398 } 399 } else { 400 // This is an iteration over all handlers. 401 return; 402 } 403 } 404 405 ciExceptionHandler* handler() { 406 return _method->_exception_handlers[_pos]; 407 } 408 }; 409 410 #endif // SHARE_VM_CI_CISTREAMS_HPP |