This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc moving memory reference across call


Richard Guenther wrote:
> On Fri, Oct 10, 2008 at 7:55 PM, Andrew Haley <aph@redhat.com> wrote:
>> I have some broken code, compiled from Java source.
>>
>> It looks like:
>>
>>    D.843 = &java.text.Collator.class$$;
>>    _Jv_InitClass (D.843);
>>    D.845 = &_CD_java_text_Collator;
>>
>> is being turned into:
>>
>>    D.843 = &java.text.Collator.class$$;
>>    D.845 = &_CD_java_text_Collator;
>>    _Jv_InitClass (D.843);
> 
> This is always a valid transformation.
> 
>> i.e. the memory reference is moved to before the call to _Jv_InitClass.
> 
> There is no memory reference in the above case, it seems just the address
> of _CD_java_text_Collator is taken.
> 
> Or maybe I'm missing sth?

In the RTL code it moves the mem ref, not just the address:

(call (mem:QI (symbol_ref:DI ("_Jv_InitClass") [flags 0x41]

(set (reg/f:DI 95 [ #ref#8#1 ])
        (mem/s/u/f/j:DI (const:DI (plus:DI (symbol_ref:DI ("_CD_java_text_Collator")
                    (const_int 16 [0x10])))

is turned to:

(set (reg/f:DI 162 [ #ref#8#1 ])
        (mem/s/u/f/j:DI (const:DI (plus:DI (symbol_ref:DI ("_CD_java_text_Collator")
                    (const_int 16 [0x10])))

...

(call (mem:QI (symbol_ref:DI ("_Jv_InitClass")

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]