127
128 // Align sizes up to a word.
129 extra_bytes = align_size_up(extra_bytes, BytesPerWord);
130
131 // One pointer per annotation array
132 if (sizes->method_annotations_length() > 0) {
133 extra_bytes += sizeof(AnnotationArray*);
134 }
135 if (sizes->parameter_annotations_length() > 0) {
136 extra_bytes += sizeof(AnnotationArray*);
137 }
138 if (sizes->type_annotations_length() > 0) {
139 extra_bytes += sizeof(AnnotationArray*);
140 }
141 if (sizes->default_annotations_length() > 0) {
142 extra_bytes += sizeof(AnnotationArray*);
143 }
144
145 int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
146 assert(extra_words == extra_bytes/BytesPerWord, "should already be aligned");
147 return align_object_size(header_size() + extra_words);
148 }
149
150 Method* ConstMethod::method() const {
151 return _constants->pool_holder()->method_with_idnum(_method_idnum);
152 }
153
154 // linenumber table - note that length is unknown until decompression,
155 // see class CompressedLineNumberReadStream.
156
157 u_char* ConstMethod::compressed_linenumber_table() const {
158 // Located immediately following the bytecodes.
159 assert(has_linenumber_table(), "called only if table is present");
160 return code_end();
161 }
162
163 // Last short in ConstMethod* before annotations
164 u2* ConstMethod::last_u2_element() const {
165 int offset = 0;
166 if (has_method_annotations()) offset++;
167 if (has_parameter_annotations()) offset++;
475 guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
476 }
477 if (has_localvariable_table()) {
478 u2* addr = localvariable_table_length_addr();
479 guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
480 }
481 // Check compressed_table_end relative to uncompressed_table_start
482 u2* uncompressed_table_start;
483 if (has_localvariable_table()) {
484 uncompressed_table_start = (u2*) localvariable_table_start();
485 } else if (has_exception_handler()) {
486 uncompressed_table_start = (u2*) exception_table_start();
487 } else if (has_checked_exceptions()) {
488 uncompressed_table_start = (u2*) checked_exceptions_start();
489 } else if (has_method_parameters()) {
490 uncompressed_table_start = (u2*) method_parameters_start();
491 } else {
492 uncompressed_table_start = (u2*) m_end;
493 }
494 int gap = (intptr_t) uncompressed_table_start - (intptr_t) compressed_table_end;
495 int max_gap = align_object_size(1)*BytesPerWord;
496 guarantee(gap >= 0 && gap < max_gap, "invalid method layout");
497 }
|
127
128 // Align sizes up to a word.
129 extra_bytes = align_size_up(extra_bytes, BytesPerWord);
130
131 // One pointer per annotation array
132 if (sizes->method_annotations_length() > 0) {
133 extra_bytes += sizeof(AnnotationArray*);
134 }
135 if (sizes->parameter_annotations_length() > 0) {
136 extra_bytes += sizeof(AnnotationArray*);
137 }
138 if (sizes->type_annotations_length() > 0) {
139 extra_bytes += sizeof(AnnotationArray*);
140 }
141 if (sizes->default_annotations_length() > 0) {
142 extra_bytes += sizeof(AnnotationArray*);
143 }
144
145 int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
146 assert(extra_words == extra_bytes/BytesPerWord, "should already be aligned");
147 return align_metadata_size(header_size() + extra_words);
148 }
149
150 Method* ConstMethod::method() const {
151 return _constants->pool_holder()->method_with_idnum(_method_idnum);
152 }
153
154 // linenumber table - note that length is unknown until decompression,
155 // see class CompressedLineNumberReadStream.
156
157 u_char* ConstMethod::compressed_linenumber_table() const {
158 // Located immediately following the bytecodes.
159 assert(has_linenumber_table(), "called only if table is present");
160 return code_end();
161 }
162
163 // Last short in ConstMethod* before annotations
164 u2* ConstMethod::last_u2_element() const {
165 int offset = 0;
166 if (has_method_annotations()) offset++;
167 if (has_parameter_annotations()) offset++;
475 guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
476 }
477 if (has_localvariable_table()) {
478 u2* addr = localvariable_table_length_addr();
479 guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
480 }
481 // Check compressed_table_end relative to uncompressed_table_start
482 u2* uncompressed_table_start;
483 if (has_localvariable_table()) {
484 uncompressed_table_start = (u2*) localvariable_table_start();
485 } else if (has_exception_handler()) {
486 uncompressed_table_start = (u2*) exception_table_start();
487 } else if (has_checked_exceptions()) {
488 uncompressed_table_start = (u2*) checked_exceptions_start();
489 } else if (has_method_parameters()) {
490 uncompressed_table_start = (u2*) method_parameters_start();
491 } else {
492 uncompressed_table_start = (u2*) m_end;
493 }
494 int gap = (intptr_t) uncompressed_table_start - (intptr_t) compressed_table_end;
495 int max_gap = align_metadata_size(1)*BytesPerWord;
496 guarantee(gap >= 0 && gap < max_gap, "invalid method layout");
497 }
|