1
0
Fork 0
Commit Graph

196 Commits

Author SHA1 Message Date
morgan 53a964a63d riscv32::swap: fix stack push/pop asm 2024-05-23 15:30:27 +08:00
occheung 3ecbe53f76 riscv32: env call on context switch 2021-10-08 11:00:30 +08:00
occheung 17ba0a3429 riscv32: align stack to 4k boundary 2021-10-08 10:59:40 +08:00
occheung 9748bb8af8 add riscv32 2021-08-20 17:42:16 +08:00
edef 099bc28867 Ensure arch:👿:StackPointer has defined representation 2019-11-08 01:20:00 +00:00
edef 17c41ce777 Use core::mem::ManuallyDrop instead of implementing our own NoDrop 2019-11-08 00:58:48 +00:00
Gerd Zellweger 5849a2d330 Replace simd with packed_simd
The simd crate no longer builds, as of Rust 1.33 nightly, due to the 
removal of compiler features that it depends on. packed_simd is the 
recommended replacement.
2019-11-08 00:53:38 +00:00
Gerd Zellweger cf299f8413 Fix AtomicUsize deprecation warning. 2019-02-08 15:04:26 +00:00
Gerd Zellweger ea15bf5e33 Remove cfg_target_vendor attribute. 2019-02-08 15:04:26 +00:00
Gerd Zellweger 9ca9c72e0e Fix to work with new allocator APIs. 2019-02-08 15:04:26 +00:00
Mark Swanson 1d97ab9d02 Support nightly-may-16-2018 2018-05-26 14:22:15 +00:00
edef b79dcf3d79 Handle liballoc changes 2017-09-10 11:50:21 +02:00
edef 87452b58e0 Remove NoDrop's unnecessary empty variant 2017-03-17 01:52:19 +01:00
edef 409451c32c Rename NoDrop's field to `inner` 2017-03-17 01:51:57 +01:00
edef df7f261ca6 Expose unsafe_unwrap
This at least ensures we don't have to needlessly leak generators in the
tests, and covers similar use cases for consumers of libfringe.
2017-03-16 22:40:20 +01:00
edef d49557a55a Require Stack to be 'static
Our strategy of leaking the Stack to ensure safety is only effective if
the lifetime of the underlying stack memory is controlled by the
destructor of the Stack. We don't add this bound to unsafe_new, so that
users who wish to provide the necessary guarantees themselves can do so.
2017-03-16 22:40:20 +01:00
edef 277e786d3f Panic when an unfinished Generator is dropped 2017-03-16 22:40:20 +01:00
edef 4813dd7411 Leak the stack if it's unsafe to drop it
We can't free the stack before the generator has returned, or been
unwound. Without unwinding, the only safe course of action is to leak
it.
2017-03-16 22:40:20 +01:00
edef 661872f725 Don't implement Send at all
On hosted platforms, libstd allows safely borrowing values from TLS with
'thread lifetime and without a Sync bound. As a result, we can't
guarantee that sending a generator across threads won't create dangling
references or data races. In freestanding environments, the notion of
thread-safety is likely to be defined by the consumer of libfringe,
so our Send bounds and implementation are unlikely to be meaningful
anyway.
2017-03-06 09:21:08 +01:00
edef 34ab0dc2cd Fix should_panic attributes 2017-02-25 14:24:36 +01:00
Amanieu d'Antras 74c4444a7f Inline the swap trampoline on x86_64 and AArch64 2016-11-02 00:15:15 -04:00
whitequark 243e9ffc6c Implement Eq on generator::State. 2016-10-01 18:25:32 -04:00
Amanieu d'Antras f9b6cd17f6 Allow Generator to have !Send inputs and outputs
close #55
2016-09-30 21:41:26 -04:00
Amanieu d'Antras fc4cdbf4f5 Clean up the stack implementations
close #54
2016-09-30 21:39:15 -04:00
edef 1783c25c46 Implement Send for Generator 2016-09-22 14:03:46 -04:00
edef 19ec5ef45b Make the passed Yielder borrow immutable [breaking-change]
Yielder::suspend only requires an immutable reference, and allowing
mem::replace on the yielder isn't very useful.
2016-09-22 14:03:46 -04:00
edef 045ad33785 Ensure that the Input/Output types outlive the generator [breaking-change]
Previously, it was possible to cause unsafety by sending a short-lived
value into or out of the generator.
2016-09-22 14:03:46 -04:00
edef 59f28e92cb Ensure that the closure outlives the generator [breaking-change]
Previously, it was possible to cause unsafety by having the closure
refer to values with lifetimes that weren't enclosed by the generator's
lifetime.
2016-09-22 14:03:46 -04:00
edef adb29eade7 Fix the variance of Input/Output 2016-09-22 13:43:34 -04:00
whitequark 809215921b Unbreak or1k.
close #53
2016-09-22 13:41:26 -04:00
edef 4e55e2b651 Use PhantomData-of-tuple instead of tuple-of-PhantomData 2016-09-22 13:02:35 -04:00
Amanieu d'Antras 40e955638e Add support for AArch64
close #43
2016-09-09 10:59:35 -04:00
Amanieu d'Antras fff625767c Clean up and simplify the implementation of generators 2016-09-09 10:59:35 -04:00
Amanieu d'Antras f7f209c1eb Add proper CFI annotations to the inline asm
This ensures that gdb is able to generate a correct backtrace when
stopped at any instruction in the inline asm.

