Commit Graph

105 Commits

Author SHA1 Message Date
Simon Sapin b2d526cc8c Mark alloc_jemalloc as perma-unstable 2018-06-11 13:48:57 -07:00
Mark Simulacrum 9e3432447a Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
Steven Fackler 9e8f683476 Remove Alloc::oom 2018-04-22 10:08:49 -07:00
Steven Fackler e513c1bd31 Replace GlobalAlloc::oom with a lang item 2018-04-22 10:08:17 -07:00
Simon Sapin eae0d46893 Restore Global.oom() functionality
… now that #[global_allocator] does not define a symbol for it
2018-04-12 22:53:21 +02:00
Simon Sapin 86753ce1cc Use the GlobalAlloc trait for #[global_allocator] 2018-04-12 22:53:12 +02:00
Simon Sapin ba7081a033 Make AllocErr a zero-size unit struct 2018-04-12 22:53:03 +02:00
Simon Sapin 5e5a0c21fc Separate alloc::heap::Alloc trait for stage0 #[global_allocator] 2018-04-12 22:52:54 +02:00
Mark Simulacrum c115cc655c Move deny(warnings) into rustbuild
This permits easier iteration without having to worry about warnings
being denied.

Fixes #49517
2018-04-08 16:59:14 -06:00
Oliver Schneider 679657b863
Inject the `compiler_builtins` crate whenever the `core` crate is injected 2018-04-07 09:24:35 +02:00
Mike Hommey b647583c2d Use Alloc and Layout from core::heap.
94d1970bba moved the alloc::allocator
module to core::heap, moving e.g. Alloc and Layout out of the alloc
crate. While alloc::heap reexports them, it's better to use them from
where they really come from.
2018-04-02 16:06:19 +09:00
Ed Schouten 66d53ca9e5 Make liballoc_jemalloc work on CloudABI.
The automated builds for CloudABI in dist-various-2 don't use
--disable-jemalloc, even though my original container image did. Instead
of setting that flag, let's go the extra mile of making jemalloc work.
CloudABI's C library already uses jemalloc and now exposes the API
extensions used by us.
2018-01-18 21:11:24 +01:00
Ed Schouten df0a2e440e Add CloudABI to the list of systems on which we stub out alloc_jemalloc.
The official jemalloc sources don't build cleanly on CloudABI yet, for
the reason that some of its tracing frameworks try to access the global
filesystem namespace, which CloudABI doesn't provide.

Always make use of the malloc implementation used by the C library,
which already happens to be jemalloc with some tiny build fixes.
2017-12-30 10:00:35 +01:00
kennytm 2566fa25c7
Revert "Add a file to trivially disable tool building or testing"
This reverts commit ab018c76e1.

This also adds the `ToolBuild::is_ext_tool` field to replace the previous
`ToolBuild::expectation` field, to indicate whether a build-failure of
certain tool is essential.
2017-12-27 00:00:45 +08:00
Tamir Duberstein 94d02b896c
*: strip calls to cc::Build::compile
The documentation states: "The name output should be the name of the
library." and this is already done in more recently-added callers.
2017-11-28 18:15:30 -05:00
Simon Sapin 43e32b5346 Remove comment about a branch being optimized out, fix #45831
Most often, this code is used through the `std::heap::Heap`
and `#[gloabal_allocator]` indirection, so this branch is not
optimized out anymore.
2017-11-20 16:22:17 +01:00
Simon Sapin 2dd268b652 alloc_jemalloc: don’t assume MIN_ALIGN for small sizes
See previous commit’s message for what is expected of allocators
in general, and https://github.com/jemalloc/jemalloc/issues/1072
for discussion of what jemalloc does specifically.
2017-11-20 16:22:17 +01:00
Alex Crichton 80ff0f74b0 std: Add a new wasm32-unknown-unknown target
This commit adds a new target to the compiler: wasm32-unknown-unknown. This
target is a reimagining of what it looks like to generate WebAssembly code from
Rust. Instead of using Emscripten which can bring with it a weighty runtime this
instead is a target which uses only the LLVM backend for WebAssembly and a
"custom linker" for now which will hopefully one day be direct calls to lld.

Notable features of this target include:

* There is zero runtime footprint. The target assumes nothing exists other than
  the wasm32 instruction set.
* There is zero toolchain footprint beyond adding the target. No custom linker
  is needed, rustc contains everything.
