Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement libstd. #17

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
65e131e
Prepare 1.50 beta
Mark-Simulacrum Dec 29, 2020
d17ca57
Update fulldeps test
Mark-Simulacrum Oct 7, 2020
57950a2
Ignore failures of RLS on aarch64 Windows
Mark-Simulacrum Nov 17, 2020
483c1a8
Permit unstable features during PGO benchmarks
Mark-Simulacrum Dec 29, 2020
05b6023
Auto merge of #80479 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
bors Dec 29, 2020
bfceef0
Bootstrap from released compiler
Mark-Simulacrum Dec 31, 2020
48233ac
de-stabilize unsized raw ptr methods for Weak
RalfJung Dec 27, 2020
31d03c4
Use package name for top-level directory in bare tarballs
Mark-Simulacrum Dec 26, 2020
8da2799
Make recursion limit fatal in project
matthewjasper Dec 20, 2020
89164cd
Prevent caching projections in the case of cycles
matthewjasper Dec 20, 2020
25b3db3
Auto merge of #80560 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
bors Dec 31, 2020
70fced0
Merge commit '4bd77a19f39165fe9b8be2f7271d4197bd4f42eb' into beta
flip1995 Jan 4, 2021
ff59982
Auto merge of #80680 - flip1995:clippy_backport, r=Mark-Simulacrum
bors Jan 5, 2021
914bed4
[beta] Update cargo
ehuss Jan 13, 2021
ea20aa2
Auto merge of #80975 - ehuss:update-beta-cargo, r=Mark-Simulacrum
bors Jan 14, 2021
78cd953
update RLS and rustfmt
calebcartwright Jan 20, 2021
33b84bb
Auto merge of #81201 - calebcartwright:beta, r=Mark-Simulacrum
bors Jan 20, 2021
59b6b11
Fix handling of malicious Readers in read_to_end
sfackler Jan 11, 2021
2fe7ddc
clean up control flow
sfackler Jan 11, 2021
e73125e
make check a bit more clear
sfackler Jan 11, 2021
2eef2e2
clarify docs a bit
sfackler Jan 11, 2021
44a1f09
bootstrap: extract from any compression algorithm during distcheck
pietroalbini Dec 30, 2020
4e4636d
bootstrap: never delete the tarball temporary directory
pietroalbini Dec 30, 2020
14fa726
bootstrap: change the dist outputs to GeneratedTarball
pietroalbini Dec 30, 2020
13cd768
bootstrap: use the correct paths during ./x.py install
pietroalbini Dec 30, 2020
4050e27
bootstrap: fix x.py install not working with relative prefix
pietroalbini Jan 7, 2021
96a00a9
Update mdbook
ehuss Jan 4, 2021
5a4852a
rustdoc: Render visibilities succinctly
camelid Dec 25, 2020
9c4494c
Fix bugs; fix and add tests
camelid Dec 25, 2020
2ea0fa5
Handle `pub(super)`
camelid Dec 25, 2020
76d2603
Prefer `pub(crate)` over no modifier
camelid Dec 26, 2020
c73576a
Merge `pub-restricted` and `visibility` test
camelid Dec 26, 2020
c7a85ca
Add missing code to `find_closest_parent_module`
camelid Dec 26, 2020
0c127b3
Simplify loop and remove old debugging code
camelid Dec 26, 2020
69e1722
Extract local variable
camelid Dec 26, 2020
e9ae18d
Update `find_nearest_parent_module`
camelid Dec 31, 2020
8f0ce5d
Remove FIXME
camelid Dec 31, 2020
dc7eb41
Small refactor
camelid Dec 31, 2020
0a3048d
Add note on panic behavior
camelid Dec 31, 2020
6ec4c71
Add FIXME for visibility of a module
camelid Dec 31, 2020
d239ea6
Add `@!has` checks to ensure private items don't have `pub`
camelid Dec 31, 2020
1cd0303
Auto merge of #81151 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
bors Jan 20, 2021
f86b143
Auto merge of #81762 - pietroalbini:fix-install-msys2, r=m-ou-se
bors Feb 4, 2021
567eb04
Auto merge of #81055 - matthewjasper:non-fatal-overflow, r=nikomatsakis
bors Jan 28, 2021
f6b8e2b
Rollup merge of #81532 - estebank:ice-ice-baby, r=pnkfelix
m-ou-se Feb 3, 2021
3b03446
Rollup merge of #81556 - nikomatsakis:forbidden-lint-groups-lint, r=p…
m-ou-se Feb 4, 2021
d1eff4c
[beta] Update cargo
ehuss Feb 4, 2021
7906dc0
Rollup merge of #81288 - camelid:fix-trait-item-vis, r=jyn514
jonas-schievink Jan 23, 2021
e364d4a
Auto merge of #81229 - m-ou-se:solaris-workaround, r=pietroalbini
bors Jan 20, 2021
78e57dc
Rollup merge of #81767 - exrook:layout-error-stability, r=Mark-Simula…
m-ou-se Feb 5, 2021
eba5432
Auto merge of #81257 - pnkfelix:issue-80949-short-term-resolution-via…
bors Feb 5, 2021
fc81b7c
Rename `panic_fmt` lint to `non_fmt_panic`.
m-ou-se Feb 2, 2021
2efd070
Auto merge of #81774 - ehuss:beta-backports, r=ehuss
bors Feb 6, 2021
fe8e0c5
backport release notes from master
pietroalbini Feb 8, 2021
94c439b
lexer: Avoid some span arithmetic in `emit_unescape_error`
petrochenkov Jan 24, 2021
2602fa0
this is 1.50.0 stable
pietroalbini Feb 8, 2021
690501e
Auto merge of #81878 - pietroalbini:stable-1.50.0, r=pietroalbini
bors Feb 8, 2021
facc68d
bootstrap: Locate llvm-dwp based on llvm-config bindir
dtolnay Feb 10, 2021
a7f4cce
bootstrap: fix wrong docs installation path
pietroalbini Feb 10, 2021
cb75ad5
Auto merge of #81963 - pietroalbini:stable-1.50.0-pre2, r=pietroalbini
bors Feb 10, 2021
41927a1
Use llvm submodule with Xtensa arch support.
MabezDev Jan 17, 2021
e05a6bc
Teach rustc about the Xtensa arch.
MabezDev Sep 12, 2020
0c11a48
Teach rustc about the Xtensa call ABI.
MabezDev Sep 12, 2020
bc0e24c
Add some Xtensa targets
MabezDev Sep 12, 2020
dc4254e
Make `libstd` compile.
reitermarkus Dec 4, 2019
68c9626
Delete `ext/net.rs`.
reitermarkus Mar 5, 2021
bc4e162
Fix `net.rs`.
reitermarkus Mar 5, 2021
f10b293
Fix `target_family`.
reitermarkus Mar 5, 2021
adee687
Fix compilation.
reitermarkus Mar 5, 2021
620c9d5
`compare_exchange_weak` doesn't work.
reitermarkus Mar 6, 2021
6686577
`memalign` is now implemented.
reitermarkus Mar 6, 2021
de64fd9
Refactor `Condvar`.
reitermarkus Mar 6, 2021
94bdeff
Simplify `process` stubs.
reitermarkus Mar 6, 2021
d045009
Use `debug_assertions`.
reitermarkus Mar 6, 2021
b2c8c70
Update `ned_fd`.
reitermarkus Mar 6, 2021
a44476a
Revert some changes.
reitermarkus Mar 6, 2021
90ba40b
Update formatting.
reitermarkus Mar 7, 2021
8304726
Simplify `thread_local_key`.
reitermarkus Mar 7, 2021
c7379a0
Fix whitespace.
reitermarkus Mar 7, 2021
5b30ae1
Fix `Condvar`.
reitermarkus Mar 7, 2021
ca93ffd
`clock_t` depends on `newlib`.
reitermarkus Mar 11, 2021
d1ec22f
`memalign` depends on `newlib`.
reitermarkus Mar 11, 2021
9add941
Filesystem functions depend on `newlib`.
reitermarkus Mar 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor Condvar.
  • Loading branch information
