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 # include "incls/_precompiled.incl" 26 # include "incls/_stackMapTable.cpp.incl" 27 28 StackMapTable::StackMapTable(StackMapReader* reader, StackMapFrame* init_frame, 29 u2 max_locals, u2 max_stack, 30 char* code_data, int code_len, TRAPS) { 31 _code_length = code_len; 32 _frame_count = reader->get_frame_count(); 33 if (_frame_count > 0) { 34 _frame_array = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, 35 StackMapFrame*, _frame_count); 36 StackMapFrame* pre_frame = init_frame; 37 for (int32_t i = 0; i < _frame_count; i++) { 38 StackMapFrame* frame = reader->next( 39 pre_frame, i == 0, max_locals, max_stack, 40 CHECK_VERIFY(pre_frame->verifier())); 41 _frame_array[i] = frame; 42 int offset = frame->offset(); 43 if (offset >= code_len || code_data[offset] == 0) { 44 frame->verifier()->verify_error("StackMapTable error: bad offset"); 45 return; 46 } | 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 #include "precompiled.hpp" 26 #include "classfile/stackMapTable.hpp" 27 #include "classfile/verifier.hpp" 28 #include "memory/resourceArea.hpp" 29 #include "oops/oop.inline.hpp" 30 #include "runtime/fieldType.hpp" 31 #include "runtime/handles.inline.hpp" 32 33 StackMapTable::StackMapTable(StackMapReader* reader, StackMapFrame* init_frame, 34 u2 max_locals, u2 max_stack, 35 char* code_data, int code_len, TRAPS) { 36 _code_length = code_len; 37 _frame_count = reader->get_frame_count(); 38 if (_frame_count > 0) { 39 _frame_array = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, 40 StackMapFrame*, _frame_count); 41 StackMapFrame* pre_frame = init_frame; 42 for (int32_t i = 0; i < _frame_count; i++) { 43 StackMapFrame* frame = reader->next( 44 pre_frame, i == 0, max_locals, max_stack, 45 CHECK_VERIFY(pre_frame->verifier())); 46 _frame_array[i] = frame; 47 int offset = frame->offset(); 48 if (offset >= code_len || code_data[offset] == 0) { 49 frame->verifier()->verify_error("StackMapTable error: bad offset"); 50 return; 51 } |