Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc: Switch defaults from libgreen to libnative #12833

Merged
merged 3 commits into from Mar 22, 2014

Conversation

alexcrichton
Copy link
Member

The compiler will no longer inject libgreen as the default runtime for rust
programs, this commit switches it over to libnative by default. Now that
libnative has baked for some time, it is ready enough to start getting more
serious usage as the default runtime for rustc generated binaries.

We've found that there isn't really a correct decision in choosing a 1:1 or M:N
runtime as a default for all applications, but it seems that a larger number of
programs today would work more reasonably with a native default rather than a
green default.

With this commit come a number of bugfixes:

  • The main native task is now named <main>
  • The main native task has the stack bounds set up properly
  • #[no_uv] was renamed to #[no_start]
  • The core-run-destroy test was rewritten for both libnative and libgreen and
    one of the tests was modified to be more robust.
  • The process-detach test was locked to libgreen because it uses signal handling

@lilyball
Copy link
Contributor

I'm not comfortable making this change until we have a better solution for selecting across I/O and channels at the same time. The current solution requires spawning two tasks per I/O channel, which is acceptable (if not ideal) with libgreen but seems rather poor with libnative.

Heck, I don't think we even have a solution right now for selecting over multiple I/O streams alone, besides wrapping them in channels and using the poor solution referred to above.

@alexcrichton
Copy link
Member Author

selecting across I/O and channels at the same time

I don't understand how that's relevant to this change. Any solution would encompass both libgreen and libnative.

The current solution requires spawning two tasks per I/O channel, which is acceptable (if not ideal) with libgreen but seems rather poor with libnative.

That's why we wrote libgreen as well as libnative, you get to choose. As I wrote in the commit message, there is no right choice, there's just something that we feel is an appropriate default.

Heck, I don't think we even have a solution right now for selecting over multiple I/O streams alone

This also seems unrelated to the green/native default.

@lilyball
Copy link
Contributor

@alexcrichton Any library that needs to select across I/O alone, or I/O and channels, is forced to use the workaround of two channels/tasks per I/O. Superfluous tasks that are expected to be blocked for 99% of their life is a decent fit for libgreen tasks but is pretty crappy for libnative threads. But libraries don't have any control over their threading (unless their API is such that they're capable of setting up their own task pool and blocking on it, but that's uncommon).

@brson
Copy link
Contributor

brson commented Mar 16, 2014

Having to use a lot of tasks for I/O is not great under either threading regime, and I/O needs to be easier still regardless of this patch. Native threading is the right default for Rust and I hope we can get it in for the 0.10 release.

@thestinger
Copy link
Contributor

@kballard: The memory consumption is the same either way, as it's dominated by the stack. I don't think leaving a thread blocked is worse with a native thread as it's not actually going to be doing any context switching.

@alexcrichton
Copy link
Member Author

ping r?

The compiler will no longer inject libgreen as the default runtime for rust
programs, this commit switches it over to libnative by default. Now that
libnative has baked for some time, it is ready enough to start getting more
serious usage as the default runtime for rustc generated binaries.

We've found that there isn't really a correct decision in choosing a 1:1 or M:N
runtime as a default for all applications, but it seems that a larger number of
programs today would work more reasonable with a native default rather than a
green default.

With this commit come a number of bugfixes:

* The main native task is now named "<main>"
* The main native task has the stack bounds set up properly
* #[no_uv] was renamed to #[no_start]
* The core-run-destroy test was rewritten for both libnative and libgreen and
  one of the tests was modified to be more robust.
* The process-detach test was locked to libgreen because it uses signal handling
This removes even more rust_builtin.c code, and allows us to more gracefully
handle errors (not a process panic, but a task failure).
The details can be found in the comment I wrote on the block in question, but
the gist of it is that our usage of the TIB for a stack limit was causing
CryptAcquireContext to fail, so we temporarily get around it by setting the
stack limit to 0.
bors added a commit that referenced this pull request Mar 22, 2014
The compiler will no longer inject libgreen as the default runtime for rust
programs, this commit switches it over to libnative by default. Now that
libnative has baked for some time, it is ready enough to start getting more
serious usage as the default runtime for rustc generated binaries.

We've found that there isn't really a correct decision in choosing a 1:1 or M:N
runtime as a default for all applications, but it seems that a larger number of
programs today would work more reasonably with a native default rather than a
green default.

With this commit come a number of bugfixes:

* The main native task is now named `<main>`
* The main native task has the stack bounds set up properly
* #[no_uv] was renamed to #[no_start]
* The core-run-destroy test was rewritten for both libnative and libgreen and
  one of the tests was modified to be more robust.
* The process-detach test was locked to libgreen because it uses signal handling
@bors bors closed this Mar 22, 2014
@bors bors merged commit e7c4fb6 into rust-lang:master Mar 22, 2014
@alexcrichton alexcrichton deleted the libnative branch March 22, 2014 04:57
fasterthanlime pushed a commit to fasterthanlime/rust that referenced this pull request Jul 22, 2022
Add proc-macro-srv integration test that clones literals

This exercises some of the upcoming proc_macro bridge changes. It should also pass for all supported ABIs, with the older-style bridge.

This changed is tracked in:

  * rust-lang/rust-analyzer#12818
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants