Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
OT Bytecode Attributes/CallinMethodMappings
Contents
Attribute CallinMethodMappings
Intent
The CallinMethodMappings attribute is a variable-length attribute used in the attributes table of the ClassFile structure.
Location:
A bound role class with a callin binding.
Content:
A list of method bindings. For structure, see below.
Purpose:
The OTRE uses this attribute to determine
- a) which callins (callin wrapper calls) have to be woven into which base methods
- b) which base method has to be called while generating a base-call in a callin role method
Format:
CallinMethodMappings { u2 attribute_name_index; u4 attribute_length; u2 method_mappings_count; CallinMethodMapping method_mappings[method_mappings_count]; } CallinMethodMapping { u2 binding_file_name; u2 binding_line_number; u2 binding_line_offset; u2 binding_label; u2 role_method_name_index; u2 role_method_signatur_index; u2 flags; u2 lift_method_name; u2 lift_method_signature; u2 binding_modifier; u2 base_method_mapping_count; BaseMethodMapping base_mappings[base_method_mapping_count]; } BaseMethodMapping { u2 base_method_name_index; u2 base_method_signature_index; u2 wrapper_name_index; u2 wrapper_signature_index; u1 base_flags; u4 translation_flags; }
The items of the CallinMethodMappings structure are as follows:
- attribute_name_index
- The constant_pool entry at that index must be a CONSTANT_Utf8_info representing the string "CallinRoleBaseBindings".
- attribute_length
- The value of the attribute_length item indicates the length of the attribute, excluding the initial six bytes.
- method_mappings_count
- The value of the method_mappings_count item indicates the number of entries in the method_mappings array.
- method_mappings[]
- Each pair role method RM + bound base method BM are listed here. Each method_mappings array entry contains the following 12 items:
- binding_file_name
- The constant_pool index representing the name of the file which contains the callin binding.
- binding_line_number
- The line number of the callin binding.
- binding_line_offset
- The line number offset of the callin binding.
- binding_label
- The constant_pool index representing the binding label.
- role_method_name_index
- The constant_pool index representing the name of RM.
- role_method_signatur_index
- The constant_pool index representing the signature of RM as type descriptor.
- The signature is "retrenched", i.e., it does not contain the enhancement arguments
[Team;[IIII[Object;
, but other than that erasures are used to reflect the byte-code level signature
- flags
- The value of the flags item is a mask of flags. The interpretation of each flag, when set, is as shown in the following:
Flag Name | Value | Interpretation |
---|---|---|
STATIC_ROLE_METHOD | 1 | the bound role method is static |
|
|
removed |
INHERITED | 4 | the bound role method is inherited (not used by the OTRE) |
COVARIANT_BASE_RETURN | 8 | the callin binding may capture base methods with covariant return types |
- lift_method_name
- The constant_pool index representing the name of the lift method for the result ("", if no lifting necessary)
- lift_method_signature
- The constant_pool index representing the signature of the lift method for the result ("", if no lifting necessary)
- binding_modifier
- The constant_pool index representing the binding modifier ("after", "before" or "replace").
- base_method_mapping_count
- The value of the base_method_mapping_count item indicates the number of entries in the base_mappings array.
- base_mappings[]
- Each base_mappings array entry contains the following six items:
- base_method_name_index
- The constant_pool index representing the name of BM.
- base_method_signature_index
- The constant_pool index representing the signature of BM as type descriptor.
- The descriptor uses erasures as to reflect the byte-code level signature
- wrapper_name_index
- The constant_pool index representing the name of the callin wrapper for the pair RM + BM.
- wrapper_signature_index
- The constant_pool index representing the signature of the callin wrapper for the pair RM + BM as type descriptor.
- base_flags
- The value of the base_flags item is a mask of flags. The interpretation of each flag, when set, is as shown in the following:
Flag Name | Value | Interpretation |
---|---|---|
CALLIN | 1 | the bound base method is a callin (role) method |
STATIC_BASE_METHOD | 2 | the bound base method is static |
- translation_flags
- here the compiler encodes with arguments/return values require translation (lifting/lowering) to be performed by the callin wrapper
- the OTRE uses this to determine when a base-call result requires lifting