return res;
`}
+ # Return the attribute value in `instance` with a direct access (SST)
- # `instance` is the attributes array of the receiver
- # `offset` is the absolute offset of this attribute
++ # * `instance` is the attributes array of the receiver
++ # * `offset` is the absolute offset of this attribute
+ private fun read_attribute_sst(instance: Pointer, offset: Int): Instance `{
+ /* We can make a direct access to the attribute value
+ because this attribute is always at the same position
+ for the class of this receiver */
+ Instance res = ((Instance *)instance)[offset];
+
+ return res;
+ `}
+
# Replace in `recv` the value of the attribute `mproperty` by `value`
redef fun write_attribute(mproperty: MAttribute, recv: Instance, value: Instance)
do
Instance_incr_ref(value);
`}
+ # Replace the value of an attribute in an instance with direct access
- # `instance` is the attributes array of the receiver
- # `offset` is the absolute offset of this attribute
- # `value` is the new value for this attribute
++ # * `instance` is the attributes array of the receiver
++ # * `offset` is the absolute offset of this attribute
++ # * `value` is the new value for this attribute
+ private fun write_attribute_sst(instance: Pointer, offset: Int, value: Instance) `{
+ // Direct access to the position with the absolute offset
+ ((Instance *)instance)[offset] = value;
+ Instance_incr_ref(value);
+ `}
+
# Is the attribute `mproperty` initialized in the instance `recv`?
redef fun isset_attribute(mproperty: MAttribute, recv: Instance): Bool
do
return res
end
- # Update positions of self class in `parent`
+ # Update positions of the class `cl`
- # `attributes_offset`: absolute offset of introduced attributes
- # `methods_offset`: absolute offset of introduced methods
+ # * `attributes_offset`: absolute offset of introduced attributes
+ # * `methods_offset`: absolute offset of introduced methods
- private fun update_positions(attributes_offsets: Int, methods_offset:Int, parent: MClass)
+ private fun update_positions(attributes_offsets: Int, methods_offset:Int, cl: MClass)
do
- parent.positions_attributes[self] = attributes_offsets
- parent.positions_methods[self] = methods_offset
+ positions_attributes[cl] = attributes_offsets
+ positions_methods[cl] = methods_offset
end
end