* Very small wasm modules can be generated directly from Rust code using this
  target.
* Most of the standard library is stubbed out to return an error, but anything
  related to allocation works (aka `HashMap`, `Vec`, etc).
* Naturally, any `#[no_std]` crate should be 100% compatible with this new
  target.

This target is currently somewhat janky due to how linking works. The "linking"
is currently unconditional whole program LTO (aka LLVM is being used as a
linker). Naturally that means compiling programs is pretty slow! Eventually
though this target should have a linker.

This target is also intended to be quite experimental. I'm hoping that this can
act as a catalyst for further experimentation in Rust with WebAssembly. Breaking
changes are very likely to land to this target, so it's not recommended to rely
on it in any critical capacity yet. We'll let you know when it's "production
ready".

---

Currently testing-wise this target is looking pretty good but isn't complete.
I've got almost the entire `run-pass` test suite working with this target (lots
of tests ignored, but many passing as well). The `core` test suite is still
getting LLVM bugs fixed to get that working and will take some time. Relatively
simple programs all seem to work though!

---

It's worth nothing that you may not immediately see the "smallest possible wasm
module" for the input you feed to rustc. For various reasons it's very difficult
to get rid of the final "bloat" in vanilla rustc (again, a real linker should
fix all this). For now what you'll have to do is:

    cargo install --git https://github.com/alexcrichton/wasm-gc
    wasm-gc foo.wasm bar.wasm

And then `bar.wasm` should be the smallest we can get it!

---

In any case for now I'd love feedback on this, particularly on the various
integration points if you've got better ideas of how to approach them!
2017-11-19 21:07:41 -08:00
Alex Crichton fbf9869702 rustc: Handle some libstd symbole exports better
Right now symbol exports, particularly in a cdylib, are handled by
assuming that `pub extern` combined with `#[no_mangle]` means "export
this". This isn't actually what we want for some symbols that the
standard library uses to implement itself, for example symbols related
to allocation. Additionally other special symbols like
`rust_eh_personallity` have no need to be exported from cdylib crate
types (only needed in dylib crate types).

This commit updates how rustc handles these special symbols by adding to
the hardcoded logic of symbols like `rust_eh_personallity` but also
adding a new attribute, `#[rustc_std_internal_symbol]`, which forces the
export level to be considered the same as all other Rust functions
instead of looking like a C function.

The eventual goal here is to prevent functions like `__rdl_alloc` from
showing up as part of a Rust cdylib as it's just an internal
implementation detail. This then further allows such symbols to get gc'd
by the linker when creating a cdylib.
2017-11-04 20:01:11 -07:00
bors a4541525d5 Auto merge of #45514 - gnzlbg:jemalloc_realloc2, r=sfackler
[jemalloc] set correct excess in realloc_excess
2017-11-04 04:28:13 +00:00
gnzlbg 549ab77e23 [jemalloc] set correct excess in alloc_excess 2017-11-03 17:44:58 +01:00
gnzlbg 45ef012699 use nallocx instead of sallocx 2017-10-25 20:26:27 +02:00
gnzlbg f39594d4bb move sallocx and excess into not null branch 2017-10-25 14:46:02 +02:00
gnzlbg e1a71e7b8a [jemalloc] set correct excess in realloc_excess 2017-10-25 14:29:22 +02:00
gnzlbg d16c140b7c [jemalloc] set correct excess in realloc_excess 2017-10-25 14:18:20 +02:00
Vadim Petrochenkov 9e0fc5ccd0 rustbuild: Support specifying archiver and linker explicitly 2017-10-15 22:10:07 +03:00
Marco A L Barbosa 03419c846a Bump cc to 1.01 to include x86_64-unknown-linux-gnux32 support 2017-10-11 21:35:53 -03:00
Alex Crichton 7694ca419b Update to the `cc` crate
This is the name the `gcc` crate has moved to
2017-09-28 07:45:50 -07:00
Oliver Schneider ab018c76e1
Add a file to trivially disable tool building or testing 2017-09-17 21:41:45 +02:00
Michal 'vorner' Vaner 94297c6746
Autodetect the type of allocator crate used
Annotate the allocator crates (allocator_system, allocator_jemalloc) by
the type of allocator they are. If one is requested as an exe allocator,
detect its type by the flags.

This has the effect that using this (de jure wrong) configuration in the
target spec works instead of producing a really unhelpful and arcane
linker error:

