Question

I have a problem with LTO optimization in FlasCC.

When compiled with -O1 resulting swf runs just fine.

But with -O4 it first runs OK, but then suddenly hangs on specific virtual function call for time over than 15 seconds and then Flash stops it.

I've added printfs to trace the exact point of hang using Flash logs.

It hangs at printf( "Program_Step : vis init" ) never ever coming into real Initialize() implementation. Pointer is declared as IGameVisualizer *m_pVisualizer;

Code:

   virtual void Program_Step( IProgramStep & step )
    {
        if ( !m_init )
        {
            if ( m_initCounter > 0 )
            {
                printf( "\n Program_Step : Later... %d skips left", m_initCounter );
                --m_initCounter;
                return;
            }

            printf( "\n Program_Step : Init" );
            m_init = true;
            m_pVisualizer = Create_SlotsVisualizer_V1();
            printf( "\n Program_Step : m_pLogic" );
            m_pLogic = Create_SlotsLogic_Test();

            if ( m_pVisualizer )
            {
                printf( "\n Program_Step : vis init" );
                m_pVisualizer->Initialize();
            }

            if ( m_pLogic )
            {
                printf( "\n Program_Step : logic init" );
                m_pLogic->Initialize( *this );
            }

            printf( "\n Program_Step : after inits" );
        }

        int dt = step.GetTimeDeltaMsec();

        ProcessControls( dt );

        if ( m_pLogic )
            m_pLogic->Process( dt, *this );

        if ( m_pVisualizer )
            m_pVisualizer->Process( dt );
    }
Was it helpful?

Solution

Okay, I've determined reasons:

1) printf() didn't show real place even after fflush()

2) one of libraries was compiled with -O1, but part of its class code is located in public inline method and was compiled with -O4 as a part of another library => apparently those two weren't compatible, which caused infinite loop in parsing of binary stream...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top