aboutsummaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2019-05-09 18:25:34 +0200
committerGravatar Jorge Aparicio <jorge@japaric.io> 2019-05-09 18:25:34 +0200
commit36073a63426e0955aaa3e0745a3b4e29aeb076e3 (patch)
treea8b3223555f259d35337e2a4097c362a16a3d55d /macros
parentbc024f197929be1ce7dac9e6cbf6672c3980437e (diff)
downloadrtic-36073a63426e0955aaa3e0745a3b4e29aeb076e3.tar.gz
rtic-36073a63426e0955aaa3e0745a3b4e29aeb076e3.tar.zst
rtic-36073a63426e0955aaa3e0745a3b4e29aeb076e3.zip
generate resource proxies only when needed
only `static mut` resources need proxies
Diffstat (limited to '')
-rw-r--r--macros/src/codegen.rs61
1 files changed, 32 insertions, 29 deletions
diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs
index 3fae75b7..c33ecf63 100644
--- a/macros/src/codegen.rs
+++ b/macros/src/codegen.rs
@@ -234,40 +234,43 @@ fn resources(
));
}
- if let Some(Ownership::Shared { ceiling }) = analysis.ownerships.get(name) {
- let ptr = if res.expr.is_none() {
- quote!(#name.as_mut_ptr())
- } else {
- quote!(&mut #name)
- };
-
- mod_resources.push(quote!(
- pub struct #name<'a> {
- priority: &'a Priority,
- }
+ // generate a resource proxy when needed
+ if res.mutability.is_some() {
+ if let Some(Ownership::Shared { ceiling }) = analysis.ownerships.get(name) {
+ let ptr = if res.expr.is_none() {
+ quote!(#name.as_mut_ptr())
+ } else {
+ quote!(&mut #name)
+ };
- impl<'a> #name<'a> {
- #[inline(always)]
- pub unsafe fn new(priority: &'a Priority) -> Self {
- #name { priority }
+ mod_resources.push(quote!(
+ pub struct #name<'a> {
+ priority: &'a Priority,
}
- #[inline(always)]
- pub unsafe fn priority(&self) -> &Priority {
- self.priority
+ impl<'a> #name<'a> {
+ #[inline(always)]
+ pub unsafe fn new(priority: &'a Priority) -> Self {
+ #name { priority }
+ }
+
+ #[inline(always)]
+ pub unsafe fn priority(&self) -> &Priority {
+ self.priority
+ }
}
- }
- ));
+ ));
- const_app.push(impl_mutex(
- app,
- cfgs,
- true,
- name,
- quote!(#ty),
- *ceiling,
- ptr,
- ));
+ const_app.push(impl_mutex(
+ app,
+ cfgs,
+ true,
+ name,
+ quote!(#ty),
+ *ceiling,
+ ptr,
+ ));
+ }
}
}
3ec7c919be48d5af58005e89a9d'/>
path: root/bench/snippets/write-file-huge.mjs (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2023-09-01keep export star as (#4451)Gravatar Dylan Conway 1-14/+0
2023-09-01bun-vscode 0.0.8Gravatar Colin McDonnell 3-41/+39
2023-09-01Update commandsGravatar Colin McDonnell 3-4/+6
2023-09-01fix `Bun.serve` with tls and `Bun.file` (#4450)Gravatar Dylan Conway 3-14/+40
2023-09-01exclusive maxGravatar Dylan Conway 1-1/+1
2023-09-01Fix debug console from appears on startGravatar Ashcon Partovi 2-2/+5
2023-09-01Add configuration options to extensionGravatar Ashcon Partovi 5-5/+137
2023-09-01Fix run button starting cwd at /Gravatar Ashcon Partovi 1-0/+2
2023-09-01fix(runtime): fix dns_resolver crash (#4435)Gravatar dave caruso 3-17/+19
2023-09-01Fix background colorGravatar Ashcon Partovi 1-2/+3
2023-09-01Allow older versions of VSCodeGravatar Ashcon Partovi 2-6/+5
2023-09-01Fix README for extensionGravatar Ashcon Partovi 2-7/+12
2023-09-01Update VSCode extensionGravatar Ashcon Partovi 1-3/+4
2023-09-01Fix breakpoint on entry for extensionGravatar Ashcon Partovi 5-18/+15
2023-09-01Add Bun.canReload event to inspectorGravatar Ashcon Partovi 2-0/+17
2023-08-31JavaScript Debug Terminal == Bun TerminalGravatar Ashcon Partovi 1-0/+32
2023-08-31fix(runtime): `fs.cp` edge cases (#4439)Gravatar dave caruso 2-8/+44
2023-08-31only set initial debugger breakpoint once (#4441)Gravatar Dylan Conway 1-2/+11
2023-08-31Make breakpoints faster in VSCode extensionGravatar Ashcon Partovi 1-241/+327
2023-08-31`bun install` correctly join dependency URLs (#4421)Gravatar Julian 6-64/+243
2023-08-31get name if not provided in `FormData.append` (#4434)Gravatar Dylan Conway 4-5/+45
2023-08-31Fix vscode debug terminalGravatar Ashcon Partovi 1-21/+0