Commit Graph

191 Commits

Author SHA1 Message Date
whitequark
4b32c18f70 Rename Yielder::generate to Yielder::suspend.
This makes more sense, because "generate" implies *running*
a generator, not *returning* from a generator. That name was
a vestige of the time when libfringe only really provided a .next()
implementation, which made marginally more sense together with
.generate(), but it doesn't anymore when we have .resume().
2016-08-30 12:20:34 -04:00
edef
ef0225cacb add license field to Cargo.toml 2016-08-21 00:03:14 +02:00
edef
f21b8dc936 Update the license headers for MIT/Apache 2016-08-20 23:45:01 +02:00
edef
271c927c3f List specific authors in LICENSE-MIT, not just "the developers" 2016-08-20 23:41:10 +02:00
Corey Richardson
77f83e0d21 Relicense to dual MIT/Apache-2.0
Closes https://github.com/edef1c/libfringe/issues/23
2016-08-20 23:39:19 +02:00
whitequark
eb247666ba Explain how to use on bare metal in README. 2016-08-19 15:12:42 +02:00
whitequark
f8cf95f686 Implement SliceStack. 2016-08-19 15:12:42 +02:00
whitequark
e0ad79ea0c Add an OR1K port. 2016-08-19 15:12:42 +02:00
whitequark
d4b7c427c9 impl Iterator for Generator<Input=()>. 2016-08-13 13:38:04 +02:00
whitequark
145c18125a Explain how trampolines work. 2016-08-13 13:38:04 +02:00
whitequark
b79e7c0a9b Rename Stack::top() to Stack::base(), which is correct.
Fixes #25.
2016-08-13 13:38:04 +02:00
whitequark
7d5075edc2 Add more examples to README.
This also renames some functions for a mild increase in backtrace
clarity.
2016-08-13 13:38:04 +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
308df32ac2 Use a more semantically correct PhantomData field in Generator. 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
whitequark
23cf17865d Remove workaround for rust-lang/rust#25544. 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
40fbfdde0c Kill impl StackPointer.
That was a silly idea for a silly abstraction, and it brought no
improvement, only confusion. So, revert it.
2016-08-13 13:38:04 +02:00
edef
244db8490b Remove the badge for Windows CI too 2016-08-13 12:54:33 +02:00
edef
375fd03a16 Get rid of Windows CI (Appveyor) 2016-08-13 12:52:37 +02:00
edef
bb699c0f6e Allow inlining Generator::state 2016-08-13 12:52:12 +02:00
edef
375846bda5 Rewrite the FPE test to not use Context directly 2016-08-09 16:00:17 +02:00
edef
890e95b8a4 add Travis CI IRC notifications [skip ci] 2016-07-17 20:25:44 -04:00
edef
f44936f957 appveyor: generate a zip of target/ 2016-07-17 17:16:19 -04:00
edef
8c761d944f Fix Windows x64 ABI 2016-07-17 16:57:23 -04:00
edef
42f37c967e label the Travis/AppVeyor badges [skip ci] 2016-07-17 16:12:45 -04:00
edef
343108a3ae add AppVeyor badge [skip ci] 2016-07-17 16:11:02 -04:00
edef
3f8ed5b460 add appveyor.yml 2016-07-17 16:04:22 -04:00
edef
4f7ab38530 Remove copyright year
They're legally meaningless.
2016-07-17 14:12:56 -04:00
whitequark
15d2fbaf51 Add an inline hint on Generator::next().
This improves the generate benchmark by about 1ns.
2016-07-17 13:56:03 -04: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
whitequark
758088c673 Fix Stack::new(0). 2016-07-17 13:55:43 -04:00
whitequark
aa364056fd Add more documentation, and rephrase it elsewhere. 2016-07-16 20:54:47 -04:00
whitequark
ebd9ca8dec Allocate guard page under existing stack, not in it.
This fixes a segfault when the allocated stack is just one page long.

This also refactors the fringe::os module to use Result consistently.

close #22
2016-07-16 20:54:33 -04:00
John Ericson
75ca6f66e1 Move x86 trampoline to naked function
Close #19
2016-07-16 16:39:19 -04:00
John Ericson
1ea4b01eda Use mostly the same registers for consistency
The exception to this is %eax is used not %edi on x86 because its
caller-save
2016-07-16 16:39:14 -04:00
edef
bc184237cc rename simd -> context_simd
This fixes a spurious rustc warning.
2016-07-16 16:18:58 -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
whitequark
989b1d439c Remove "os" feature; use target-specific dependencies instead. 2016-07-16 15:04:07 -04:00
edef
0d7b3d7091 add Windows support to OsStack
Fix #18
2016-04-16 07:51:10 +02:00
edef
6284a22caa add fpsr, eflags for good measure
courtesy of @whitequark
2016-04-16 07:41:00 +02:00
edef
821d731803 format Cargo.toml as cargo would output it 2016-04-14 15:47:34 +02:00
John Ericson
35fb046fb5 Factor out common code between x86 and x86_64
Fix #17
2016-04-14 13:37:15 +02:00
John Ericson
c51290f8e7 Don't bring in std by mistake
Fix #16
2016-04-14 13:35:38 +02:00
John Ericson
65f4b0fd17 Turn the example into a test
Fix #14
2016-04-12 15:14:29 +02:00