< prev index next >

src/share/vm/oops/constMethod.cpp

Print this page




 111     extra_bytes +=
 112               sizes->localvariable_table_length() * sizeof(LocalVariableTableElement);
 113   }
 114   if (sizes->exception_table_length() > 0) {
 115     extra_bytes += sizeof(u2);
 116     extra_bytes += sizes->exception_table_length() * sizeof(ExceptionTableElement);
 117   }
 118   if (sizes->generic_signature_index() != 0) {
 119     extra_bytes += sizeof(u2);
 120   }
 121   // This has to be a less-than-or-equal check, because we might be
 122   // storing information from a zero-length MethodParameters
 123   // attribute.  We have to store these, because in some cases, they
 124   // cause the reflection API to throw a MalformedParametersException.
 125   if (sizes->method_parameters_length() >= 0) {
 126     extra_bytes += sizeof(u2);
 127     extra_bytes += sizes->method_parameters_length() * sizeof(MethodParametersElement);
 128   }
 129 
 130   // Align sizes up to a word.
 131   extra_bytes = align_size_up(extra_bytes, BytesPerWord);
 132 
 133   // One pointer per annotation array
 134   if (sizes->method_annotations_length() > 0) {
 135     extra_bytes += sizeof(AnnotationArray*);
 136   }
 137   if (sizes->parameter_annotations_length() > 0) {
 138     extra_bytes += sizeof(AnnotationArray*);
 139   }
 140   if (sizes->type_annotations_length() > 0) {
 141     extra_bytes += sizeof(AnnotationArray*);
 142   }
 143   if (sizes->default_annotations_length() > 0) {
 144     extra_bytes += sizeof(AnnotationArray*);
 145   }
 146 
 147   int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
 148   assert(extra_words == extra_bytes/BytesPerWord, "should already be aligned");
 149   return align_metadata_size(header_size() + extra_words);
 150 }
 151 
 152 Method* ConstMethod::method() const {
 153     return _constants->pool_holder()->method_with_idnum(_method_idnum);
 154   }
 155 
 156 // linenumber table - note that length is unknown until decompression,
 157 // see class CompressedLineNumberReadStream.
 158 
 159 u_char* ConstMethod::compressed_linenumber_table() const {
 160   // Located immediately following the bytecodes.
 161   assert(has_linenumber_table(), "called only if table is present");
 162   return code_end();
 163 }
 164 
 165 // Last short in ConstMethod* before annotations
 166 u2* ConstMethod::last_u2_element() const {
 167   int offset = 0;




 111     extra_bytes +=
 112               sizes->localvariable_table_length() * sizeof(LocalVariableTableElement);
 113   }
 114   if (sizes->exception_table_length() > 0) {
 115     extra_bytes += sizeof(u2);
 116     extra_bytes += sizes->exception_table_length() * sizeof(ExceptionTableElement);
 117   }
 118   if (sizes->generic_signature_index() != 0) {
 119     extra_bytes += sizeof(u2);
 120   }
 121   // This has to be a less-than-or-equal check, because we might be
 122   // storing information from a zero-length MethodParameters
 123   // attribute.  We have to store these, because in some cases, they
 124   // cause the reflection API to throw a MalformedParametersException.
 125   if (sizes->method_parameters_length() >= 0) {
 126     extra_bytes += sizeof(u2);
 127     extra_bytes += sizes->method_parameters_length() * sizeof(MethodParametersElement);
 128   }
 129 
 130   // Align sizes up to a word.
 131   extra_bytes = align_up(extra_bytes, BytesPerWord);
 132 
 133   // One pointer per annotation array
 134   if (sizes->method_annotations_length() > 0) {
 135     extra_bytes += sizeof(AnnotationArray*);
 136   }
 137   if (sizes->parameter_annotations_length() > 0) {
 138     extra_bytes += sizeof(AnnotationArray*);
 139   }
 140   if (sizes->type_annotations_length() > 0) {
 141     extra_bytes += sizeof(AnnotationArray*);
 142   }
 143   if (sizes->default_annotations_length() > 0) {
 144     extra_bytes += sizeof(AnnotationArray*);
 145   }
 146 
 147   int extra_words = align_up(extra_bytes, BytesPerWord) / BytesPerWord;
 148   assert(extra_words == extra_bytes/BytesPerWord, "should already be aligned");
 149   return align_metadata_size(header_size() + extra_words);
 150 }
 151 
 152 Method* ConstMethod::method() const {
 153     return _constants->pool_holder()->method_with_idnum(_method_idnum);
 154   }
 155 
 156 // linenumber table - note that length is unknown until decompression,
 157 // see class CompressedLineNumberReadStream.
 158 
 159 u_char* ConstMethod::compressed_linenumber_table() const {
 160   // Located immediately following the bytecodes.
 161   assert(has_linenumber_table(), "called only if table is present");
 162   return code_end();
 163 }
 164 
 165 // Last short in ConstMethod* before annotations
 166 u2* ConstMethod::last_u2_element() const {
 167   int offset = 0;


< prev index next >