Stop applying flatten attribute

This blows up the code size too much. I wonder if having all those
distinct possible program counters helps libfuzzer /shrug
This commit is contained in:
2024-10-11 21:31:18 -07:00
parent 54c7ccb96b
commit 323b239411
+19 -30
View File
@@ -2919,12 +2919,6 @@ Node *firstGeqPhysical(Node *n, const std::span<const uint8_t> key) {
#define PRESERVE_NONE
#endif
#if __has_attribute(flatten)
#define FLATTEN __attribute__((flatten))
#else
#define FLATTEN
#endif
typedef PRESERVE_NONE void (*Continuation)(struct CheckJob *,
struct CheckContext *);
@@ -2968,7 +2962,7 @@ struct CheckContext {
#endif
};
FLATTEN PRESERVE_NONE void keepGoing(CheckJob *job, CheckContext *context) {
PRESERVE_NONE void keepGoing(CheckJob *job, CheckContext *context) {
#if __has_attribute(musttail)
job = job->next;
MUSTTAIL return job->continuation(job, context);
@@ -2978,7 +2972,7 @@ FLATTEN PRESERVE_NONE void keepGoing(CheckJob *job, CheckContext *context) {
#endif
}
FLATTEN PRESERVE_NONE void complete(CheckJob *job, CheckContext *context) {
PRESERVE_NONE void complete(CheckJob *job, CheckContext *context) {
if (context->started == context->count) {
if (job->prev == job) {
#if !__has_attribute(musttail)
@@ -2999,12 +2993,11 @@ FLATTEN PRESERVE_NONE void complete(CheckJob *job, CheckContext *context) {
namespace check_point_read_state_machine {
FLATTEN PRESERVE_NONE void begin(CheckJob *, CheckContext *);
PRESERVE_NONE void begin(CheckJob *, CheckContext *);
template <class NodeT>
FLATTEN PRESERVE_NONE void iter(CheckJob *, CheckContext *);
template <class NodeT> PRESERVE_NONE void iter(CheckJob *, CheckContext *);
FLATTEN PRESERVE_NONE void down_left_spine(CheckJob *, CheckContext *);
PRESERVE_NONE void down_left_spine(CheckJob *, CheckContext *);
static Continuation iterTable[] = {iter<Node0>, iter<Node3>, iter<Node16>,
iter<Node48>, iter<Node256>};
@@ -3132,12 +3125,11 @@ void down_left_spine(CheckJob *job, CheckContext *context) {
namespace check_prefix_read_state_machine {
FLATTEN PRESERVE_NONE void begin(CheckJob *, CheckContext *);
PRESERVE_NONE void begin(CheckJob *, CheckContext *);
template <class NodeT>
FLATTEN PRESERVE_NONE void iter(CheckJob *, CheckContext *);
template <class NodeT> PRESERVE_NONE void iter(CheckJob *, CheckContext *);
FLATTEN PRESERVE_NONE void down_left_spine(CheckJob *, CheckContext *);
PRESERVE_NONE void down_left_spine(CheckJob *, CheckContext *);
static Continuation iterTable[] = {iter<Node0>, iter<Node3>, iter<Node16>,
iter<Node48>, iter<Node256>};
@@ -3259,12 +3251,12 @@ void down_left_spine(CheckJob *job, CheckContext *context) {
} // namespace check_prefix_read_state_machine
namespace check_range_read_state_machine {
FLATTEN PRESERVE_NONE void begin(CheckJob *, CheckContext *);
PRESERVE_NONE void begin(CheckJob *, CheckContext *);
template <class NodeT>
FLATTEN PRESERVE_NONE void common_prefix_iter(CheckJob *, CheckContext *);
PRESERVE_NONE void common_prefix_iter(CheckJob *, CheckContext *);
FLATTEN PRESERVE_NONE void done_common_prefix_iter(CheckJob *, CheckContext *);
PRESERVE_NONE void done_common_prefix_iter(CheckJob *, CheckContext *);
static Continuation commonPrefixIterTable[] = {
common_prefix_iter<Node0>, common_prefix_iter<Node3>,
@@ -3272,18 +3264,17 @@ static Continuation commonPrefixIterTable[] = {
common_prefix_iter<Node256>};
template <class NodeT>
FLATTEN PRESERVE_NONE void left_side_iter(CheckJob *, CheckContext *);
PRESERVE_NONE void left_side_iter(CheckJob *, CheckContext *);
FLATTEN PRESERVE_NONE void left_side_down_left_spine(CheckJob *,
CheckContext *);
PRESERVE_NONE void left_side_down_left_spine(CheckJob *, CheckContext *);
FLATTEN PRESERVE_NONE void done_left_side_iter(CheckJob *, CheckContext *);
PRESERVE_NONE void done_left_side_iter(CheckJob *, CheckContext *);
static Continuation leftSideIterTable[] = {
left_side_iter<Node0>, left_side_iter<Node3>, left_side_iter<Node16>,
left_side_iter<Node48>, left_side_iter<Node256>};
FLATTEN PRESERVE_NONE void begin(CheckJob *job, CheckContext *context) {
PRESERVE_NONE void begin(CheckJob *job, CheckContext *context) {
job->lcp = longestCommonPrefix(job->begin.data(), job->end.data(),
std::min(job->begin.size(), job->end.size()));
if (job->lcp == int(job->begin.size()) &&
@@ -3355,8 +3346,8 @@ void common_prefix_iter(CheckJob *job, CheckContext *context) {
MUSTTAIL return keepGoing(job, context);
}
FLATTEN PRESERVE_NONE void done_common_prefix_iter(CheckJob *job,
CheckContext *context) {
PRESERVE_NONE void done_common_prefix_iter(CheckJob *job,
CheckContext *context) {
{
Arena arena;
@@ -3454,8 +3445,7 @@ FLATTEN PRESERVE_NONE void done_common_prefix_iter(CheckJob *job,
// Return true if the max version among all keys that start with key[:prefixLen]
// that are >= key is <= readVersion
template <class NodeT>
FLATTEN PRESERVE_NONE void left_side_iter(CheckJob *job,
CheckContext *context) {
PRESERVE_NONE void left_side_iter(CheckJob *job, CheckContext *context) {
assert(NodeT::kType == job->n->getType());
NodeT *n = static_cast<NodeT *>(job->n);
@@ -3570,8 +3560,7 @@ FLATTEN PRESERVE_NONE void left_side_iter(CheckJob *job,
MUSTTAIL return keepGoing(job, context);
}
FLATTEN PRESERVE_NONE void done_left_side_iter(CheckJob *job,
CheckContext *context) {
PRESERVE_NONE void done_left_side_iter(CheckJob *job, CheckContext *context) {
job->setResult(checkRangeRightSide(job->commonPrefixNode, job->end,
job->lcp + 1, job->readVersion,