It also makes backtraces accessible to tools that only track frame
pointer chains, like perf or dtrace.

close #49
2016-09-09 10:59:19 -04:00
whitequark 231bc3cc46 Yielder: use Cell internally to allow suspending via multiple borrows.
The use case is as follows: let's say I have a scheduler that uses
libfringe for context switching. A single thread may open several
sockets, each of which presents a std::io::Read interface, and
waiting in Read::read requires having a reference to the yielder
inside the socket.

This could be worked around with RefCell in the API consumer, but
there is no real reason to not implement it in libfringe.

close #48
2016-09-06 23:37:33 -04:00
whitequark f82d0e2c21 Bring back workarounds for Mach-O assembly syntax. 2016-09-04 07:18:55 -04:00
whitequark 491af39fc9 Radically simplify stack linking.
This commit:

  * Gets rid of 2nd init trampoline.
  * Gets rid of any custom CFI, instead using the standard CFI
    for target prologue.
  * Makes backtraces accessible to tools that only track frame
    pointer chains, like perf or dtrace.
  * Keeps the performance at the exact same level.
2016-09-04 07:18:55 -04:00
Amanieu d'Antras b1f5b7458f Pass the new stack pointer by value into the swap trampoline 2016-09-04 02:13:46 -04:00
Amanieu d'Antras 86e29b2baa Remove unnecessary "memory" clobbers for naked function asm 2016-09-04 02:13:46 -04:00
Amanieu d'Antras 38ff4126b6 Add missing inline asm clobbers for x86 and x86_64 2016-09-04 02:13:46 -04:00
Amanieu d'Antras fb9acb73f3 Use raw pointers instead of references to avoid aliasing issues 2016-09-04 02:13:46 -04:00
whitequark c6ece101e2 Expose fringe::STACK_ALIGNMENT, and make OwnedStack respect it. 2016-09-02 19:44:34 -04:00
whitequark 0ca4bc86ff doc: explicitly state the contracts of Stack and GuardedStack. 2016-09-02 14:51:29 -04:00
whitequark a1ea208652 arch/x86_64: hack to work around ld64 shortcomings on OS X.
fix #35, close #36
2016-08-31 20:25:00 -04:00
whitequark a733290359 arch: bring back clobbers for input operands.
This reverts a part of 365e40b. While it is not legal to clobber
the output register, it is legal and necessary to do this for inputs,
since we do not preserve them, and LLVM could have decided to
reuse them.

Thanks to @Amanieu for discovering this.
2016-08-31 14:17:54 -04:00
whitequark 248d7b16b5 arch/or1k: fix typo. 2016-08-31 14:17:54 -04:00
edef 1aa5ffdcd0 fix doc comment of Stack::limit 2016-08-30 18:30:58 -04:00
edef 1994ffee27 don't drop yielded values in the generator
fix #31
2016-08-30 18:17:52 -04:00
edef e47cb809f4 use valgrind_request from crates.io 2016-08-30 13:43:51 -04:00
whitequark 2d8cefcabc Do not simultaneously clobber registers passed into assembly.
This is not actually legal (although the restriction is not
documented anywhere), and is not caught by LLVM unless the codegen
option -verify-machineinstrs is specified. This option is now used
on Travis.

While not legal, this does not seem to result in invalid output
(although it creates an unnecessary spill); however, under extremely
specific circumstances (e.g. when a register scavenger is run under
severe pressure), this will result in a codegen crash, which is
how I found it.
2016-08-30 12:20:34 -04:00