shithub: front

Download patch

ref: 0a6bcc7b83d9b5fac12229cac57207b9dc91ba2f
parent: 605c0df143e172cff18162738ea142a2268e6aab
author: mia soweli <mia@soweli.net>
date: Wed Aug 13 14:57:37 EDT 2025

vl: atomic instruction scheduling

make extremely sure that atomic operations are never re-ordered
even if their results are otherwise unused.

--- a/sys/src/cmd/vl/sched.c
+++ b/sys/src/cmd/vl/sched.c
@@ -601,6 +601,15 @@
 		if(regoff(&sa->p.from) == regoff(&sb->p.from))
 			return 1;
 
+	/*
+	 * special case
+	 * atomic instructions cannot pass.
+	 */
+	if(sa->p.as == ALL || sb->p.as == ALL)
+		return 1;
+	if(sa->p.as == ASC || sb->p.as == ASC)
+		return 1;
+
 	x = (sa->set.cc & (sb->set.cc|sb->used.cc)) |
 		(sb->set.cc & sa->used.cc);
 	if(x) {
--