Commit Graph

58 Commits

Author SHA1 Message Date
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
Amanieu d'Antras fc4cdbf4f5 Clean up the stack implementations
close #54
2016-09-30 21:39:15 -04:00
Amanieu d'Antras fff625767c Clean up and simplify the implementation of generators 2016-09-09 10:59:35 -04:00
whitequark c6ece101e2 Expose fringe::STACK_ALIGNMENT, and make OwnedStack respect it. 2016-09-02 19:44:34 -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 5a77a01863 Implement OwnedStack. 2016-08-30 12:20:34 -04:00
edef f21b8dc936 Update the license headers for MIT/Apache 2016-08-20 23:45:01 +02:00
whitequark f8cf95f686 Implement SliceStack. 2016-08-19 15:12:42 +02:00
whitequark f34ddc6805 Don't use core::intrinsics.
The core::intrinsics::unreachable() we used at the end of every naked
function is essentially pointless, as #[naked] implies that intrinsic
at the end of the function. rustc currently does not implement that
behavior (rust-lang/rust#32487), but it is a bug. On top of that,
anything except a single asm!() in naked functions is likely to be
disallowed in the future (rust-lang/rust#32490).

A nice side effect is that we avoid the core_intrinsics feature,
which will be never stabilized, though neither asm nor
naked_functions are likely to be stabilized soon.
2016-08-13 13:38:04 +02:00
whitequark ddbf9a5afe Reimplement Generator to pass both input and output values around. 2016-08-13 13:38:04 +02:00
whitequark 302ceef10a Clarify the Windows situation.
Also, remove the Windows OsStack implementation. It will not ever
be useful in libfringe, as even if we add support for Windows
using fibers, the OS allocates stacks for fibers and we needn't
do it manually.
2016-08-13 13:38:04 +02:00
whitequark a5d3430e63 Make Generator safe in presence of destructors. 2016-08-13 13:38:04 +02:00
edef ca43ba0498 Make fringe::Context private. 2016-08-13 13:38:04 +02:00
edef b1a6b17d0a Move the Context tests and benches into src/
This concludes preparations for making Context private again.
2016-08-13 13:38:04 +02:00
whitequark 892a7696ec Allow unwinding to propagate across a context swap.
The main purpose of this is having nice backtraces in gdb, although
it also slightly simplifies poisoning state of the API consumers
after a panic.
2016-08-13 13:38:04 +02:00
whitequark 16c674b4f4 Implement the GuardedStack marker trait. 2016-07-17 13:56:03 -04:00
whitequark 7ffad26cfd Implement the safe Generator abstraction.
close #24
2016-07-17 13:55:56 -04:00
John Ericson 75ca6f66e1 Move x86 trampoline to naked function
Close #19
2016-07-16 16:39:19 -04:00
whitequark cbe136b762 Completely rework fringe::Context and fringe::arch.
The new design concerns itself with one thing and exactly one thing:
passing values back and forth with an extern "C" function.
This allows to simplify fringe::arch into a single primitive, swap.

Close #21
2016-07-16 15:04:15 -04:00
edef b986931817 remove copyright years
They're obnoxious to update, and I'm told they have no legal value.
2016-03-22 08:25:23 +01:00
edef bb2b92bf6b remove feature attributes for stable stuff 2016-03-16 00:14:09 +01:00
John Ericson 5411f10460 use Void to ensure closure diverges 2015-08-26 00:51:18 +02:00
edef e290a8bbaf remove `extern crate core` and prelude imports
the latest Rust nightly makes this unnecessary
2015-08-26 00:19:53 +02:00
edef 189edae3cf add #![feature(core_prelude)] 2015-07-20 20:54:41 -04:00
edef d0ee592ba1 use the libc crate from cargo 2015-04-23 01:14:01 +02:00
edef 0bebfae21d more docs! 2015-04-16 10:15:00 -04:00
edef d627f0d725 big rename — we're libfringe now 2015-04-16 08:11:12 -04:00
edef 2266da2f8d rejig lib.rs a little 2015-04-16 07:45:14 -04:00
edef fe490275fa move os::Stack behind the facade, to OsStack 2015-04-16 07:44:07 -04:00
edef ff25697444 remove StackSource
Nothing in this library took StackSources, and it's probably too
high-level a concept to include here. Maybe later.
2015-04-16 07:42:16 -04:00
edef cbfb62e62f only expose context and stack through the facade
It's fairly pointless to have submodules when there are only three
items.
2015-04-16 07:25:05 -04:00
edef 6f750ab484 move all OS-related code into src/os 2015-04-16 06:42:31 -04:00
edef 997a4a7765 move architecture specifics into arch directory 2015-04-16 06:17:03 -04:00
edef f24e8e7911 add license headers to every file 2015-04-16 06:08:44 -04:00
edef 52c0c92cd8 move OS specifics into sys 2015-04-16 05:49:34 -04:00
edef 2760a0a7aa move Valgrind handling into Context
fix #3
This takes all Valgrind functionality private again.
Valgrind stack registrations are now associated with a Context, not with
a Stack. This makes sense, since it's only actually a stack when a
Context is running on it. Perhaps Valgrind will even be able to detect
early stack frees now.
2015-04-16 02:59:58 -04:00
edef 7e0b126f42 separate all the libc interaction out per OS
We're now handling more of this ourselves, and leaving less to libstd.
Hopefully, we'll eventually break free of libstd, leaving a
highly-focused low-level library that retains all its conveniences in
freestanding environments.
2015-04-16 02:16:08 -04:00
edef db6a2ff89b factor Valgrind support out and expose it
Now other Stack / StackSource implementations can use the same Valgrind
code. Ref #3.
2015-04-15 22:25:52 -04:00
edef 31652d7b8f limit compilation of arch to x86_64
the current code only supports x86_64 (#1), and we want to fail hard on
any other architecture for now.
2015-04-15 21:52:08 -04:00
edef 6d56cc593e feature-flag os, but leave it enabled by default 2015-04-15 21:51:37 -04:00
edef 8dc53c3125 make Context::new take a stack, instead of creating one 2015-04-15 19:35:27 -04:00
edef 27318bc271 rename platform to os 2015-04-15 19:35:27 -04:00
edef 5ae54da9c2 make context public 2015-04-15 19:35:27 -04:00
edef 9855084890 make stack public 2015-04-15 19:35:27 -04:00
edef a39493d740 rewrite platform.rs to use mmap directly 2015-03-27 02:52:25 -04:00
edef b0dcc65304 Rust updates 2015-03-03 01:53:04 -05:00
edef e51cfa1b7b no_std is a feature flag now 2015-02-23 23:13:25 -05:00
edef a54e573073 Rust updates 2015-02-02 14:17:23 -05:00
edef 3f76c4baea use std in test configurations
this makes `cargo test` and `cargo bench` work cleanly, for one.
2015-01-14 11:27:43 +01:00
edef 299a0a5d98 complete rewrite!
featuring 7ns inlineable context switches, no more separately-built
assembly objects, and a vastly nicer interface.
incontext/outcontext are no more, context switch calls now take a single
context structure, which functions as both.
everything now also functions without any heap allocations -- for the
context setup, only an FnOnce() value is necessary.
2015-01-14 11:27:43 +01:00