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

Experiment with moving the task pointer to thread local storage #466

Closed
pcwalton opened this issue Jun 10, 2011 · 7 comments
Closed

Experiment with moving the task pointer to thread local storage #466

pcwalton opened this issue Jun 10, 2011 · 7 comments
Assignees
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

Comments

@pcwalton
Copy link
Contributor

We currently thread the task pointer through all Rust functions, which increases register pressure and makes calls slightly more expensive. It may well be cheaper to put it in thread-local storage. We should experiment with this.

@BrendanEich
Copy link

SpiderMonkey, the new IonMonkey repo in particular but I hope it can be landed early, has an effort to move the JSContext *cx near-universal first parameter to TLS. Two bugs of interest:

https://bugzilla.mozilla.org/show_bug.cgi?id=659404 Measure TLS cost on platforms/compilers of interest
https://bugzilla.mozilla.org/show_bug.cgi?id=659241 IonMonkey: Stop passing JSContext * everywhere

/be

@BrendanEich
Copy link

https://bugzilla.mozilla.org/show_bug.cgi?id=659404 might be of interest.

/be

@pcwalton
Copy link
Contributor Author

This is working as of commit 9ba8617. Leaving this open while I work on removing a bunch of redundant rust_task traffic.

@pcwalton
Copy link
Contributor Author

This is needed for stack growth to work; bumping to 0.1 blocker.

@ghost ghost assigned pcwalton Sep 28, 2011
@pcwalton
Copy link
Contributor Author

Enough of this is implemented to get stack growth to work; demoting from 0.1 blocker status.

@marijnh
Copy link
Contributor

marijnh commented Sep 29, 2011

Does this mean we could drop the task argument to all functions and just make the runtime get it from tls when it needs it?

@pcwalton
Copy link
Contributor Author

Yes indeed :) It's a big win. Check out how it works in upcall_malloc (I think I put it there for testing).

marijnh added a commit that referenced this issue Oct 20, 2011
marijnh added a commit that referenced this issue Oct 20, 2011
Only intrinsics still take a dummy taskptr. We'll have to do some
makefile stunts to snapshot a version without taskptrs-in-intrinsics.

Issue #466
@marijnh marijnh closed this as completed Oct 20, 2011
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Required manual fix due to API changes:
    - compiler/rustc_codegen_llvm/src/gotoc/mir_to_goto/context/goto_ctx.rs
    - compiler/rustc_codegen_llvm/src/gotoc/mir_to_goto/monomorphize/collector.rs

Updated test expectations due to issue rust-lang#466:
    - src/test/expected/enum/expected
    - src/test/expected/niche/expected
    - src/test/expected/niche2/expected
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
I refactored how we codegen panic statements so it now it terminate the
program per its spec. I have also removed the hack we had to try to get
the assert location.

Since we currently do not support stack unwinding, the panic codegen
will always terminate immediately and it will not try to unwind the stack.
I added an option to RMC to force the compiler to use abort as the panic
strategy and a check to rmc codegen that will fail if the user tries to
override that.

Another note is that we currently do not support `#[track_caller]` and I
have not changed that.

This change fixes rust-lang#67, fixes rust-lang#466, fixes rust-lang#543, and fixes rust-lang#636. This
change also mitigates rust-lang#545.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Projects
None yet
Development

No branches or pull requests

3 participants