On 2025-07-08 18:18, Qing Zhao wrote:
On Jul 8, 2025, at 17:46, Siddhesh Poyarekar <siddh...@gotplt.org> wrote:

On 2025-07-08 17:17, Qing Zhao wrote:
Are the above the correct and efficient updates to the .ACCESS_WITH_SIZE to 
resolve both PR121000 and the issue
we have with counted_by for pointers?

I don't know about PR121000, but for counted_by with pointers, I think the REF_TO_OBJ 
(and the result_type) would also have to be a->fam and not &a->fam, i.e. don't 
generate an INDIRECT_REF to the .ACCESS_WITH_SIZE.

Yes. That’s right. I already changed this in my local workspace. And worked 
well.
With the current .ACCESS_WITH_SIZE, in order to get the correct TYPE_SIZE_UNIT 
of the element TYPE for the pointer array, we have to distinguish whether the 
TYPE passed by the 6th argument is for FAM or for pointer, therefore, I have to 
add one more argument to the .ACCESS_WITH_SIZE:

+   the 7th argument of the call is 1 when for FAM, 0 for pointers.

With the new .ACCESS_WITH_SIZE I proposed in the previous email as:

ACCESS_WITH_SIZE (REF_TO_OBJ, REF_TO_SIZE, CLASS_OF_SIZE,
                    TYPE_OF_SIZE, ACCESS_MODE)
  which returns the REF_TO_OBJ same as the 1st argument;

  1st argument REF_TO_OBJ: The reference to the object;
  2nd argument REF_TO_SIZE: The reference to the size of the object,
  3rd argument CLASS_OF_SIZE + TYPE_OF_SIZE: An integer constant with a TYPE:

      The integer constant value of this argument represents:
                 0: means that the size referenced by the REF_TO_SIZE is the 
number of bytes.
                 1: means that the size referenced by the REF_TO_SIZE is the 
number of the elements of the object type;
      The TYPE is the same as the TYPE of the object referenced by REF_TO_SIZE.
  4th argument ACCESS_MODE:
   -1: Unknown access semantics
    0: none
    1: read_only
    2: write_only
    3: read_write
  5th argument: The TYPE_SIZE_UNIT of the element TYPE of the FAM or the 
pointer array. “

Since we pass the TYPE_SIZE_UNIT of the element TYPE directly to the call to 
.ACCESS_WITH_SIZE, no need to distinguish whether the TYPE is for FAM or 
pointer anymore.

Hope this is clear.

Sounds reasonable to me.

Thanks,
Sid

Reply via email to