Comment 29 for bug 488354

Revision history for this message
In , Mh+mozilla (mh+mozilla) wrote :

Created an attachment (id=433581)
C-only version

The patch is unfortunately not easily readable. It's probably better to apply it to see the resulting file. Please tell me if the comments are not clear enough.

It is now free of assembly, and I think it is now perfectly safe.

FYI, the main reason I went with the copy_double_word function is that somehow, gcc would generate 2 almost identical assembly snippets for the double word copies when I just inlined the code like it is in the original code: 1 for nsXPTType::T_I64 and nsXPTType::T_U64 and another one for nsXPTType::T_DOUBLE.
And when I say almost identical, it's almost pathetic that it can't factor:
        add r0, r0, #7 add r0, r0, #7
        bic r7, r0, #7 bic r7, r0, #7
        cmp r7, r5 cmp r5, r7
        moveq r7, lr moveq r7, lr
        sub r9, r3, #16 sub r9, r3, #16
        ldmia r9, {r8-r9} ldmia r9, {r8-r9}
        add r0, r7, #4 add r0, r7, #4
        stmia r7, {r8-r9} stmia r7, {r8-r9}
        b .L5 b .L5

As a nice side effect, it made it cleaner to keep non-eabi support, so I just implemented it.

During the development of this patch, I hit some other pathetic cases of stupid gcc optimizations that I'll blog about.