Site Tools

Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcvm:6.11_reference_location_component

6.11 Reference Location Component

The Reference Location Component represents lists of offsets into the info item of the Method Component ( Section 6.9, Method Component) to items that contain indices into the constant_pool[] array of the Constant Pool Component ( Section 6.7, Constant Pool Component). This includes all constant pool index operands of instructions, and all non-zero catch_type_index items of the exception_handlers array. The catch_type_index items that have the value of 0 are not included since they represent finally blocks instead of particular exception classes.

Some of the constant pool indices are represented in one-byte values while others are represented in two-byte values. Operands of getfield_T and putfield_T instructions are one-byte constant pool indices. All other indices in a Method Component are two-byte values.

The Reference Location Component is not referenced by any other component in this CAP file.

The Reference Location Component structure is defined as:

The items of the reference_location_component structure are as follows:

tag

The tag item has the value COMPONENT_ReferenceLocation (9).

size

The size item indicates the number of bytes in the reference_location_component structure, excluding the tag and size items. The value of the size item must be greater than zero.

byte_index_count

The byte_index_count item represents the number of elements in the offsets_to_byte_indices array.

offsets_to_byte_indices[]

The offsets_to_byte_indices item represents an array of 1-byte jump offsets into the info item of the Method Component to each 1-byte constant_pool[] array index. Each entry represents the number of bytes (or distance) between the current index to the next. If the distance is greater than or equal to 255 then there are n entries equal to 255 in the array, where n is equal to the distance divided by 255. The nth entry of 255 is followed by an entry containing the value of the distance modulo 255.

An example of the jump offsets in an offsets_to_byte_indices array is shown in the following table.

Instruction

Offset to Operand

Jump Offset

getfield_a 0

10

10

putfield_b 2

65

55

255

255

getfield_s 1

580

5

255

putfield_a 0

835

0

getfield_i 3

843

8

All 1-byte constant_pool[] array indices in the Method Component must be represented in offsets_to_byte_indices array.

byte2_index_count

The byte2_index_count item represents the number of elements in the offsets_to_byte2_indices array.

offsets_to_byte2_indices[]

The offsets_to_byte2_indices item represents an array of 1-byte jump offsets into the info item of the Method Component to each 2-byte constant_pool[] array index. Each entry represents the number of bytes (or distance) between the current index to the next. If the distance is greater than or equal to 255 then there are n entries equal to 255 in the array, where n is equal to the distance divided by 255. The nth entry of 255 is followed by an entry containing the value of the distance modulo 255.

An example of the jump offsets in an offsets_to_byte_indices array is shown in TABLE 6-17. The same example applies to the offsets_to_byte2_indices array if the instructions are changed to those with 2-byte constant_pool[] array indices.

All 2-byte constant_pool[] array indices in the Method Component must be represented in offsets_to_byte2_indices array, including those represented in catch_type_index items of the exception_handler_info array.

javacard/jcvm/6.11_reference_location_component.txt · Last modified: 2017/05/13 04:09 (external edit)