From 2d25a8434754a2294a9cffdc1cf712799b7d18c7 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 1 Dec 2022 14:19:52 -0600 Subject: [PATCH] Simplify global state management in adapter (#13) * Simplify global state management in adapter I was looking recently to implement args-related syscalls but that would require yet-more globals and yet-more state to be managed. Instead of adding a slew of new globals for this which are all manually kept in sync I opted to instead redesign how global state is managed in the adapter. The previous multiple `global`s are all removed in favor of just one, as sort of a "tls slot" of sorts. This one remaining slot points to a one-time-allocated `State` object which internally stores information like buffer metadata, fd information, etc. Along the way I've also simplified syscalls with new methods and `?`-using closures. * Turn off incremental for dev builds Helps with CGU splitting and ensuring that appropriate code is produced even without `--release`. * Review comments * Add accessors with specific errors * Update handling of `*_global_ptr` * Update internal mutability around path buffer Use an `UnsafeCell` layering to indicate that mutation may happen through `&T`. --- test-programs/macros/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-programs/macros/build.rs b/test-programs/macros/build.rs index 25061418baa7..43ef1f056279 100644 --- a/test-programs/macros/build.rs +++ b/test-programs/macros/build.rs @@ -9,7 +9,7 @@ fn main() { let mut components = Vec::new(); - println!("cargo:rerun-if-changed=../../"); + println!("cargo:rerun-if-changed=../../src"); let mut cmd = Command::new("cargo"); cmd.arg("build") .arg("--release")