Commit Graph

16 Commits

Author SHA1 Message Date
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 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 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
edef f21b8dc936 Update the license headers for MIT/Apache 2016-08-20 23:45:01 +02:00
whitequark e0ad79ea0c Add an OR1K port. 2016-08-19 15:12:42 +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 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
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
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