"exe-allocation-crate": "alloc_system"

Fixes #43524.
2017-09-10 19:59:42 +02:00
Ralf Jung 12d84cc009 update gcc crate
Use gcc::Build rather than deprecated gcc::Config.
Fixes #43973
2017-09-02 21:51:18 +02:00
bors 630e02f25b Auto merge of #43648 - RalfJung:jemalloc-debug, r=alexcrichton
Fix alloc_jemalloc debug feature

At least, I think that's how it should be.  'debug' is how the feature is called in liballoc_jemalloc/Cargo.toml and libstd/Cargo.toml. I verified this by making the build script panic rather than adding `--enable-debug`, and without this PR, the panic does not occur even when I set `debug-jemalloc = true` in config.toml. With the PR, the panic occurs as expected.

However, I actually have no idea what I am doing here.
2017-08-29 17:32:13 +00:00
Ralf Jung 16fc74c6a2 give up on trying to fix the assertion failure 2017-08-29 16:10:13 +02:00
Ralf Jung 7d9e26f788 Fix alloc_jemalloc debug feature
At least, I think that's how it should be.  'debug' is how the feature is called in Cargo.toml.
2017-08-29 16:10:13 +02:00
Tatsuyuki Ishi 2140a1e5c6 Whitelist for dummy_jemalloc 2017-08-27 19:02:24 +09:00
Tamir Duberstein b3f50caee0
*: remove crate_{name,type} attributes
Fixes #41701.
2017-08-25 16:18:21 -04:00
arthurprs 519cf15ea6 Update jemalloc to 4.5.0 2017-08-16 22:06:05 +02:00
Alex Crichton 9010567dcc Bump master to 1.21.0
This commit bumps the master branch's version to 1.21.0 and also updates the
bootstrap compiler from the freshly minted beta release.
2017-07-25 07:03:19 -07:00
Alex Crichton 695dee063b rustc: Implement the #[global_allocator] attribute
This PR is an implementation of [RFC 1974] which specifies a new method of
defining a global allocator for a program. This obsoletes the old
`#![allocator]` attribute and also removes support for it.

[RFC 1974]: https://github.com/rust-lang/rfcs/pull/197

The new `#[global_allocator]` attribute solves many issues encountered with the
`#![allocator]` attribute such as composition and restrictions on the crate
graph itself. The compiler now has much more control over the ABI of the
allocator and how it's implemented, allowing much more freedom in terms of how
this feature is implemented.

cc #27389
2017-07-05 14:37:01 -07:00
Steven Fackler 8aa39ad3d8 Stop disabling fill in jemalloc
The underlying bug has been fixed for over 2 years!
2017-06-25 10:58:12 -07:00
Alex Crichton be7ebdd512 Bump version and stage0 compiler 2017-06-19 22:25:05 -07:00
arthurprs 1cd077dd40 Revert "Update jemalloc to 4.5.0"
This reverts commit 65d0be3b7b.
2017-06-09 20:23:38 +02:00
Brian Anderson da100fe0bb Support VS 2017
Fixes #38584
2017-06-01 20:41:38 +00:00
arthurprs 65d0be3b7b Update jemalloc to 4.5.0 2017-05-10 18:36:24 +02:00
Matt Brubeck 675475c4d3 Specialize Vec::from_elem<u8> to use calloc or memset
Fixes #38723.
2017-04-15 09:01:56 -07:00
Shiz 536011d929 Fix jemalloc support for musl
Just like DragonFlyBSD, using the same symbols as the system allocator will
result in a segmentation fault at runtime due to allocator mismatches.
As such, prefix the jemalloc symbols instead.
2017-04-08 22:28:32 +02:00
Corey Farwell 97a1b6a055 Update usages of 'OSX' (and other old names) to 'macOS'.
As of last year with version 'Sierra', the Mac operating system is now
called 'macOS'.
2017-03-12 14:59:04 -04:00
Vadim Petrochenkov 428f063fcd Automate timestamp creation and build skipping for native libraries
Add comments
2017-03-04 21:38:26 +03:00
Vadim Petrochenkov aeadc81ddc Build compiler-rt and sanitizers only once 2017-03-04 21:38:26 +03:00
Vadim Petrochenkov f2187093f8 Add/remove `rerun-if-changed` when necessary 2017-03-04 21:38:26 +03:00