![]() |
|||
![]() ![]() |
![]() |
|
![]() |
The this_class RegionDuring the course of a classs execution, it is sometimes necessary to present some specific information regarding internal characteristics. For this reason, the this_class provides a two-byte index into constant_pool specifying the information about the current class. The Interfaces RegionEach class can implement any number of defined interfaces. The Interfaces Region provides all implemented interface information through a two-byte interfaces_count indexing the array contained in the Interfaces Region. The Fields RegionAll data members, or fields, of the currently specified class are contained within the Fields Region. That is, all stateful class information is specified in the class file by a 2-byte fields_count index which specifies the number of fields to be found in a fields array. Each field element has a 2-byte value of access_flags, two 2-byte indexes into constant_pool, a 2-byte attribute count, and an array of attributes. The first index, name_index, holds the name of the field. The second, signature_index, holds the signature of the field. The last fields work in tandem to store any needed attributes about the field. In this way, field accessibility can be specified. The Methods RegionVery similar to the Fields Region, the Methods Region contains all methods of the current class. The methods_count supplies the number of methods stored in the methods array. This number includes only the methods declared in the current class. The Methods Region contains an array of elements that provide complete information about the method. Each method element contains a 2-byte access_flags value, 2-byte name_index referencing the name of the method in the constant_pool, 2-byte signature_index referencing signature information found in the constant_pool, 2-byte attributes_count containing the number of elements in the attributes array, and an attributes array. Currently, the only value that can be found in the attributes array is the Code structure, which provides the information needed to properly execute the specified method. Although the Code structure is not a testable item, the following information provides the structure for reference purposes. Code StructureContained in the first two bytes of each element is the attribute_name_index. This index provides a pointer to the constant_pool supplying the name Code. The next two bytes, named attribute_length, provide the length of the Code structure, not including attribute_name_index. Actual Code-specific information begins with the next three 4-byte fields, followed by the methods op-code. max_stack contains the maximum number of entries on the operand stack during the methods execution. max_locals specifies the total number of local variables for the method. code_length is the total length of the next field, with the Code field containing op-code. After the Code field, the Code structure provides detailed exception information for the method. This starts with the exception_table_length and exception_table, which describe each exception handler in the method code. start_pc, end_pc, and handler_pc give the starting and ending positions in which the event handler, pointed to by handler_pc, is active. catch_type, which follows handler_pc, denotes the type of exception handled. The remainder of the Code structure is devoted to debugging information. line_number is the 2-byte line number of the methods first line of code. LocalVariableTable_attribute contains a structure used by the debugger to determine the value of local variables. The structure consists of three 1-byte values and a local_variable_table structure. The first two fields of the structure, attribute_name_index and attribute_length, are used to describe the structure. The third contains the length of the local_variable_table. local_variable_table contains the following 2-byte fields in the following order: start_pc, length, name_index, signature_index, and slot. start_pc and length denote the offset when the variable value can be found. name_index and signature_index are indexes into constant_pool where the variables name and signature can be found. slot denotes the position in the local method frame where the variable can be found. The Attributes RegionThroughout Java and the JVM, provisions were made for future enhancements. For example, the Attributes Region contains all the overhead for later expansion. For example, the current class structure contains only one element in the defined Attribute arraythe SourceFile structure. Nevertheless, an attributes_count field is provided just in case future elements need to be added. Although the SourceFile structure is not a testable item, the following information provides the structure for reference purposes.
|
![]() |
|