< prev index next >

src/share/vm/classfile/classFileParser.cpp

Print this page
rev 13049 : imported patch 8181377_unsafe_u2

*** 1697,1713 **** } } } ! const void* ClassFileParser::parse_exception_table(const ClassFileStream* const cfs, u4 code_length, u4 exception_table_length, TRAPS) { assert(cfs != NULL, "invariant"); ! const void* const exception_table_start = cfs->current(); assert(exception_table_start != NULL, "null exception table"); cfs->guarantee_more(8 * exception_table_length, CHECK_NULL); // start_pc, // end_pc, // handler_pc, --- 1697,1713 ---- } } } ! const ClassFileParser::unsafe_u2* ClassFileParser::parse_exception_table(const ClassFileStream* const cfs, u4 code_length, u4 exception_table_length, TRAPS) { assert(cfs != NULL, "invariant"); ! const unsafe_u2* const exception_table_start = cfs->current(); assert(exception_table_start != NULL, "null exception table"); cfs->guarantee_more(8 * exception_table_length, CHECK_NULL); // start_pc, // end_pc, // handler_pc,
*** 1821,1831 **** lvt->slot = Bytes::get_Java_u2((u1*) &src->slot); } // Function is used to parse both attributes: // LocalVariableTable (LVT) and LocalVariableTypeTable (LVTT) ! const void* ClassFileParser::parse_localvariable_table(const ClassFileStream* cfs, u4 code_length, u2 max_locals, u4 code_attribute_length, u2* const localvariable_table_length, bool isLVTT, --- 1821,1831 ---- lvt->slot = Bytes::get_Java_u2((u1*) &src->slot); } // Function is used to parse both attributes: // LocalVariableTable (LVT) and LocalVariableTypeTable (LVTT) ! const ClassFileParser::unsafe_u2* ClassFileParser::parse_localvariable_table(const ClassFileStream* cfs, u4 code_length, u2 max_locals, u4 code_attribute_length, u2* const localvariable_table_length, bool isLVTT,
*** 1841,1851 **** if (_need_verify) { guarantee_property(code_attribute_length == (sizeof(*localvariable_table_length) + size * sizeof(u2)), "%s has wrong length in class file %s", tbl_name, CHECK_NULL); } ! const void* const localvariable_table_start = cfs->current(); assert(localvariable_table_start != NULL, "null local variable table"); if (!_need_verify) { cfs->skip_u2_fast(size); } else { cfs->guarantee_more(size * 2, CHECK_NULL); --- 1841,1851 ---- if (_need_verify) { guarantee_property(code_attribute_length == (sizeof(*localvariable_table_length) + size * sizeof(u2)), "%s has wrong length in class file %s", tbl_name, CHECK_NULL); } ! const unsafe_u2* const localvariable_table_start = cfs->current(); assert(localvariable_table_start != NULL, "null local variable table"); if (!_need_verify) { cfs->skip_u2_fast(size); } else { cfs->guarantee_more(size * 2, CHECK_NULL);
*** 1957,1978 **** return NULL; } return stackmap_table_start; } ! const void* ClassFileParser::parse_checked_exceptions(const ClassFileStream* const cfs, u2* const checked_exceptions_length, u4 method_attribute_length, TRAPS) { assert(cfs != NULL, "invariant"); assert(checked_exceptions_length != NULL, "invariant"); cfs->guarantee_more(2, CHECK_NULL); // checked_exceptions_length *checked_exceptions_length = cfs->get_u2_fast(); const unsigned int size = (*checked_exceptions_length) * sizeof(CheckedExceptionElement) / sizeof(u2); ! const void* const checked_exceptions_start = cfs->current(); assert(checked_exceptions_start != NULL, "null checked exceptions"); if (!_need_verify) { cfs->skip_u2_fast(size); } else { // Verify each value in the checked exception table --- 1957,1978 ---- return NULL; } return stackmap_table_start; } ! const ClassFileParser::unsafe_u2* ClassFileParser::parse_checked_exceptions(const ClassFileStream* const cfs, u2* const checked_exceptions_length, u4 method_attribute_length, TRAPS) { assert(cfs != NULL, "invariant"); assert(checked_exceptions_length != NULL, "invariant"); cfs->guarantee_more(2, CHECK_NULL); // checked_exceptions_length *checked_exceptions_length = cfs->get_u2_fast(); const unsigned int size = (*checked_exceptions_length) * sizeof(CheckedExceptionElement) / sizeof(u2); ! const unsafe_u2* const checked_exceptions_start = cfs->current(); assert(checked_exceptions_start != NULL, "null checked exceptions"); if (!_need_verify) { cfs->skip_u2_fast(size); } else { // Verify each value in the checked exception table
*** 2135,2148 **** * - HotSpot internal LVT keeps natural ordering of class file LVT entries. */ void ClassFileParser::copy_localvariable_table(const ConstMethod* cm, int lvt_cnt, u2* const localvariable_table_length, ! const void** const localvariable_table_start, int lvtt_cnt, u2* const localvariable_type_table_length, ! const void** const localvariable_type_table_start, TRAPS) { ResourceMark rm(THREAD); typedef ResourceHashtable<LocalVariableTableElement, LocalVariableTableElement*, --- 2135,2148 ---- * - HotSpot internal LVT keeps natural ordering of class file LVT entries. */ void ClassFileParser::copy_localvariable_table(const ConstMethod* cm, int lvt_cnt, u2* const localvariable_table_length, ! const unsafe_u2** const localvariable_table_start, int lvtt_cnt, u2* const localvariable_type_table_length, ! const unsafe_u2** const localvariable_type_table_start, TRAPS) { ResourceMark rm(THREAD); typedef ResourceHashtable<LocalVariableTableElement, LocalVariableTableElement*,
*** 2333,2358 **** u2 max_stack = 0; u2 max_locals = 0; u4 code_length = 0; const u1* code_start = 0; u2 exception_table_length = 0; ! const void* exception_table_start = NULL; // (potentially unaligned) pointer to array of u2 elements Array<int>* exception_handlers = Universe::the_empty_int_array(); u2 checked_exceptions_length = 0; ! const void* checked_exceptions_start = NULL; // (potentially unaligned) pointer to array of u2 elements CompressedLineNumberWriteStream* linenumber_table = NULL; int linenumber_table_length = 0; int total_lvt_length = 0; u2 lvt_cnt = 0; u2 lvtt_cnt = 0; bool lvt_allocated = false; u2 max_lvt_cnt = INITIAL_MAX_LVT_NUMBER; u2 max_lvtt_cnt = INITIAL_MAX_LVT_NUMBER; u2* localvariable_table_length = NULL; ! const void** localvariable_table_start = NULL; // (potentially unaligned) pointer to array of LVT attributes u2* localvariable_type_table_length = NULL; ! const void** localvariable_type_table_start = NULL; // (potentially unaligned) pointer to LVTT attributes int method_parameters_length = -1; const u1* method_parameters_data = NULL; bool method_parameters_seen = false; bool parsed_code_attribute = false; bool parsed_checked_exceptions_attribute = false; --- 2333,2358 ---- u2 max_stack = 0; u2 max_locals = 0; u4 code_length = 0; const u1* code_start = 0; u2 exception_table_length = 0; ! const unsafe_u2* exception_table_start = NULL; // (potentially unaligned) pointer to array of u2 elements Array<int>* exception_handlers = Universe::the_empty_int_array(); u2 checked_exceptions_length = 0; ! const unsafe_u2* checked_exceptions_start = NULL; // (potentially unaligned) pointer to array of u2 elements CompressedLineNumberWriteStream* linenumber_table = NULL; int linenumber_table_length = 0; int total_lvt_length = 0; u2 lvt_cnt = 0; u2 lvtt_cnt = 0; bool lvt_allocated = false; u2 max_lvt_cnt = INITIAL_MAX_LVT_NUMBER; u2 max_lvtt_cnt = INITIAL_MAX_LVT_NUMBER; u2* localvariable_table_length = NULL; ! const unsafe_u2** localvariable_table_start = NULL; // (potentially unaligned) pointer to array of LVT attributes u2* localvariable_type_table_length = NULL; ! const unsafe_u2** localvariable_type_table_start = NULL; // (potentially unaligned) pointer to LVTT attributes int method_parameters_length = -1; const u1* method_parameters_data = NULL; bool method_parameters_seen = false; bool parsed_code_attribute = false; bool parsed_checked_exceptions_attribute = false;
*** 2489,2509 **** // Parse local variable table if (!lvt_allocated) { localvariable_table_length = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2, INITIAL_MAX_LVT_NUMBER); localvariable_table_start = NEW_RESOURCE_ARRAY_IN_THREAD( ! THREAD, const void*, INITIAL_MAX_LVT_NUMBER); localvariable_type_table_length = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2, INITIAL_MAX_LVT_NUMBER); localvariable_type_table_start = NEW_RESOURCE_ARRAY_IN_THREAD( ! THREAD, const void*, INITIAL_MAX_LVT_NUMBER); lvt_allocated = true; } if (lvt_cnt == max_lvt_cnt) { max_lvt_cnt <<= 1; localvariable_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_table_length, lvt_cnt, max_lvt_cnt); ! localvariable_table_start = REALLOC_RESOURCE_ARRAY(const void*, localvariable_table_start, lvt_cnt, max_lvt_cnt); } localvariable_table_start[lvt_cnt] = parse_localvariable_table(cfs, code_length, max_locals, --- 2489,2509 ---- // Parse local variable table if (!lvt_allocated) { localvariable_table_length = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2, INITIAL_MAX_LVT_NUMBER); localvariable_table_start = NEW_RESOURCE_ARRAY_IN_THREAD( ! THREAD, const unsafe_u2*, INITIAL_MAX_LVT_NUMBER); localvariable_type_table_length = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2, INITIAL_MAX_LVT_NUMBER); localvariable_type_table_start = NEW_RESOURCE_ARRAY_IN_THREAD( ! THREAD, const unsafe_u2*, INITIAL_MAX_LVT_NUMBER); lvt_allocated = true; } if (lvt_cnt == max_lvt_cnt) { max_lvt_cnt <<= 1; localvariable_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_table_length, lvt_cnt, max_lvt_cnt); ! localvariable_table_start = REALLOC_RESOURCE_ARRAY(const unsafe_u2*, localvariable_table_start, lvt_cnt, max_lvt_cnt); } localvariable_table_start[lvt_cnt] = parse_localvariable_table(cfs, code_length, max_locals,
*** 2518,2539 **** cp->symbol_at(code_attribute_name_index) == vmSymbols::tag_local_variable_type_table()) { if (!lvt_allocated) { localvariable_table_length = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2, INITIAL_MAX_LVT_NUMBER); localvariable_table_start = NEW_RESOURCE_ARRAY_IN_THREAD( ! THREAD, const void*, INITIAL_MAX_LVT_NUMBER); localvariable_type_table_length = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2, INITIAL_MAX_LVT_NUMBER); localvariable_type_table_start = NEW_RESOURCE_ARRAY_IN_THREAD( ! THREAD, const void*, INITIAL_MAX_LVT_NUMBER); lvt_allocated = true; } // Parse local variable type table if (lvtt_cnt == max_lvtt_cnt) { max_lvtt_cnt <<= 1; localvariable_type_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_type_table_length, lvtt_cnt, max_lvtt_cnt); ! localvariable_type_table_start = REALLOC_RESOURCE_ARRAY(const void*, localvariable_type_table_start, lvtt_cnt, max_lvtt_cnt); } localvariable_type_table_start[lvtt_cnt] = parse_localvariable_table(cfs, code_length, max_locals, --- 2518,2539 ---- cp->symbol_at(code_attribute_name_index) == vmSymbols::tag_local_variable_type_table()) { if (!lvt_allocated) { localvariable_table_length = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2, INITIAL_MAX_LVT_NUMBER); localvariable_table_start = NEW_RESOURCE_ARRAY_IN_THREAD( ! THREAD, const unsafe_u2*, INITIAL_MAX_LVT_NUMBER); localvariable_type_table_length = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2, INITIAL_MAX_LVT_NUMBER); localvariable_type_table_start = NEW_RESOURCE_ARRAY_IN_THREAD( ! THREAD, const unsafe_u2*, INITIAL_MAX_LVT_NUMBER); lvt_allocated = true; } // Parse local variable type table if (lvtt_cnt == max_lvtt_cnt) { max_lvtt_cnt <<= 1; localvariable_type_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_type_table_length, lvtt_cnt, max_lvtt_cnt); ! localvariable_type_table_start = REALLOC_RESOURCE_ARRAY(const unsafe_u2*, localvariable_type_table_start, lvtt_cnt, max_lvtt_cnt); } localvariable_type_table_start[lvtt_cnt] = parse_localvariable_table(cfs, code_length, max_locals,
< prev index next >