Commit 9ad0307f authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

avoid tail calls in the stack-trace test example

Summary: The test looks for every function in its list of functions to be present in the example stack-trace. But, depending on optimizations, the compiler may transform some of the calls to tail calls, in which case the calling functions would be elided from the stack-trace. Prevent those tail calls.

Reviewed By: kennyyu

Differential Revision: D33797857

fbshipit-source-id: 1c20c19bc612cebbc6a30466ef8deb54713b1497
parent 7774051a
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <folly/experimental/coro/Task.h> #include <folly/experimental/coro/Task.h>
#include <folly/experimental/symbolizer/StackTrace.h> #include <folly/experimental/symbolizer/StackTrace.h>
#include <folly/experimental/symbolizer/Symbolizer.h> #include <folly/experimental/symbolizer/Symbolizer.h>
#include <folly/lang/Hint.h>
#include <folly/test/TestUtils.h> #include <folly/test/TestUtils.h>
#include <boost/regex.hpp> #include <boost/regex.hpp>
...@@ -288,6 +289,7 @@ FOLLY_NOINLINE void funcF() { ...@@ -288,6 +289,7 @@ FOLLY_NOINLINE void funcF() {
FOLLY_NOINLINE void funcE() { FOLLY_NOINLINE void funcE() {
funcF(); funcF();
compiler_must_not_elide(0); // prevent tail-call above
} }
FOLLY_NOINLINE folly::coro::Task<void> co_funcD() { FOLLY_NOINLINE folly::coro::Task<void> co_funcD() {
...@@ -306,6 +308,7 @@ FOLLY_NOINLINE void funcB2_blocking() { ...@@ -306,6 +308,7 @@ FOLLY_NOINLINE void funcB2_blocking() {
FOLLY_NOINLINE void funcB1() { FOLLY_NOINLINE void funcB1() {
funcB2_blocking(); funcB2_blocking();
compiler_must_not_elide(0); // prevent tail-call above
} }
FOLLY_NOINLINE folly::coro::Task<void> co_funcB0() { FOLLY_NOINLINE folly::coro::Task<void> co_funcB0() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment