aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/oops/constMethod.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/vm/oops/constMethod.cpp')
-rw-r--r--src/share/vm/oops/constMethod.cpp55
1 files changed, 39 insertions, 16 deletions
diff --git a/src/share/vm/oops/constMethod.cpp b/src/share/vm/oops/constMethod.cpp
index 7f89d61ee..10b057b4f 100644
--- a/src/share/vm/oops/constMethod.cpp
+++ b/src/share/vm/oops/constMethod.cpp
@@ -39,16 +39,19 @@ ConstMethod* ConstMethod::allocate(ClassLoaderData* loader_data,
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 @@ ConstMethod::ConstMethod(int byte_code_size,
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 @@ ConstMethod::ConstMethod(int byte_code_size,
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 ConstMethod::size(int code_size,
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 @@ int ConstMethod::size(int code_size,
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,20 +134,29 @@ u_char* ConstMethod::compressed_linenumber_table() const {
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_checked_exceptions(), "called only if table is present");
+ 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 has_generic_signature() ? (last_u2_element() - 1) :
+ last_u2_element();
+}
+
u2* ConstMethod::exception_table_length_addr() const {
assert(has_exception_handler(), "called only if table is present");
if (has_checked_exceptions()) {
// 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 @@ u2* ConstMethod::localvariable_table_length_addr() const {
// 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;