Mercurial > hg > graal-compiler
diff src/share/vm/oops/constMethod.cpp @ 7183:b2dbd323c668
8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
Summary: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
Reviewed-by: bdelsart, sspitsyn, coleenp
author | jiangli |
---|---|
date | Tue, 27 Nov 2012 17:03:56 -0500 |
parents | 18fb7da42534 |
children | ade95d680b42 |
line wrap: on
line diff
--- a/src/share/vm/oops/constMethod.cpp Fri Nov 16 09:43:43 2012 -0800 +++ b/src/share/vm/oops/constMethod.cpp Tue Nov 27 17:03:56 2012 -0500 @@ -39,16 +39,19 @@ int localvariable_table_length, int exception_table_length, int checked_exceptions_length, + u2 generic_signature_index, MethodType method_type, TRAPS) { int size = ConstMethod::size(byte_code_size, compressed_line_number_size, localvariable_table_length, exception_table_length, - checked_exceptions_length); + checked_exceptions_length, + generic_signature_index); return new (loader_data, size, true, THREAD) ConstMethod( byte_code_size, compressed_line_number_size, localvariable_table_length, - exception_table_length, checked_exceptions_length, method_type, size); + exception_table_length, checked_exceptions_length, generic_signature_index, + method_type, size); } ConstMethod::ConstMethod(int byte_code_size, @@ -56,6 +59,7 @@ int localvariable_table_length, int exception_table_length, int checked_exceptions_length, + u2 generic_signature_index, MethodType method_type, int size) { @@ -66,7 +70,8 @@ set_stackmap_data(NULL); set_code_size(byte_code_size); set_constMethod_size(size); - set_inlined_tables_length(checked_exceptions_length, + set_inlined_tables_length(generic_signature_index, + checked_exceptions_length, compressed_line_number_size, localvariable_table_length, exception_table_length); @@ -90,7 +95,8 @@ int compressed_line_number_size, int local_variable_table_length, int exception_table_length, - int checked_exceptions_length) { + int checked_exceptions_length, + u2 generic_signature_index) { int extra_bytes = code_size; if (compressed_line_number_size > 0) { extra_bytes += compressed_line_number_size; @@ -108,6 +114,9 @@ extra_bytes += sizeof(u2); extra_bytes += exception_table_length * sizeof(ExceptionTableElement); } + if (generic_signature_index != 0) { + extra_bytes += sizeof(u2); + } int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord; return align_object_size(header_size() + extra_words); } @@ -125,10 +134,17 @@ return code_end(); } -u2* ConstMethod::checked_exceptions_length_addr() const { +u2* ConstMethod::generic_signature_index_addr() const { // Located at the end of the constMethod. + assert(has_generic_signature(), "called only if generic signature exists"); + return last_u2_element(); +} + +u2* ConstMethod::checked_exceptions_length_addr() const { + // Located immediately before the generic signature index. assert(has_checked_exceptions(), "called only if table is present"); - return last_u2_element(); + return has_generic_signature() ? (last_u2_element() - 1) : + last_u2_element(); } u2* ConstMethod::exception_table_length_addr() const { @@ -137,8 +153,10 @@ // If checked_exception present, locate immediately before them. return (u2*) checked_exceptions_start() - 1; } else { - // Else, the exception table is at the end of the constMethod. - return last_u2_element(); + // Else, the exception table is at the end of the constMethod or + // immediately before the generic signature index. + return has_generic_signature() ? (last_u2_element() - 1) : + last_u2_element(); } } @@ -152,25 +170,30 @@ // If checked_exception present, locate immediately before them. return (u2*) checked_exceptions_start() - 1; } else { - // Else, the linenumber table is at the end of the constMethod. - return last_u2_element(); + // Else, the linenumber table is at the end of the constMethod or + // immediately before the generic signature index. + return has_generic_signature() ? (last_u2_element() - 1) : + last_u2_element(); } } } - // Update the flags to indicate the presence of these optional fields. -void ConstMethod::set_inlined_tables_length( - int checked_exceptions_len, - int compressed_line_number_size, - int localvariable_table_len, - int exception_table_len) { +void ConstMethod::set_inlined_tables_length(u2 generic_signature_index, + int checked_exceptions_len, + int compressed_line_number_size, + int localvariable_table_len, + int exception_table_len) { // Must be done in the order below, otherwise length_addr accessors // will not work. Only set bit in header if length is positive. assert(_flags == 0, "Error"); if (compressed_line_number_size > 0) { _flags |= _has_linenumber_table; } + if (generic_signature_index != 0) { + _flags |= _has_generic_signature; + *(generic_signature_index_addr()) = generic_signature_index; + } if (checked_exceptions_len > 0) { _flags |= _has_checked_exceptions; *(checked_exceptions_length_addr()) = checked_exceptions_len;