0

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 );
    }
Community
  • 1
  • 1
EyeGem
  • 1
  • 3
  • You might want to place the newline at the _end_ of the string, or at least flush `stdout`, to make sure it's really stuck in the `printf` call or not. – Some programmer dude Apr 05 '13 at 12:08
  • I see what you mean, I'll add fflush of stdout after each printf, but the real hang is not in printf, obviously, because I've added printfs to find where the hang occures, not vice versa. – EyeGem Apr 05 '13 at 12:59
  • Okay, I've added fflush( stdout ) after each printf() and still got the hang. Interesting thing is that callstack states it hangs in submethod of implementation class, GameVisualizerImpl::LoadConfig, but there're printf() calls at the very beginning of GameVisualizerImpl::Initialize() which then calls LoadConfig() and at the very beginning of LoadConfig(). But Flash's log has no texts from these printfs()... – EyeGem Apr 05 '13 at 13:33
  • 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... – EyeGem Apr 10 '13 at 11:46

1 Answers1

0

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...

EyeGem
  • 1
  • 3