Hi, Przemek

> An now I compared BCC-5.5 and GCC-4.3.1 assembler code generated for
> such modified HVM and this simple code:
>
>   void func( void )
>   {
>      hb_stackPush();
>      hb_stackPop();
>   }

GCC generates wonderfull code

In my experience BCC produces best code by changing, say

#define hb_stackPush( )             do { \
                                       if( ++hb_stack.pPos == hb_stack.pEnd ) \
                                          hb_stackIncrease(); \
                                    } while ( 0 )


#define hb_stackPop( )              do { --hb_stack.pPos; \
                                       if( HB_IS_COMPLEX( * hb_stack.pPos ) ) \
                                          hb_itemClear( * hb_stack.pPos ); \
                                    } while ( 0 )

into


#define hb_stackPush( )             do { PHB_STACK p = &hb_stack; \
                                       if( ++p->pPos == p->pEnd ) \
                                          hb_stackIncrease(); \
                                    } while ( 0 )


#define hb_stackPop( )              do { PHB_STACK p = &hb_stack; --p->pPos; \
                                       if( HB_IS_COMPLEX( * p->pPos ) ) \
                                          hb_itemClear( * p->pPos ); \
                                    } while ( 0 )

This gives:

        mov       eax,offset _hb_stack
        add       dword ptr [eax+4],4
        mov       edx,dword ptr [eax+4]
        cmp       edx,dword ptr [eax+8]
        jne       short @3
        call      _hb_stackIncrease
@3:
        mov       eax,offset _hb_stack
        sub       dword ptr [eax+4],4
        mov       edx,dword ptr [eax+4]
        mov       edx,dword ptr [edx]
        test      dword ptr [edx],46085
        je        short @6
        push      edx
        call      _hb_itemClear
        pop       ecx
@6:

Anyway, this is not lifebuoy, there is no possibilities in all places
do translators work.

Best regards,
Saulius
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to