Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OpenSK
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
koenigl2
OpenSK
Commits
7703ddb4
Commit
7703ddb4
authored
5 years ago
by
Guillaume Endignoux
Browse files
Options
Downloads
Patches
Plain Diff
Add comment about AtomicUsize.
parent
9f6207f5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
patches/libtock-rs/07-debug_allocations.patch
+7
-2
7 additions, 2 deletions
patches/libtock-rs/07-debug_allocations.patch
with
7 additions
and
2 deletions
patches/libtock-rs/07-debug_allocations.patch
+
7
−
2
View file @
7703ddb4
...
@@ -11,10 +11,10 @@ index 386a9ed..af3c5db 100644
...
@@ -11,10 +11,10 @@ index 386a9ed..af3c5db 100644
[dev-dependencies]
[dev-dependencies]
corepack = { version = "0.4.0", default-features = false, features = ["alloc"] }
corepack = { version = "0.4.0", default-features = false, features = ["alloc"] }
diff --git a/src/entry_point.rs b/src/entry_point.rs
diff --git a/src/entry_point.rs b/src/entry_point.rs
index 2fe5c40..
c978ee5
100644
index 2fe5c40..
545d163
100644
--- a/src/entry_point.rs
--- a/src/entry_point.rs
+++ b/src/entry_point.rs
+++ b/src/entry_point.rs
@@ -368,22 +368,
77
@@
pub unsafe extern "C" fn rust_start(app_start: usize, stacktop: usize, app_heap_
@@ -368,22 +368,
82
@@
pub unsafe extern "C" fn rust_start(app_start: usize, stacktop: usize, app_heap_
}
}
}
}
...
@@ -33,6 +33,11 @@ index 2fe5c40..c978ee5 100644
...
@@ -33,6 +33,11 @@ index 2fe5c40..c978ee5 100644
static mut HEAP: Heap = Heap::empty();
static mut HEAP: Heap = Heap::empty();
-struct TockAllocator;
-struct TockAllocator;
+// With the "debug_allocations" feature, we use `AtomicUsize` to store the
+// statistics because:
+// - it is `Sync`, so we can use it in a static object (the allocator),
+// - it implements interior mutability, so we can use it in the allocator
+// methods (that take an immutable `&self` reference).
+struct TockAllocator {
+struct TockAllocator {
+ #[cfg(feature = "debug_allocations")]
+ #[cfg(feature = "debug_allocations")]
+ count: AtomicUsize,
+ count: AtomicUsize,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment