diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-10-11 14:02:51 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2022-10-11 14:13:02 -0400 |
commit | 3bc1e289bb15f272bdcdc131b06a90dc0dde83cf (patch) | |
tree | 5b1532ec679280f387e649e471e60beba0c79183 | |
parent | dce9f320ce7275fa97f49abef604abbc3b0f9a9c (diff) | |
download | haskell-wip/drop-inlines.tar.gz |
rts: Don't hint inlining of appendToRunQueuewip/drop-inlines
These hints have resulted in compile-time warnings due to failed
inlinings for quite some time. Moreover, it's quite unlikely that
inlining them is all that beneficial given that they are rather sizeable
functions.
Resolves #22280.
-rw-r--r-- | rts/Schedule.c | 55 | ||||
-rw-r--r-- | rts/Schedule.h | 57 |
2 files changed, 58 insertions, 54 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c index bc0e7d3acf..028578d6dc 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -2915,6 +2915,61 @@ deleteThread_(StgTSO *tso) } #endif +/* + * Run queue manipulation + */ + +void +appendToRunQueue (Capability *cap, StgTSO *tso) +{ + ASSERT(tso->_link == END_TSO_QUEUE); + if (cap->run_queue_hd == END_TSO_QUEUE) { + cap->run_queue_hd = tso; + tso->block_info.prev = END_TSO_QUEUE; + } else { + setTSOLink(cap, cap->run_queue_tl, tso); + setTSOPrev(cap, tso, cap->run_queue_tl); + } + cap->run_queue_tl = tso; + cap->n_run_queue++; +} + +void +pushOnRunQueue (Capability *cap, StgTSO *tso) +{ + setTSOLink(cap, tso, cap->run_queue_hd); + tso->block_info.prev = END_TSO_QUEUE; + if (cap->run_queue_hd != END_TSO_QUEUE) { + setTSOPrev(cap, cap->run_queue_hd, tso); + } + cap->run_queue_hd = tso; + if (cap->run_queue_tl == END_TSO_QUEUE) { + cap->run_queue_tl = tso; + } + cap->n_run_queue++; +} + +StgTSO *popRunQueue (Capability *cap) +{ + ASSERT(cap->n_run_queue > 0); + StgTSO *t = cap->run_queue_hd; + ASSERT(t != END_TSO_QUEUE); + cap->run_queue_hd = t->_link; + + StgTSO *link = RELAXED_LOAD(&t->_link); + if (link != END_TSO_QUEUE) { + link->block_info.prev = END_TSO_QUEUE; + } + RELAXED_STORE(&t->_link, END_TSO_QUEUE); // no write barrier req'd + + if (cap->run_queue_hd == END_TSO_QUEUE) { + cap->run_queue_tl = END_TSO_QUEUE; + } + cap->n_run_queue--; + return t; +} + + /* ----------------------------------------------------------------------------- raiseExceptionHelper diff --git a/rts/Schedule.h b/rts/Schedule.h index 5aaafd9d88..eda0aa3f79 100644 --- a/rts/Schedule.h +++ b/rts/Schedule.h @@ -136,67 +136,16 @@ void resurrectThreads (StgTSO *); * NOTE: tso->link should be END_TSO_QUEUE before calling this macro. * ASSUMES: cap->running_task is the current task. */ -EXTERN_INLINE void -appendToRunQueue (Capability *cap, StgTSO *tso); - -EXTERN_INLINE void -appendToRunQueue (Capability *cap, StgTSO *tso) -{ - ASSERT(tso->_link == END_TSO_QUEUE); - if (cap->run_queue_hd == END_TSO_QUEUE) { - cap->run_queue_hd = tso; - tso->block_info.prev = END_TSO_QUEUE; - } else { - setTSOLink(cap, cap->run_queue_tl, tso); - setTSOPrev(cap, tso, cap->run_queue_tl); - } - cap->run_queue_tl = tso; - cap->n_run_queue++; -} +void appendToRunQueue (Capability *cap, StgTSO *tso); /* Push a thread on the beginning of the run queue. * ASSUMES: cap->running_task is the current task. */ -EXTERN_INLINE void -pushOnRunQueue (Capability *cap, StgTSO *tso); - -EXTERN_INLINE void -pushOnRunQueue (Capability *cap, StgTSO *tso) -{ - setTSOLink(cap, tso, cap->run_queue_hd); - tso->block_info.prev = END_TSO_QUEUE; - if (cap->run_queue_hd != END_TSO_QUEUE) { - setTSOPrev(cap, cap->run_queue_hd, tso); - } - cap->run_queue_hd = tso; - if (cap->run_queue_tl == END_TSO_QUEUE) { - cap->run_queue_tl = tso; - } - cap->n_run_queue++; -} +void pushOnRunQueue (Capability *cap, StgTSO *tso); /* Pop the first thread off the runnable queue. */ -INLINE_HEADER StgTSO * -popRunQueue (Capability *cap) -{ - ASSERT(cap->n_run_queue > 0); - StgTSO *t = cap->run_queue_hd; - ASSERT(t != END_TSO_QUEUE); - cap->run_queue_hd = t->_link; - - StgTSO *link = RELAXED_LOAD(&t->_link); - if (link != END_TSO_QUEUE) { - link->block_info.prev = END_TSO_QUEUE; - } - RELAXED_STORE(&t->_link, END_TSO_QUEUE); // no write barrier req'd - - if (cap->run_queue_hd == END_TSO_QUEUE) { - cap->run_queue_tl = END_TSO_QUEUE; - } - cap->n_run_queue--; - return t; -} +StgTSO *popRunQueue (Capability *cap); INLINE_HEADER StgTSO * peekRunQueue (Capability *cap) |