reitermarkus committed Mar 6, 2021
commit de64fd96b8277493968d3e447baaeb04296b5ca5
2 changes: 0 additions & 2 deletions library/std/src/sys/unix/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ impl Condvar {
target_os = "ios",
target_os = "l4re",
target_os = "android",
target_os = "freertos",
target_os = "redox"
))]
pub unsafe fn init(&mut self) {}
Expand All @@ -40,7 +39,6 @@ impl Condvar {
target_os = "ios",
target_os = "l4re",
target_os = "android",
target_os = "freertos",
target_os = "redox"
)))]
pub unsafe fn init(&mut self) {
Expand Down
65 changes: 35 additions & 30 deletions library/std/src/sys/unix/freertos/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,27 @@ unsafe impl Sync for Condvar {}

impl Condvar {
pub const fn new() -> Condvar {
// Might be moved and address is changing it is better to avoid
// initialization of potentially opaque OS data before it landed
Condvar {
lock: unsafe { ReentrantMutex::uninitialized() },
waiter_list: UnsafeCell::new(None),
}
}

#[inline]
pub unsafe fn init(&mut self) {}

#[inline]
unsafe fn init_waiter_list(&self) {
if (*self.waiter_list.get()).is_none() {
(*self.waiter_list.get()) = Some(VecDeque::new());
}
pub unsafe fn init(&mut self) {
self.waiter_list.get_mut().replace(VecDeque::new());
}

#[inline]
pub unsafe fn notify_one(&self) {
self.lock.lock();

self.init_waiter_list();
let waiter_list = (&*self.waiter_list.get()).as_ref().unwrap();
if let Some(&waiter) = waiter_list.front() {
xSemaphoreGive(waiter);
if let Some(waiter_list) = (&*self.waiter_list.get()).as_ref() {
if let Some(&waiter) = waiter_list.front() {
xSemaphoreGive(waiter);
}
} else {
core::hint::unreachable_unchecked();
}

self.lock.unlock();
Expand All @@ -52,10 +47,12 @@ impl Condvar {
pub unsafe fn notify_all(&self) {
self.lock.lock();

self.init_waiter_list();
let waiter_list = (&*self.waiter_list.get()).as_ref().unwrap();
for &waiter in waiter_list {
xSemaphoreGive(waiter);
if let Some(waiter_list) = (&*self.waiter_list.get()).as_ref() {
for &waiter in waiter_list {
xSemaphoreGive(waiter);
}
} else {
core::hint::unreachable_unchecked();
}

self.lock.unlock();
Expand Down Expand Up @@ -88,9 +85,11 @@ impl Condvar {

self.lock.lock();

self.init_waiter_list();
let waiter_list = (&mut *self.waiter_list.get()).as_mut().unwrap();
waiter_list.push_back(waiter);
if let Some(waiter_list) = (&mut *self.waiter_list.get()).as_mut() {
waiter_list.push_back(waiter);
} else {
core::hint::unreachable_unchecked();
}

self.lock.unlock();

Expand All @@ -104,18 +103,19 @@ impl Condvar {

self.lock.lock();

let waiter_list = (&mut *self.waiter_list.get()).as_mut().unwrap();
let deleted_waiter = if let Some(index) = waiter_list.iter().position(|&w| w == waiter) {
waiter_list.remove(index)
if let Some(waiter_list) = (&mut *self.waiter_list.get()).as_mut() {
if let Some(index) = waiter_list.iter().position(|&w| w == waiter) {
waiter_list.remove(index);
} else {
core::hint::unreachable_unchecked();
}
} else {
None
};
core::hint::unreachable_unchecked();
}

self.lock.unlock();

if let Some(deleted_waiter) = deleted_waiter {
vSemaphoreDelete(deleted_waiter);
}
vSemaphoreDelete(waiter);

mutex.lock();

Expand All @@ -128,12 +128,17 @@ impl Condvar {

#[inline]
pub unsafe fn destroy(&self) {
#[cfg(debug)]
{
self.lock.lock();

if let Some(waiter_list) = (&*self.waiter_list.get()).as_ref() {
assert!(waiter_list.is_empty());
if let Some(waiter_list) = (&*self.waiter_list.get()).as_mut() {
debug_assert!(waiter_list.is_empty());
} else {
core::hint::unreachable_unchecked();
}

self.lock.unlock();
}
}
}