Reland "Reland "Guarantee that raster pipeline always uses finite stack""
This is a reland of commit 6c17888a586cd27e2063e4287c8d92b1805fea71
Original change's description:
> Reland "Guarantee that raster pipeline always uses finite stack"
>
> This is a reland of commit 3809e9bd28ae110271dccb4e7eeacd2b76a0223b
>
> Original change's description:
> > Guarantee that raster pipeline always uses finite stack
> >
> > In release builds, clang and gcc do tail call optimization, which
> > reuses the same stack space for each stage. In debug builds, that
> > doesn't happen. If we're going to start generating arbitrarily long
> > pipelines (eg from SkSL), we need to ensure that we're not going to
> > overflow the stack.
> >
> > I first looked at ways to force tail call optimization (Clang's
> > musttail, and optimization pragmas). These are all nonportable, and
> > don't work on some of our supported toolchains.
> >
> > Instead, this version includes a new RP execution mode that does away
> > with the tail-calling entirely. Instead, each stage just returns the
> > next stage to call. This ruins our optimized stage ABI, obviously, but
> > we're only doing it in debug builds.
> >
> > MSVC can do tail call optimization, but testing shows that it falls over
> > with raster pipeline (too complex?). As a result, we always use the new
> > technique there.
> >
> > Our new unit test measures stack consumption (which is the thing we're
> > worried about anyway) to make sure that TCO or our new technique is
> > successfully limiting stack usage.
> >
> > Change-Id: Id0d419f97b53b0b57c82214c4a2f1f94e5ab6b3c
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/566896
> > Reviewed-by: Herb Derby <herb@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
>
> Change-Id: If02f04eaba13a54ff8adb8e058f022cc048dc641
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/567439
> Reviewed-by: Herb Derby <herb@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I59e32ee87a6d4b36c923baf1e86f59ceefb26025
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/568597
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2 files changed