/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2014-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @return This fiber's stack pointer and stack size.
*/
std::pair<void*, size_t> getStack() const {
- void* const stack =
- std::min<void*>(fcontext_.stackLimit(), fcontext_.stackBase());
- const size_t size = std::abs(
- reinterpret_cast<intptr_t>(fcontext_.stackBase()) -
- reinterpret_cast<intptr_t>(fcontext_.stackLimit()));
- return {stack, size};
+ return {fiberStackLimit_, fiberStackSize_};
}
private:
template <typename F, typename G>
void setFunctionFinally(F&& func, G&& finally);
- static void fiberFuncHelper(intptr_t fiber);
- void fiberFunc();
+ [[noreturn]] void fiberFunc();
/**
* Switch out of fiber context into the main context,
void recordStackPosition();
FiberManager& fiberManager_; /**< Associated FiberManager */
- FContext fcontext_; /**< current task execution context */
+ size_t fiberStackSize_;
+ unsigned char* fiberStackLimit_;
+ FiberImpl fiberImpl_; /**< underlying fiber implementation */
std::shared_ptr<RequestContext> rcontext_; /**< current RequestContext */
folly::Function<void()> func_; /**< task function */
bool recordStackUsed_{false};
class LocalData {
public:
LocalData() {}
+ ~LocalData();
LocalData(const LocalData& other);
LocalData& operator=(const LocalData& other);
size_t asanMainStackSize_{0};
#endif
};
-}
-}
+} // namespace fibers
+} // namespace folly
#include <folly/fibers/Fiber-inl.h>