summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-10-11 14:02:51 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-10-12 08:08:37 -0400
commit481467a5ceb07bb28bb6edb1569c86ff3cac315f (patch)
treeca08c2e91a2c5ef1bbeb5fb240c796736a8bbd57 /rts/Schedule.c
parent64a390d9c57b35edb6e7cf09b9324b43a3d08671 (diff)
downloadhaskell-481467a5ceb07bb28bb6edb1569c86ff3cac315f.tar.gz
rts: Don't hint inlining of appendToRunQueue
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.
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c55
1 files changed, 55 insertions, 0 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