OSDN Git Service

Don't dynamically recurse when analyzing functions
authorLingfeng Yang <lfy@google.com>
Fri, 19 May 2017 21:00:38 +0000 (14:00 -0700)
committerLingfeng Yang <lfy@google.com>
Wed, 24 May 2017 21:43:32 +0000 (21:43 +0000)
commit1fb04acc3fb3cbcbe4791b5a37930e332e8af4e3
tree6d218ab54eac3852289701905e0e815fd785eae0
parent73981b86230948a365271a2b69f2571a801d9ace
Don't dynamically recurse when analyzing functions

bug: 38257724

With this CL, dEQP-GLES3.functional.shaders.functions.invalid no longer results
in a stack overflow and system crash.

The fix is to explicitly loop over switch cases in the function call
depth analysis.

Later on, we probably want to change TIntermSwitch traversal to loop
over all cases of the switch statement as well, but that requires
a lot of changes; all traversers need to be changed to not have to loop over
switch statements themselves, which will break expectations and
perhaps functionality that critically depends on seeing/controlling iteration
over switch statement cases.

Not tested for regressions in dEQP-GLES2.functional.shaders.*

Test: dEQP-GLES3.functional.shaders.functions.invalid.dynamic_switch_recursion_vertex:
system crash, hang, or fail -> Pass

Change-Id: I5d13a5f3296579c8818975e103f5ed6e03a47b68
Reviewed-on: https://swiftshader-review.googlesource.com/9789
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Lingfeng Yang <lfy@google.com>
src/OpenGL/compiler/AnalyzeCallDepth.cpp
src/OpenGL/compiler/AnalyzeCallDepth.h