Fix several issues with the web emulator

- Bump TeaVM version to fix issues with locales and our "export"
   generation.
 - Fix TComputerThread not requeuing correctly.
This commit is contained in:
Jonathan Coates 2023-11-15 13:12:31 +00:00
parent b343c01216
commit f8b7422294
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
4 changed files with 14 additions and 4 deletions

View File

@ -42,7 +42,6 @@ ## Using
url "https://squiddev.cc/maven/"
content {
includeGroup("cc.tweaked")
includeModule("org.squiddev", "Cobalt")
}
}
}

View File

@ -68,7 +68,7 @@ mixinGradle = "0.7.+"
nullAway = "0.9.9"
spotless = "6.21.0"
taskTree = "2.1.1"
teavm = "0.10.0-SQUID.1"
teavm = "0.10.0-SQUID.2"
vanillaGradle = "0.2.1-SNAPSHOT"
vineflower = "1.11.0"

View File

@ -35,6 +35,7 @@ local term = _ENV
-- @since 1.31
-- @usage
-- Redirect to a monitor on the right of the computer.
--
-- term.redirect(peripheral.wrap("right"))
term.redirect = function(target)
expect(1, target, "table")

View File

@ -28,6 +28,7 @@ public class TComputerThread implements ComputerScheduler {
private static final ArrayDeque<ExecutorImpl> executors = new ArrayDeque<>();
private static final TimerHandler callback = TComputerThread::workOnce;
private static boolean enqueued;
public TComputerThread(int threads) {
}
@ -38,6 +39,8 @@ public Executor createExecutor(Worker worker, MetricsObserver metrics) {
}
private static void workOnce() {
enqueued = false;
var executor = executors.poll();
if (executor == null) throw new IllegalStateException("Working, but executor is null");
@ -50,7 +53,14 @@ private static void workOnce() {
}
executor.afterWork();
if (!executors.isEmpty()) Callbacks.setImmediate(callback);
if (!executors.isEmpty()) enqueue();
}
private static void enqueue() {
if (enqueued) return;
enqueued = true;
Callbacks.setImmediate(callback);
}
@Override
@ -75,8 +85,8 @@ public void submit() {
if (onQueue) return;
onQueue = true;
if (executors.isEmpty()) Callbacks.setImmediate(callback);
executors.add(this);
enqueue();
}
void beforeWork() {