5 Replies Latest reply on Sep 12, 2008 2:50 PM by sunwer

    Crash to desktop on divide-by-zero

    zazzo9 Level 3
      I am finding preview 2 to crash to the desktop less frequently than the first release, but it still happens.

      Using the CPU renderer on Windows XP, I'm crashing to the desktop when I make the mistake of allowing a division by zero. It does not seem to be a large problem unless the divide-by-zero is caused by a user-controlled parameter.

      In this code, the 'val' parameter starts at zero and halts execution of the filter from an error; if one tries to drag the slider to a higher value, execution is halted again. However, try to drag the slider a couple more times and AIF toolkit dies; all unsaved work is instantly lost.
        • 1. Re: Crash to desktop on divide-by-zero
          Kevin Goldsmith Level 3
          yeah, good catch. We're aware of this issue. We're trying to decide how we want to handle it.

          I'd be interested in developers opinions. We could gaurd against this situation (in fact we do for integers) which could be a general perf hit on the CPU (GPUs work very different in this regard), or we could ask developers to guard against this in their code if it is expected (like in C).

          Which would you guys prefer?
          • 2. Re: Crash to desktop on divide-by-zero
            zazzo9 Level 3
            My personal preference is to write my own checks only when they are needed, performance being crucial sometimes.

            I expect most people are not going to expect amazing performance when running on the CPU anyway, though; and potential problems could fall through testing.
            • 3. Re: Crash to desktop on divide-by-zero
              This article says:
              "When an if-else-endif statement is encountered, the JIT switches to scalar mode, i.e. the if-else-ending section will be expanded up to 4 times as scalar code. Anything outside of a if-else-endif block is still processed as vectors. It's best to move sampling outside of if statements if practical. The final write to the destination is always vectorized."

              Would it be possible to use a guarding against the situation which doesn't switch to scalar mode? I think it would be better (for performance) than using the if statement (but I could be wrong, as always, because I don't know how it exactly works).
              • 4. Re: Crash to desktop on divide-by-zero
                Kevin Goldsmith Level 3
                That'd be a good question for the Flash Player forums. The runtime in the toolkit is different than the runtime in the player for this release.
                • 5. Re: Crash to desktop on divide-by-zero
                  sunwer Level 1
                  Interesting post, thanks for all, where can I find more information about this.