On Mon, 4 Sep 2023 14:30:06 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> @TheRealMDoerr We've been discussing the shifts in order to wrap our heads 
>> around it, and we've ended up with this diagram in order to try and 
>> visualize what happens:
>> 
>> Let's say we have a struct with 3 ints:
>> 
>> 
>> struct Foo {
>>     int x;
>>     int y;
>>     int z;
>> };
>> 
>> 
>> If this struct is passed as an argument, then the load of the second 'half' 
>> of the struct would look like this:
>> 
>> 
>> offset         : 0 .... 32 ..... 64 ..... 96 .... 128
>> values         : xxxxxxxx|yyyyyyyy|zzzzzzzz|????????   (can't touch bits 
>> 96..128)
>> Load int       :                  V        +--------+
>>                                   |                 |
>>                                   +--------+        |
>>                                            V        V
>> In register    :                   ????????|zzzzzzzz   (MSBs are 0)
>> Shift left     :                   zzzzzzzz|00000000   (LSBs are zero)
>> Write long     :                  V                 V
>> Result         : xxxxxxxx|yyyyyyyy|zzzzzzzz|00000000
>> 
>> 
>> So, the 'Result' is padded at the tail with zeros.
>> 
>> Does that seem right? Does it seem useful to add this diagram as a comment 
>> somewhere, for us when we come back to this code a year from now? Thanks
>
>> If this struct is passed as an argument, then the load of the second 'half' 
>> of the struct would look like this:
> 
> It would perhaps be cleaner if in the MSB/LSB comments we said:
> 
> LSBs are zzz...z
> LSBs are 000...0
> 
> (e.g. avoid to refer to MSBs in the first, since those bytes are not exactly 
> zero, they are the padding bytes)

> @mcimadamore: May I ask you or somebody else from the Panama team to provide 
> a 2nd review? This PR requires Panama knowledge, not really PPC knowledge.

Sorry - I have already reviewed it - but didn't approve as I was waiting for 
@JornVernee to chime in. Now he has, and I will add my approval as well.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15417#issuecomment-1707067130

Reply via email to