about summary refs log tree commit diff
path: root/src/libcore/intrinsics.rs
AgeCommit message (Collapse)AuthorLines
2016-05-16core::intrinsics: fix typo noted during review.Felix S. Klock II-1/+1
2016-05-16Adding magic `rustc_peek` intrinsic that other code can repurpose toFelix S. Klock II-0/+10
its own needs based on attributes attached to the function where it appears.
2016-05-01docs: Changed docs for `size_of` to describe size as a stride offsetTaylor Cramer-5/+2
Current description of `std::mem::size_of` is ambiguous, and the `std::intrinsics::size_of` description incorrectly defines size as the number of bytes necessary to exactly overwrite a value, not including the padding between elements necessary in a vector or structure.
2016-04-19mk: Bootstrap from stable instead of snapshotsAlex Crichton-25/+0
This commit removes all infrastructure from the repository for our so-called snapshots to instead bootstrap the compiler from stable releases. Bootstrapping from a previously stable release is a long-desired feature of distros because they're not fans of downloading binary stage0 blobs from us. Additionally, this makes our own CI easier as we can decommission all of the snapshot builders and start having a regular cadence to when we update the stage0 compiler. A new `src/etc/get-stage0.py` script was added which shares some code with `src/bootstrap/bootstrap.py` to read a new file, `src/stage0.txt`, which lists the current stage0 compiler as well as cargo that we bootstrap from. This script will download the relevant `rustc` package an unpack it into `$target/stage0` as we do today. One problem of bootstrapping from stable releases is that we're not able to compile unstable code (e.g. all the `#![feature]` directives in libcore/libstd). To overcome this we employ two strategies: * The bootstrap key of the previous compiler is hardcoded into `src/stage0.txt` (enabled as a result of #32731) and exported by the build system. This enables nightly features in the compiler we download. * The standard library and compiler are pinned to a specific stage0, which doesn't change, so we're guaranteed that we'll continue compiling as we start from a known fixed source. The process for making a release will also need to be tweaked now to continue to cadence of bootstrapping from the previous release. This process looks like: 1. Merge `beta` to `stable` 2. Produce a new stable compiler. 3. Change `master` to bootstrap from this new stable compiler. 4. Merge `master` to `beta` 5. Produce a new beta compiler 6. Change `master` to bootstrap from this new beta compiler. Step 3 above should involve very few changes as `master` was previously bootstrapping from `beta` which is the same as `stable` at that point in time. Step 6, however, is where we benefit from removing lots of `#[cfg(stage0)]` and get to use new features. This also shouldn't slow the release too much as steps 1-5 requires little work other than waiting and step 6 just needs to happen at some point during a release cycle, it's not time sensitive. Closes #29555 Closes #29557
2016-03-20Update snapshots to 2016-03-18 (235d774).Eduard Burtescu-23/+14
2016-03-19Auto merge of #32244 - Amanieu:compare_exchange_result, r=alexcrichtonbors-4/+20
Change compare_exchange to return a Result<T, T> As per the discussion in #31767 I also changed the feature name from `extended_compare_and_swap` to `compare_exchange`. r? @alexcrichton
2016-03-19Change compare_exchange to return a Result<T, T>Amanieu d'Antras-4/+20
2016-03-18Add intrinsics for float arithmetic with `fast` flag enabledUlrik Sverdrup-0/+26
`fast` a.k.a UnsafeAlgebra is the flag for enabling all "unsafe" (according to llvm) float optimizations. See LangRef for more information http://llvm.org/docs/LangRef.html#fast-math-flags Providing these operations with less precise associativity rules (for example) is useful to numerical applications. For example, the summation loop: let sum = 0.; for element in data { sum += *element; } Using the default floating point semantics, this loop expresses the floats must be added in a sequence, one after another. This constraint is usually completely unintended, and it means that no autovectorization is possible.
2016-02-29std: Stabilize APIs for the 1.8 releaseAlex Crichton-1/+1
This commit is the result of the FCPs ending for the 1.8 release cycle for both the libs and the lang suteams. The full list of changes are: Stabilized * `braced_empty_structs` * `augmented_assignments` * `str::encode_utf16` - renamed from `utf16_units` * `str::EncodeUtf16` - renamed from `Utf16Units` * `Ref::map` * `RefMut::map` * `ptr::drop_in_place` * `time::Instant` * `time::SystemTime` * `{Instant,SystemTime}::now` * `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier` * `{Instant,SystemTime}::elapsed` * Various `Add`/`Sub` impls for `Time` and `SystemTime` * `SystemTimeError` * `SystemTimeError::duration` * Various impls for `SystemTimeError` * `UNIX_EPOCH` * `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign` Deprecated * Scoped TLS (the `scoped_thread_local!` macro) * `Ref::filter_map` * `RefMut::filter_map` * `RwLockReadGuard::map` * `RwLockWriteGuard::map` * `Condvar::wait_timeout_with` Closes #27714 Closes #27715 Closes #27746 Closes #27748 Closes #27908 Closes #29866
2016-02-24Auto merge of #31778 - aturon:snapshot, r=alexcrichtonbors-3/+0
r? @alexcrichton
2016-02-23Register new snapshotsAaron Turon-3/+0
2016-02-18Add intrinsics for compare_exchange and compare_exchange_weakAmanieu d'Antras-0/+27
2016-01-29trans: Reimplement unwinding on MSVCAlex Crichton-2/+10
This commit transitions the compiler to using the new exception handling instructions in LLVM for implementing unwinding for MSVC. This affects both 32 and 64-bit MSVC as they're both now using SEH-based strategies. In terms of standard library support, lots more details about how SEH unwinding is implemented can be found in the commits. In terms of trans, this change necessitated a few modifications: * Branches were added to detect when the old landingpad instruction is used or the new cleanuppad instruction is used to `trans::cleanup`. * The return value from `cleanuppad` is not stored in an `alloca` (because it cannot be). * Each block in trans now has an `Option<LandingPad>` instead of `is_lpad: bool` for indicating whether it's in a landing pad or not. The new exception handling intrinsics require that on MSVC each `call` inside of a landing pad is annotated with which landing pad that it's in. This change to the basic block means that whenever a `call` or `invoke` instruction is generated we know whether to annotate it as part of a cleanuppad or not. * Lots of modifications were made to the instruction builders to construct the new instructions as well as pass the tagging information for the call/invoke instructions. * The translation of the `try` intrinsics for MSVC has been overhauled to use the new `catchpad` instruction. The filter function is now also a rustc-generated function instead of a purely libstd-defined function. The libstd definition still exists, it just has a stable ABI across architectures and leaves some of the really weird implementation details to the compiler (e.g. the `localescape` and `localrecover` intrinsics).
2015-12-21Register new snapshotsAlex Crichton-132/+0
Lots of cruft to remove!
2015-11-12libcore: deny warnings in doctestsKevin Butler-0/+2
2015-11-01Auto merge of #29316 - GBGamer:change-unchecked-div-generic, r=eddybbors-17/+75
Similarly to the simd intrinsics. I believe this is a better solution than #29288, and I could implement it as well for overflowing_add/sub/mul. Also rename from udiv/sdiv to div, and same for rem.
2015-10-31Minor documentation correctionCole Reynolds-1/+1
Corrects `write_bytes`'s documentation as the parameter name is `val` not `c`.
2015-10-31Check unchecked_div|rem's specialisationNicholas Mazzuca-17/+75
Similarly to the simd intrinsics.
2015-10-30don't use drop_in_place as an intrinsicAlexis Beingessner-2/+2
2015-10-30expose drop_in_place as ptr::drop_in_placeAlexis Beingessner-1/+20
2015-10-13Correct spelling in docsAndrew Paseltiner-1/+1
2015-10-08typos: fix a grabbag of typos all over the placeCristi Cobzarenco-3/+3
2015-08-22Rollup merge of #27904 - tshepang:nit, r=nikomatsakisSteve Klabnik-1/+1
2015-08-19make these parameters follow idiomTshepang Lekhonkhobe-1/+1
2015-08-19doc: improve transmute example a littleTshepang Lekhonkhobe-2/+2
2015-08-15core: Fill out issues for unstable featuresAlex Crichton-1/+2
2015-07-27Register new snapshots (2015-07-26 a5c12f4).Eduard Burtescu-9/+0
2015-07-22placate `make tidy`.Felix S. Klock II-1/+1
2015-07-22Change signature for `move_val_init` intrinsic to take `*mut T` for `dest`.Felix S. Klock II-0/+8
rebase update to typeck/check/mod.rs
2015-07-21trans: Move rust_try into the compilerAlex Crichton-0/+6
This commit moves the IR files in the distribution, rust_try.ll, rust_try_msvc_64.ll, and rust_try_msvc_32.ll into the compiler from the main distribution. There's a few reasons for this change: * LLVM changes its IR syntax from time to time, so it's very difficult to have these files build across many LLVM versions simultaneously. We'll likely want to retain this ability for quite some time into the future. * The implementation of these files is closely tied to the compiler and runtime itself, so it makes sense to fold it into a location which can do more platform-specific checks for various implementation details (such as MSVC 32 vs 64-bit). * This removes LLVM as a build-time dependency of the standard library. This may end up becoming very useful if we move towards building the standard library with Cargo. In the immediate future, however, this commit should restore compatibility with LLVM 3.5 and 3.6.
2015-07-09Update intrinsics.rsWei-Ming Yang-5/+5
fix typos
2015-06-17core: Split apart the global `core` featureAlex Crichton-5/+8
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-06-09Exise 'unsafe pointer' in favor of 'raw pointer'Steve Klabnik-1/+1
Using two terms for one thing is confusing, these are called 'raw pointers' today.
2015-06-06Remove many unneeded feature annotations in the docsSteve Klabnik-2/+0
When things get stabilized, they don't always have their docs updated to remove the gate.
2015-05-27Remove #[cfg(stage0)] items.Eduard Burtescu-15/+4
2015-05-15Allow for better optimizations of iterators for zero-sized typesBjörn Steinbrink-0/+14
Using regular pointer arithmetic to iterate collections of zero-sized types doesn't work, because we'd get the same pointer all the time. Our current solution is to convert the pointer to an integer, add an offset and then convert back, but this inhibits certain optimizations. What we should do instead is to convert the pointer to one that points to an i8*, and then use a LLVM GEP instructions without the inbounds flag to perform the pointer arithmetic. This allows to generate pointers that point outside allocated objects without causing UB (as long as you don't dereference them), and it wraps around using two's complement, i.e. it behaves exactly like the wrapping_* operations we're currently using, with the added benefit of LLVM being able to better optimize the resulting IR.
2015-05-13eddyb's changes for DST coercionsNick Cameron-0/+7
+ lots of rebasing
2015-05-07std: Mark `mem::forget` as a safe functionAlex Crichton-4/+0
This commit is an implementation of [RFC 1066][rfc] where the conclusion was that leaking a value is a safe operation in Rust code, so updating the signature of this function follows suit. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1066-safe-mem-forget.md Closes #25186
2015-05-01Remove ManagedSimonas Kazlauskas-3/+0
Leftovers from @-pointer times.
2015-04-29rollup merge of #24886: GBGamer/masterAlex Crichton-0/+17
These are useful when you want to catch the signals, like when you're making a kernel, or if you just don't want the overhead. (I don't know if there are any of the second kind of people, I don't think it's a good idea, but hey, choice is good).
2015-04-29rollup merge of #24833: tari/rfc888Alex Crichton-0/+15
Closes #24118, implementing RFC 888.
2015-04-29rollup merge of #24610: nagisa/offset-docsAlex Crichton-3/+8
2015-04-29Update SNAPs to latest snapshot.Peter Marheine-4/+4
2015-04-28Add intrinsics for unchecked division and moduloNicholas Mazzuca-0/+17
The "unchecked_" div and rem functions will give UB in case of rhs == 0, or, in the signed versions, lhs == INT::min and rhs == -1
2015-04-28Register new snapshotsTamir Duberstein-14/+0
2015-04-28Clarify offset rules a bitSimonas Kazlauskas-3/+8
2015-04-25Add singlethreaded fence intrinsics.Peter Marheine-0/+15
These new intrinsics are comparable to `atomic_signal_fence` in C++, ensuring the compiler will not reorder memory accesses across the barrier, nor will it emit any machine instructions for it. Closes #24118, implementing RFC 888.
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-9/+9
2015-04-10Implement `discriminant_value` intrinsicJames Miller-0/+6
Implements an intrinsic for extracting the value of the discriminant enum variant values. For non-enum types, this returns zero, otherwise it returns the value we use for discriminant comparisons. This means that enum types that do not have a discriminant will also work in this arrangement. This is (at least part of) the work on Issue #24263
2015-03-31Test fixes and rebase conflicts, round 1Alex Crichton-1/+0